[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230403155011.aodnd5ratcyeie52@box.shutemov.name>
Date: Mon, 3 Apr 2023 18:50:11 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Borislav Petkov <bp@...en8.de>,
Andy Lutomirski <luto@...nel.org>,
Sean Christopherson <seanjc@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Joerg Roedel <jroedel@...e.de>,
Ard Biesheuvel <ardb@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
David Rientjes <rientjes@...gle.com>,
Tom Lendacky <thomas.lendacky@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Ingo Molnar <mingo@...hat.com>,
Dario Faggioli <dfaggioli@...e.com>,
Dave Hansen <dave.hansen@...el.com>,
Mike Rapoport <rppt@...nel.org>,
David Hildenbrand <david@...hat.com>,
Mel Gorman <mgorman@...hsingularity.net>,
marcelo.cerri@...onical.com, tim.gardner@...onical.com,
khalid.elmously@...onical.com, philip.cox@...onical.com,
aarcange@...hat.com, peterx@...hat.com, x86@...nel.org,
linux-mm@...ck.org, linux-coco@...ts.linux.dev,
linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv9 03/14] mm/page_alloc: Fake unaccepted memory
On Mon, Apr 03, 2023 at 05:39:15PM +0300, Kirill A. Shutemov wrote:
> On Mon, Apr 03, 2023 at 03:39:53PM +0200, Vlastimil Babka wrote:
> > On 3/30/23 13:49, Kirill A. Shutemov wrote:
> > > For testing purposes, it is useful to fake unaccepted memory in the
> > > system. It helps to understand unaccepted memory overhead to the page
> > > allocator.
> >
> > Ack on being useful for testing, but the question is if we want to also
> > merge this patch into mainline as it is?
>
> I don't insist on getting it upstream, but it can be handy to debug
> related bugs in the future.
>
> > > The patch allows to treat memory above the specified physical memory
> > > address as unaccepted.
> > >
> > > The change only fakes unaccepted memory for page allocator. Memblock is
> > > not affected.
> > >
> > > It also assumes that arch-provided accept_memory() on already accepted
> > > memory is a nop.
> >
> > I guess to be in mainline it would have to at least gracefully handle the
> > case of accept_memory actually not being a nop, and running on a system with
> > actual unaccepted memory (probably by ignoring the parameter in such case).
> > Then also the parameter would have to be documented.
>
> As it is written now, accept_memory() is nop on system with real
> unaccepted memory if the memory is already accepted. Arch-specific code
> will check against own records to see if the memory needs accepting. If
> not, just return.
>
> And the option will not interfere with unaccepted memory declared by EFI
> memmap. It can extend it, but that's it.
>
> Looks safe to me.
>
> > Speaking of documented parameters, I found at least two that seem a more
> > generic variant of this (but I didn't look closely if that makes sense):
> >
> > efi_fake_mem= nn[KMG]@ss[KMG]:aa[,nn[KMG]@ss[KMG]:aa,..] [EFI; X86]
> > Add arbitrary attribute to specific memory range by
> > updating original EFI memory map.
As of now, efi_fake_mem= can adjust attributes of memory. Unaccepted is
type of memory, not an attribute. I guess we can allow it override type
too. But syntax is going to be fun.
> > memmap=<size>%<offset>-<oldtype>+<newtype>
> > [KNL,ACPI] Convert memory within the specified region
> > from <oldtype> to <newtype>. If "-<oldtype>" is left
It overrides E820 map, but unaccepted memory is not represented there.
Unaccepted memory is just RAM in E820.
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists