]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
UBUNTU: SAUCE: powerpc/fadump: set an upper limit for boot memory size
authorHari Bathini <hbathini@linux.vnet.ibm.com>
Wed, 15 Feb 2017 18:16:11 +0000 (11:16 -0700)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 20 Feb 2017 03:57:58 +0000 (20:57 -0700)
commitbcbdcee5a065dc03defbfcd4a61bcefaf28d8503
treebb7c86b176a9f8db432f2bb54122734625cd0a63
parent365d51f2f5597e9ac2c67476ec027d10e088a78a
UBUNTU: SAUCE: powerpc/fadump: set an upper limit for boot memory size

BugLink: http://bugs.launchpad.net/bugs/1655241
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

The implicit rule here is that the sum of the sizes of boot memory,
CPU state data, HPTE region 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 closer to 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.

Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
arch/powerpc/include/asm/fadump.h
arch/powerpc/kernel/fadump.c