Messages in this thread | | | Subject | Re: [PATCH v17 03/10] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel() | From | "Leizhen (ThunderTown)" <> | Date | Thu, 16 Dec 2021 10:46:12 +0800 |
| |
On 2021/12/16 9:10, Baoquan He wrote: > On 12/15/21 at 02:28pm, Borislav Petkov wrote: >> On Fri, Dec 10, 2021 at 02:55:26PM +0800, Zhen Lei wrote: >>> @@ -518,7 +519,7 @@ static void __init reserve_crashkernel(void) >>> } >>> } >>> >>> - if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) { >>> + if (crash_base >= CRASH_ADDR_LOW_MAX && reserve_crashkernel_low()) { >>> memblock_phys_free(crash_base, crash_size); >>> return; >>> } >> >> That's not a equivalent transformation on X86_32.
The original value (1ULL << 32) is inaccurate, and it enlarged the CRASH_ADDR_LOW upper limit. This is because when the memory is allocated from the low end, the address cannot exceed CRASH_ADDR_LOW_MAX, see "if (!high)" branch. If the memory is allocated from the high end, 'crash_base' is greater than or equal to (1ULL << 32), and naturally, it is greater than CRASH_ADDR_LOW_MAX.
I think I should update the description, thanks.
if (!high) crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, CRASH_ALIGN, CRASH_ADDR_LOW_MAX); if (!crash_base) crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, CRASH_ALIGN, CRASH_ADDR_HIGH_MAX);
> > reserve_crashkernel_low() always return 0 on x86_32, so the not equivalent > transformation for x86_32 doesn't matter, I think. > > . >
| |