|
| 1 | +======================================= |
| 2 | +crashkernel memory reservation on arm64 |
| 3 | +======================================= |
| 4 | + |
| 5 | +Author: Baoquan He <bhe@redhat.com> |
| 6 | + |
| 7 | +Kdump mechanism is used to capture a corrupted kernel vmcore so that |
| 8 | +it can be subsequently analyzed. In order to do this, a preliminarily |
| 9 | +reserved memory is needed to pre-load the kdump kernel and boot such |
| 10 | +kernel if corruption happens. |
| 11 | + |
| 12 | +That reserved memory for kdump is adapted to be able to minimally |
| 13 | +accommodate the kdump kernel and the user space programs needed for the |
| 14 | +vmcore collection. |
| 15 | + |
| 16 | +Kernel parameter |
| 17 | +================ |
| 18 | + |
| 19 | +Through the kernel parameters below, memory can be reserved accordingly |
| 20 | +during the early stage of the first kernel booting so that a continuous |
| 21 | +large chunk of memomy can be found. The low memory reservation needs to |
| 22 | +be considered if the crashkernel is reserved from the high memory area. |
| 23 | + |
| 24 | +- crashkernel=size@offset |
| 25 | +- crashkernel=size |
| 26 | +- crashkernel=size,high crashkernel=size,low |
| 27 | + |
| 28 | +Low memory and high memory |
| 29 | +========================== |
| 30 | + |
| 31 | +For kdump reservations, low memory is the memory area under a specific |
| 32 | +limit, usually decided by the accessible address bits of the DMA-capable |
| 33 | +devices needed by the kdump kernel to run. Those devices not related to |
| 34 | +vmcore dumping can be ignored. On arm64, the low memory upper bound is |
| 35 | +not fixed: it is 1G on the RPi4 platform but 4G on most other systems. |
| 36 | +On special kernels built with CONFIG_ZONE_(DMA|DMA32) disabled, the |
| 37 | +whole system RAM is low memory. Outside of the low memory described |
| 38 | +above, the rest of system RAM is considered high memory. |
| 39 | + |
| 40 | +Implementation |
| 41 | +============== |
| 42 | + |
| 43 | +1) crashkernel=size@offset |
| 44 | +-------------------------- |
| 45 | + |
| 46 | +The crashkernel memory must be reserved at the user-specified region or |
| 47 | +fail if already occupied. |
| 48 | + |
| 49 | + |
| 50 | +2) crashkernel=size |
| 51 | +------------------- |
| 52 | + |
| 53 | +The crashkernel memory region will be reserved in any available position |
| 54 | +according to the search order: |
| 55 | + |
| 56 | +Firstly, the kernel searches the low memory area for an available region |
| 57 | +with the specified size. |
| 58 | + |
| 59 | +If searching for low memory fails, the kernel falls back to searching |
| 60 | +the high memory area for an available region of the specified size. If |
| 61 | +the reservation in high memory succeeds, a default size reservation in |
| 62 | +the low memory will be done. Currently the default size is 128M, |
| 63 | +sufficient for the low memory needs of the kdump kernel. |
| 64 | + |
| 65 | +Note: crashkernel=size is the recommended option for crashkernel kernel |
| 66 | +reservations. The user would not need to know the system memory layout |
| 67 | +for a specific platform. |
| 68 | + |
| 69 | +3) crashkernel=size,high crashkernel=size,low |
| 70 | +--------------------------------------------- |
| 71 | + |
| 72 | +crashkernel=size,(high|low) are an important supplement to |
| 73 | +crashkernel=size. They allows the user to specify how much memory needs |
| 74 | +to be allocated from the high memory and low memory respectively. On |
| 75 | +many systems the low memory is precious and crashkernel reservations |
| 76 | +from this area should be kept to a minimum. |
| 77 | + |
| 78 | +To reserve memory for crashkernel=size,high, searching is first |
| 79 | +attempted from the high memory region. If the reservation succeeds, the |
| 80 | +low memory reservation will be done subsequently. |
| 81 | + |
| 82 | +If reservation from the high memory failed, the kernel falls back to |
| 83 | +searching the low memory with the specified size in crashkernel=,high. |
| 84 | +If it succeeds, no further reservation for low memory is needed. |
| 85 | + |
| 86 | +Notes: |
| 87 | + |
| 88 | +- If crashkernel=,low is not specified, the default low memory |
| 89 | + reservation will be done automatically. |
| 90 | + |
| 91 | +- if crashkernel=0,low is specified, it means that the low memory |
| 92 | + reservation is omitted intentionally. |
0 commit comments