1*6aeadf78SLinus Torvalds======================================= 2*6aeadf78SLinus Torvaldscrashkernel memory reservation on arm64 3*6aeadf78SLinus Torvalds======================================= 4*6aeadf78SLinus Torvalds 5*6aeadf78SLinus TorvaldsAuthor: Baoquan He <bhe@redhat.com> 6*6aeadf78SLinus Torvalds 7*6aeadf78SLinus TorvaldsKdump mechanism is used to capture a corrupted kernel vmcore so that 8*6aeadf78SLinus Torvaldsit can be subsequently analyzed. In order to do this, a preliminarily 9*6aeadf78SLinus Torvaldsreserved memory is needed to pre-load the kdump kernel and boot such 10*6aeadf78SLinus Torvaldskernel if corruption happens. 11*6aeadf78SLinus Torvalds 12*6aeadf78SLinus TorvaldsThat reserved memory for kdump is adapted to be able to minimally 13*6aeadf78SLinus Torvaldsaccommodate the kdump kernel and the user space programs needed for the 14*6aeadf78SLinus Torvaldsvmcore collection. 15*6aeadf78SLinus Torvalds 16*6aeadf78SLinus TorvaldsKernel parameter 17*6aeadf78SLinus Torvalds================ 18*6aeadf78SLinus Torvalds 19*6aeadf78SLinus TorvaldsThrough the kernel parameters below, memory can be reserved accordingly 20*6aeadf78SLinus Torvaldsduring the early stage of the first kernel booting so that a continuous 21*6aeadf78SLinus Torvaldslarge chunk of memomy can be found. The low memory reservation needs to 22*6aeadf78SLinus Torvaldsbe considered if the crashkernel is reserved from the high memory area. 23*6aeadf78SLinus Torvalds 24*6aeadf78SLinus Torvalds- crashkernel=size@offset 25*6aeadf78SLinus Torvalds- crashkernel=size 26*6aeadf78SLinus Torvalds- crashkernel=size,high crashkernel=size,low 27*6aeadf78SLinus Torvalds 28*6aeadf78SLinus TorvaldsLow memory and high memory 29*6aeadf78SLinus Torvalds========================== 30*6aeadf78SLinus Torvalds 31*6aeadf78SLinus TorvaldsFor kdump reservations, low memory is the memory area under a specific 32*6aeadf78SLinus Torvaldslimit, usually decided by the accessible address bits of the DMA-capable 33*6aeadf78SLinus Torvaldsdevices needed by the kdump kernel to run. Those devices not related to 34*6aeadf78SLinus Torvaldsvmcore dumping can be ignored. On arm64, the low memory upper bound is 35*6aeadf78SLinus Torvaldsnot fixed: it is 1G on the RPi4 platform but 4G on most other systems. 36*6aeadf78SLinus TorvaldsOn special kernels built with CONFIG_ZONE_(DMA|DMA32) disabled, the 37*6aeadf78SLinus Torvaldswhole system RAM is low memory. Outside of the low memory described 38*6aeadf78SLinus Torvaldsabove, the rest of system RAM is considered high memory. 39*6aeadf78SLinus Torvalds 40*6aeadf78SLinus TorvaldsImplementation 41*6aeadf78SLinus Torvalds============== 42*6aeadf78SLinus Torvalds 43*6aeadf78SLinus Torvalds1) crashkernel=size@offset 44*6aeadf78SLinus Torvalds-------------------------- 45*6aeadf78SLinus Torvalds 46*6aeadf78SLinus TorvaldsThe crashkernel memory must be reserved at the user-specified region or 47*6aeadf78SLinus Torvaldsfail if already occupied. 48*6aeadf78SLinus Torvalds 49*6aeadf78SLinus Torvalds 50*6aeadf78SLinus Torvalds2) crashkernel=size 51*6aeadf78SLinus Torvalds------------------- 52*6aeadf78SLinus Torvalds 53*6aeadf78SLinus TorvaldsThe crashkernel memory region will be reserved in any available position 54*6aeadf78SLinus Torvaldsaccording to the search order: 55*6aeadf78SLinus Torvalds 56*6aeadf78SLinus TorvaldsFirstly, the kernel searches the low memory area for an available region 57*6aeadf78SLinus Torvaldswith the specified size. 58*6aeadf78SLinus Torvalds 59*6aeadf78SLinus TorvaldsIf searching for low memory fails, the kernel falls back to searching 60*6aeadf78SLinus Torvaldsthe high memory area for an available region of the specified size. If 61*6aeadf78SLinus Torvaldsthe reservation in high memory succeeds, a default size reservation in 62*6aeadf78SLinus Torvaldsthe low memory will be done. Currently the default size is 128M, 63*6aeadf78SLinus Torvaldssufficient for the low memory needs of the kdump kernel. 64*6aeadf78SLinus Torvalds 65*6aeadf78SLinus TorvaldsNote: crashkernel=size is the recommended option for crashkernel kernel 66*6aeadf78SLinus Torvaldsreservations. The user would not need to know the system memory layout 67*6aeadf78SLinus Torvaldsfor a specific platform. 68*6aeadf78SLinus Torvalds 69*6aeadf78SLinus Torvalds3) crashkernel=size,high crashkernel=size,low 70*6aeadf78SLinus Torvalds--------------------------------------------- 71*6aeadf78SLinus Torvalds 72*6aeadf78SLinus Torvaldscrashkernel=size,(high|low) are an important supplement to 73*6aeadf78SLinus Torvaldscrashkernel=size. They allows the user to specify how much memory needs 74*6aeadf78SLinus Torvaldsto be allocated from the high memory and low memory respectively. On 75*6aeadf78SLinus Torvaldsmany systems the low memory is precious and crashkernel reservations 76*6aeadf78SLinus Torvaldsfrom this area should be kept to a minimum. 77*6aeadf78SLinus Torvalds 78*6aeadf78SLinus TorvaldsTo reserve memory for crashkernel=size,high, searching is first 79*6aeadf78SLinus Torvaldsattempted from the high memory region. If the reservation succeeds, the 80*6aeadf78SLinus Torvaldslow memory reservation will be done subsequently. 81*6aeadf78SLinus Torvalds 82*6aeadf78SLinus TorvaldsIf reservation from the high memory failed, the kernel falls back to 83*6aeadf78SLinus Torvaldssearching the low memory with the specified size in crashkernel=,high. 84*6aeadf78SLinus TorvaldsIf it succeeds, no further reservation for low memory is needed. 85*6aeadf78SLinus Torvalds 86*6aeadf78SLinus TorvaldsNotes: 87*6aeadf78SLinus Torvalds 88*6aeadf78SLinus Torvalds- If crashkernel=,low is not specified, the default low memory 89*6aeadf78SLinus Torvalds reservation will be done automatically. 90*6aeadf78SLinus Torvalds 91*6aeadf78SLinus Torvalds- if crashkernel=0,low is specified, it means that the low memory 92*6aeadf78SLinus Torvalds reservation is omitted intentionally. 93