]> git.ipfire.org Git - thirdparty/linux.git/commit
mm/memblock: Add "reserve_mem" to reserved named memory at boot up
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 13 Jun 2024 15:55:07 +0000 (11:55 -0400)
committerMike Rapoport (IBM) <rppt@kernel.org>
Wed, 19 Jun 2024 07:59:49 +0000 (10:59 +0300)
commit1e4c64b71c9bf230b25fde12cbcceacfdc8b3332
tree20c8fdee1895eb8d8ab6701ab64d584d11f28f9a
parent0e9899feed9cbb7d33c01ad849dc307b1560b0ab
mm/memblock: Add "reserve_mem" to reserved named memory at boot up

In order to allow for requesting a memory region that can be used for
things like pstore on multiple machines where the memory layout is not the
same, add a new option to the kernel command line called "reserve_mem".

The format is:  reserve_mem=nn:align:name

Where it will find nn amount of memory at the given alignment of align.
The name field is to allow another subsystem to retrieve where the memory
was found. For example:

  reserve_mem=12M:4096:oops ramoops.mem_name=oops

Where ramoops.mem_name will tell ramoops that memory was reserved for it
via the reserve_mem option and it can find it by calling:

  if (reserve_mem_find_by_name("oops", &start, &size)) {
// start holds the start address and size holds the size given

This is typically used for systems that do not wipe the RAM, and this
command line will try to reserve the same physical memory on soft reboots.
Note, it is not guaranteed to be the same location. For example, if KASLR
places the kernel at the location of where the RAM reservation was from a
previous boot, the new reservation will be at a different location.  Any
subsystem using this feature must add a way to verify that the contents of
the physical memory is from a previous boot, as there may be cases where
the memory will not be located at the same location.

Not all systems may work either. There could be bit flips if the reboot
goes through the BIOS. Using kexec to reboot the machine is likely to
have better results in such cases.

Link: https://lore.kernel.org/all/ZjJVnZUX3NZiGW6q@kernel.org/
Suggested-by: Mike Rapoport <rppt@kernel.org>
Tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20240613155527.437020271@goodmis.org
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Documentation/admin-guide/kernel-parameters.txt
include/linux/mm.h
mm/memblock.c