Files
Linux/include/linux
David Hildenbrand f7892d8e28 memblock: add MEMBLOCK_DRIVER_MANAGED to mimic IORESOURCE_SYSRAM_DRIVER_MANAGED
Let's add a flag that corresponds to IORESOURCE_SYSRAM_DRIVER_MANAGED,
indicating that we're dealing with a memory region that is never
indicated in the firmware-provided memory map, but always detected and
added by a driver.

Similar to MEMBLOCK_HOTPLUG, most infrastructure has to treat such
memory regions like ordinary MEMBLOCK_NONE memory regions -- for
example, when selecting memory regions to add to the vmcore for dumping
in the crashkernel via for_each_mem_range().

However, especially kexec_file is not supposed to select such memblocks
via for_each_free_mem_range() / for_each_free_mem_range_reverse() to
place kexec images, similar to how we handle
IORESOURCE_SYSRAM_DRIVER_MANAGED without CONFIG_ARCH_KEEP_MEMBLOCK.

We'll make sure that memory hotplug code sets the flag where applicable
(IORESOURCE_SYSRAM_DRIVER_MANAGED) next.  This prepares architectures
that need CONFIG_ARCH_KEEP_MEMBLOCK, such as arm64, for virtio-mem
support.

Note that kexec *must not* indicate this memory to the second kernel and
*must not* place kexec-images on this memory.  Let's add a comment to
kexec_walk_memblock(), documenting how we handle MEMBLOCK_DRIVER_MANAGED
now just like using IORESOURCE_SYSRAM_DRIVER_MANAGED in
locate_mem_hole_callback() for kexec_walk_resources().

Also note that MEMBLOCK_HOTPLUG cannot be reused due to different
semantics:
	MEMBLOCK_HOTPLUG: memory is indicated as "System RAM" in the
	firmware-provided memory map and added to the system early during
	boot; kexec *has to* indicate this memory to the second kernel and
	can place kexec-images on this memory. After memory hotunplug,
	kexec has to be re-armed. We mostly ignore this flag when
	"movable_node" is not set on the kernel command line, because
	then we're told to not care about hotunpluggability of such
	memory regions.

	MEMBLOCK_DRIVER_MANAGED: memory is not indicated as "System RAM" in
	the firmware-provided memory map; this memory is always detected
	and added to the system by a driver; memory might not actually be
	physically hotunpluggable. kexec *must not* indicate this memory to
	the second kernel and *must not* place kexec-images on this memory.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: David Hildenbrand <[email protected]>
Reviewed-by: Mike Rapoport <[email protected]>
Cc: "Aneesh Kumar K . V" <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Eric Biederman <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: Jianyong Wu <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Shahab Vahedi <[email protected]>
Cc: Thomas Bogendoerfer <[email protected]>
Cc: Vasily Gorbik <[email protected]>
Cc: Vineet Gupta <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2021-11-06 13:30:42 -07:00
..
…
…
…
2021-09-02 22:49:16 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
2021-09-20 12:43:34 +01:00
…
…
…
…
2021-08-29 14:47:42 +03:00
…
…
…
…
…
…
…
…
…
…
…
…
2021-10-07 16:51:57 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-08-16 10:50:32 -06:00
…
…
…
…
…
…
…
…
…
…
2021-09-08 15:32:35 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-08-26 16:52:03 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-09-07 21:17:28 +02:00
…
…
2021-08-26 15:32:28 -04:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-07-27 11:00:36 +02:00
2021-09-06 07:20:56 -04:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-07-26 15:09:44 +02:00
…
2021-07-27 20:11:45 +01:00
2021-07-27 20:11:44 +01:00
…
…
…
…
…
2021-09-03 09:58:13 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-08-05 11:46:42 +01:00
…
…
…
…
…
…
…
…
…
…
…
2021-08-16 21:26:33 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-07-27 17:05:06 +01:00
…
…
2021-07-27 09:29:15 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-09-23 11:01:12 -04:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-08-23 13:19:12 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-09-17 13:52:17 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-08-18 22:08:24 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-09-02 21:38:56 +02:00
2021-10-07 16:51:57 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-08-17 17:50:51 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-08-06 13:41:48 -07:00
…
…
2021-08-19 09:02:55 +09:00
…
…
…
2021-08-19 09:02:55 +09:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-07-27 12:17:21 +02:00
2021-07-27 12:12:08 +02:00
…
…
2021-09-08 15:32:35 -07:00
…
…
…
2021-09-15 09:22:35 -06:00
…
…
…
…
…
…
…
…
…
…
…
…
2021-08-10 11:50:55 -04:00
…
…
…
2021-08-11 06:44:24 -04:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…