From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 References: <155925716254.3775979.16716824941364738117.stgit@dwillia2-desk3.amr.corp.intel.com> <155925718351.3775979.13546720620952434175.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: From: Dan Williams Date: Fri, 21 Jun 2019 13:06:38 -0700 Message-ID: Subject: Re: [PATCH v2 4/8] x86, efi: Reserve UEFI 2.8 Specific Purpose Memory for dax Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org To: Ard Biesheuvel Cc: Mike Rapoport , linux-efi , the arch/x86 maintainers , Borislav Petkov , Ingo Molnar , "H. Peter Anvin" , Darren Hart , Andy Shevchenko , Thomas Gleixner , kbuild test robot , Vishal L Verma , Linux-MM , Linux Kernel Mailing List , linux-nvdimm List-ID: On Sat, Jun 8, 2019 at 12:20 AM Ard Biesheuvel wrote: > > On Fri, 7 Jun 2019 at 19:34, Dan Williams wrote: > > > > On Fri, Jun 7, 2019 at 8:23 AM Dan Williams wrote: > > > > > > On Fri, Jun 7, 2019 at 5:29 AM Ard Biesheuvel wrote: > > [..] > > > > > #ifdef CONFIG_EFI_APPLICATION_RESERVED > > > > > static inline bool is_efi_application_reserved(efi_memory_desc_t *md) > > > > > { > > > > > return md->type == EFI_CONVENTIONAL_MEMORY > > > > > && (md->attribute & EFI_MEMORY_SP); > > > > > } > > > > > #else > > > > > static inline bool is_efi_application_reserved(efi_memory_desc_t *md) > > > > > { > > > > > return false; > > > > > } > > > > > #endif > > > > > > > > I think this policy decision should not live inside the EFI subsystem. > > > > EFI just gives you the memory map, and mangling that information > > > > depending on whether you think a certain memory attribute should be > > > > ignored is the job of the MM subsystem. > > > > > > The problem is that we don't have an mm subsystem at the time a > > > decision needs to be made. The reservation policy needs to be deployed > > > before even memblock has been initialized in order to keep kernel > > > allocations out of the reservation. I agree with the sentiment I just > > > don't see how to practically achieve an optional "System RAM" vs > > > "Application Reserved" routing decision without an early (before > > > e820__memblock_setup()) conditional branch. > > > > I can at least move it out of include/linux/efi.h and move it to > > arch/x86/include/asm/efi.h since it is an x86 specific policy decision > > / implementation for now. > > No, that doesn't make sense to me. If it must live in the EFI > subsystem, I'd prefer it to be in the core code, not in x86 specific > code, since there is nothing x86 specific about it. The decision on whether / if to take any action on this hint is implementation specific, so I argue it does not belong in the EFI core. The spec does not mandate any action as it's just a hint. Instead x86 is making a policy decision in how it translates it to the x86-specific E820 representation. So, I as I go to release v3 of this patch set I do not see an argument to move the is_efi_application_reserved() definition out of arch/x86/include/asm/efi.h it's 100% tied to the e820 translation. Now, if some other EFI supporting architecture wanted to follow the x86 policy we could move it it to a shared location, but that's something for a follow-on patch set.