On Mon, Apr 14, 2025 at 07:19:02AM -0700, Dave Hansen wrote: > On 4/13/25 02:23, tip-bot2 for Mike Rapoport (Microsoft) wrote: > > + /* > > + * 32-bit systems are limited to 4BG of memory even with HIGHMEM and > > + * to even less without it. > > + * Discard memory after max_pfn - the actual limit detected at runtime. > > + */ > > + if (IS_ENABLED(CONFIG_X86_32)) > > + memblock_remove(PFN_PHYS(max_pfn), -1); > > Mike, thanks for the quick fix! I did verify that this gets my silly > test VM booting again. > > The patch obviously _works_. But in the case I was hitting max_pfn was > set MAX_NONPAE_PFN. The unfortunate part about this hunk is that it's > far away from the related warning: Yeah, my first instinct was to put memblock_remove() in the same 'if', but there's no memblock there yet :) > > if (max_pfn > MAX_NONPAE_PFN) { > > max_pfn = MAX_NONPAE_PFN; > > printk(KERN_WARNING MSG_HIGHMEM_TRIMMED); > > } > > and it's logically doing the same thing: truncating memory at > MAX_NONPAE_PFN. > > How about we reuse 'MAX_NONPAE_PFN' like this: > > if (IS_ENABLED(CONFIG_X86_32)) > memblock_remove(PFN_PHYS(MAX_NONPAE_PFN), -1); > > Would that make the connection more obvious? Yes, that's better. Here's the updated patch: