[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250225000048.f2nmfn5isuh3fn6s@master>
Date: Tue, 25 Feb 2025 00:00:48 +0000
From: Wei Yang <richard.weiyang@...il.com>
To: Mike Rapoport <rppt@...nel.org>
Cc: Wei Yang <richard.weiyang@...il.com>, linux-kernel@...r.kernel.org,
Alexander Graf <graf@...zon.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Anthony Yznaga <anthony.yznaga@...cle.com>,
Arnd Bergmann <arnd@...db.de>, Ashish Kalra <ashish.kalra@....com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Borislav Petkov <bp@...en8.de>,
Catalin Marinas <catalin.marinas@....com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
David Woodhouse <dwmw2@...radead.org>,
Eric Biederman <ebiederm@...ssion.com>,
Ingo Molnar <mingo@...hat.com>, James Gowans <jgowans@...zon.com>,
Jonathan Corbet <corbet@....net>,
Krzysztof Kozlowski <krzk@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Paolo Bonzini <pbonzini@...hat.com>,
Pasha Tatashin <pasha.tatashin@...een.com>,
"H. Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>,
Pratyush Yadav <ptyadav@...zon.de>,
Rob Herring <robh+dt@...nel.org>, Rob Herring <robh@...nel.org>,
Saravana Kannan <saravanak@...gle.com>,
Stanislav Kinsburskii <skinsburskii@...ux.microsoft.com>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
Tom Lendacky <thomas.lendacky@....com>,
Usama Arif <usama.arif@...edance.com>,
Will Deacon <will@...nel.org>, devicetree@...r.kernel.org,
kexec@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org,
linux-doc@...r.kernel.org, linux-mm@...ck.org, x86@...nel.org
Subject: Re: [PATCH v4 12/14] x86: Add KHO support
On Mon, Feb 24, 2025 at 04:36:38PM +0200, Mike Rapoport wrote:
>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@...zon.com>
>> [...]
>> >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.
>
Thanks, I see you point. We would add memory region during kho_populate() and
mark it scratch.
>> 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.
--
Wei Yang
Help you, Help me
Powered by blists - more mailing lists