Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] kexec,mm/cma: do not run the next kernel from a fixed-base CMA area
@ 2026-11-03 16:24 Radhey Shyam Pandey
  2026-11-03 16:24 ` [PATCH 1/4] kexec: do not place the next kernel in a fixed-address " Radhey Shyam Pandey
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Radhey Shyam Pandey @ 2026-11-03 16:24 UTC (permalink / raw)
  To: robh, saravanak, akpm, david, ljs, liam, vbabka, rppt, surenb,
	mhocko, m.szyprowski, robin.murphy, baoquan.he, pasha.tatashin,
	pratyush
  Cc: devicetree, linux-kernel, linux-mm, iommu, kexec,
	Radhey Shyam Pandey

Since commit 07d24902977e ("kexec: enable CMA based contiguous
allocation"), kexec_locate_mem_hole() places the next kernel in the
default CMA area and it runs from there in place. If that area has a
fixed base the loaded kernel declares the range it is executing from
as a shared-dma-pool, and cma_activate_area() frees its own image to
the page allocator. On a VEK385 that corrupts kernel text within
~300ms of /sbin/init starting.

Patch 1 is the fix and stands on its own. Patches 2 and 3 close the
same hole for a device tree placing a shared-dma-pool over the kernel
image with no kexec involved; patch 4 is an unrelated cleanup.

Changes since RFC:
- Patch 1 records CMA_DYNAMIC_BASE rather than CMA_FIXED_BASE.
- New patch 2 answers the RFC's open question (Pratyush): -EBUSY from
  node_init keeps the reservation, so refusing an overlapping pool no
  longer frees [_text, _end) along with it.
- Patch 3 reordered after it, returns -EBUSY, rejects a wrapping
  base+size; both Reviewed-by tags dropped for the rework.
- New patch 4 drops the duplicate alignment check (Mike).

Tested on VEK385: with patch 1 kexec declines all three device-tree
pools; without it the booted kernel refuses the overlapping pool.


Link to RFC: https://lore.kernel.org/all/20261014145731.3431527-1-radhey.shyam.pandey@amd.com

Radhey Shyam Pandey (4):
  kexec: do not place the next kernel in a fixed-address CMA area
  of: reserved_mem: keep the reservation when node_init returns -EBUSY
  mm/cma: reject CMA areas that overlap the kernel image
  mm/cma: drop the duplicate alignment check in rmem_cma_setup()

 drivers/of/of_reserved_mem.c    | 14 +++++++++++
 include/linux/cma.h             | 10 ++++++++
 include/linux/of_reserved_mem.h |  5 ++++
 kernel/dma/contiguous.c         |  5 ----
 kernel/kexec_file.c             | 12 +++++++++
 mm/cma.c                        | 43 ++++++++++++++++++++++++++++++++-
 mm/cma.h                        |  2 ++
 7 files changed, 85 insertions(+), 6 deletions(-)


base-commit: d6bcfc94eb4da6e089c5473970cd96727292fd97
-- 
2.44.4



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-04 16:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 16:24 [PATCH 0/4] kexec,mm/cma: do not run the next kernel from a fixed-base CMA area Radhey Shyam Pandey
2026-11-03 16:24 ` [PATCH 1/4] kexec: do not place the next kernel in a fixed-address " Radhey Shyam Pandey
2026-11-04 16:29   ` sashiko-bot
2026-11-03 16:24 ` [PATCH 2/4] of: reserved_mem: keep the reservation when node_init returns -EBUSY Radhey Shyam Pandey
2026-11-04 16:29   ` sashiko-bot
2026-11-03 16:24 ` [PATCH 3/4] mm/cma: reject CMA areas that overlap the kernel image Radhey Shyam Pandey
2026-11-04 16:29   ` sashiko-bot
2026-11-03 16:24 ` [PATCH 4/4] mm/cma: drop the duplicate alignment check in rmem_cma_setup() Radhey Shyam Pandey
2026-11-04 16:29   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox