[PATCH RFC] virtio-mem: check against memhp_get_pluggable_range() which memory we can hotplug

Anshuman Khandual anshuman.khandual at arm.com
Mon Jan 18 08:21:30 EST 2021



On 1/18/21 6:43 PM, Anshuman Khandual wrote:
> From: David Hildenbrand <david at redhat.com>
> 
> Right now, we only check against MAX_PHYSMEM_BITS - but turns out there
> are more restrictions of which memory we can actually hotplug, especially
> om arm64 or s390x once we support them: we might receive something like
> -E2BIG or -ERANGE from add_memory_driver_managed(), stopping device
> operation.
> 
> So, check right when initializing the device which memory we can add,
> warning the user. Try only adding actually pluggable ranges: in the worst
> case, no memory provided by our device is pluggable.
> 
> In the usual case, we expect all device memory to be pluggable, and in
> corner cases only some memory at the end of the device-managed memory
> region to not be pluggable.
> 
> Cc: "Michael S. Tsirkin" <mst at redhat.com>
> Cc: Jason Wang <jasowang at redhat.com>
> Cc: Pankaj Gupta <pankaj.gupta.linux at gmail.com>
> Cc: Michal Hocko <mhocko at kernel.org>
> Cc: Oscar Salvador <osalvador at suse.de>
> Cc: Wei Yang <richard.weiyang at linux.alibaba.com>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: catalin.marinas at arm.com
> Cc: teawater <teawaterz at linux.alibaba.com>
> Cc: Anshuman Khandual <anshuman.khandual at arm.com>
> Cc: Pankaj Gupta <pankaj.gupta at cloud.ionos.com>
> Cc: Jonathan Cameron <Jonathan.Cameron at huawei.com>
> Cc: hca at linux.ibm.com
> Cc: Vasily Gorbik <gor at linux.ibm.com>
> Cc: Will Deacon <will at kernel.org>
> Cc: Ard Biesheuvel <ardb at kernel.org>
> Cc: Mark Rutland <mark.rutland at arm.com>
> Cc: Heiko Carstens <hca at linux.ibm.com>
> Cc: Michal Hocko <mhocko at kernel.org>
> Signed-off-by: David Hildenbrand <david at redhat.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual at arm.com>

Hello David,

As your original patch was in the RFC state, I have just maintained
the same here as well. But once you test this patch along with the
new series, please do let me know if this needs to be converted to
a normal PATCH instead. Thank you.

- Anshuman



More information about the linux-arm-kernel mailing list