remarkable-linux/arch/powerpc
Hari Bathini 48a316e350 powerpc/fadump: Set an upper limit for boot memory size
By default, 5% of system RAM is reserved for preserving boot memory.
Alternatively, a user can specify the amount of memory to reserve.
See Documentation/powerpc/firmware-assisted-dump.txt for details. In
addition to the memory reserved for preserving boot memory, some more
memory is reserved, to save HPTE region, CPU state data and ELF core
headers.

Memory Reservation during first kernel looks like below:

  Low memory                                        Top of memory
  0      boot memory size                                       |
  |           |                       |<--Reserved dump area -->|
  V           V                       |   Permanent Reservation V
  +-----------+----------/ /----------+---+----+-----------+----+
  |           |                       |CPU|HPTE|  DUMP     |ELF |
  +-----------+----------/ /----------+---+----+-----------+----+
        |                                           ^
        |                                           |
        \                                           /
         -------------------------------------------
          Boot memory content gets transferred to
          reserved area by firmware at the time of
          crash

This implicitly means that the sum of the sizes of boot memory, CPU
state data, HPTE region, DUMP preserving area and ELF core headers
can't be greater than the total memory size. But currently, a user is
allowed to specify any value as boot memory size. So, the above rule
is violated when a boot memory size around 50% of the total available
memory is specified. As the kernel is not handling this currently, it
may lead to undefined behavior. Fix it by setting an upper limit for
boot memory size to 25% of the total available memory. Also, instead
of using memblock_end_of_DRAM(), which doesn't take the holes, if any,
in the memory layout into account, use memblock_phys_mem_size() to
calculate the percentage of total available memory.

Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-06-02 20:16:50 +10:00
..
boot powerpc/64: Do not link crtsaveres.o in boot 2017-05-30 14:59:51 +10:00
configs powerpc/44x/fsp2: Add defconfig for FSP2 board 2017-05-30 14:59:51 +10:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-05-02 15:53:46 -07:00
include powerpc/fadump: Set an upper limit for boot memory size 2017-06-02 20:16:50 +10:00
kernel powerpc/fadump: Set an upper limit for boot memory size 2017-06-02 20:16:50 +10:00
kvm KVM: PPC: Book3S PR: Don't include SPAPR TCE code on non-pseries platforms 2017-05-12 15:32:30 +10:00
lib powerpc/64: Linker on-demand sfpr functions for modules 2017-05-30 14:59:51 +10:00
math-emu
mm powerpc/mm: The 8xx doesn't call do_page_fault() for breakpoints 2017-06-02 19:20:12 +10:00
net
oprofile
perf powerpc/perf: Add Power8 mem_access event to sysfs 2017-04-19 20:00:23 +10:00
platforms powerpc/44x/fsp2: Platform support for FSP2 (476fpe) board 2017-05-30 14:59:51 +10:00
purgatory
sysdev powerpc/8xx: fix mpc8xx_get_irq() return on no irq 2017-06-02 19:20:44 +10:00
tools powerpc/64: Tool to check head sections location sanity 2017-05-30 14:59:51 +10:00
xmon powerpc/xmon: Fix compile error with PPC_8xx=y 2017-05-30 14:59:51 +10:00
Kconfig powerpc: Remove __ilog2()s and use generic ones 2017-06-02 19:23:56 +10:00
Kconfig.debug
Makefile powerpc: Link warning for orphan sections 2017-05-30 14:59:51 +10:00
Makefile.postlink powerpc/64: Tool to check head sections location sanity 2017-05-30 14:59:51 +10:00