Re: [PATCH v4 12/14] x86: Add KHO support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 24, 2025 at 07:13:55AM +0000, Wei Yang wrote:
> On Thu, Feb 06, 2025 at 03:27:52PM +0200, Mike Rapoport wrote:
> >From: Alexander Graf <graf@xxxxxxxxxx>
> [...]
> >diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
> >index 82b96ed9890a..0b81cd70b02a 100644
> >--- a/arch/x86/kernel/e820.c
> >+++ b/arch/x86/kernel/e820.c
> >@@ -1329,6 +1329,24 @@ void __init e820__memblock_setup(void)
> > 		memblock_add(entry->addr, entry->size);
> > 	}
> > 
> >+	/*
> >+	 * At this point with KHO we only allocate from scratch memory.
> >+	 * At the same time, we configure memblock to only allow
> >+	 * allocations from memory below ISA_END_ADDRESS which is not
> >+	 * a natural scratch region, because Linux ignores memory below
> >+	 * ISA_END_ADDRESS at runtime. Beside very few (if any) early
> >+	 * allocations, we must allocate real-mode trapoline below
> >+	 * ISA_END_ADDRESS.
> >+	 *
> >+	 * To make sure that we can actually perform allocations during
> >+	 * this phase, let's mark memory below ISA_END_ADDRESS as scratch
> >+	 * so we can allocate from there in a scratch-only world.
> >+	 *
> >+	 * After real mode trampoline is allocated, we clear scratch
> >+	 * marking from the memory below ISA_END_ADDRESS
> >+	 */
> >+	memblock_mark_kho_scratch(0, ISA_END_ADDRESS);
> >+
> 
> At the beginning of e820__memblock_setup() we call memblock_allow_resize(),
> which means during adding memory region it could double the array. And the
> memory used here is from some region just added.

There are large KHO scratch areas that will be used for most allocations.
Marking the memory below ISA_END_ADDRESS as KHO scratch is required to
satisfy allocations that explicitly limit the allocation to ISA_END_ADDRESS,
e.g the real time trampoline.
 
> But with KHO, I am afraid it would fail?
> 
> > 	/* Throw away partial pages: */
> > 	memblock_trim_memory(PAGE_SIZE);
> > 
> 
> -- 
> Wei Yang
> Help you, Help me

-- 
Sincerely yours,
Mike.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux