From mboxrd@z Thu Jan 1 00:00:00 1970 From: Logan Gunthorpe Date: Mon, 02 Mar 2020 18:46:13 +0000 Subject: Re: [PATCH v3 4/7] x86/mm: Introduce _set_memory_prot() Message-Id: <1be997b0-e17a-5d48-efad-a01d84d5e496@deltatee.com> List-Id: References: <20200221182503.28317-1-logang@deltatee.com> <20200221182503.28317-5-logang@deltatee.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Williams Cc: X86 ML , linux-ia64@vger.kernel.org, Linux-sh , Peter Zijlstra , Catalin Marinas , Dave Hansen , platform-driver-x86@vger.kernel.org, Linux MM , "H. Peter Anvin" , Will Deacon , Christoph Hellwig , linux-s390 , David Hildenbrand , Ingo Molnar , Benjamin Herrenschmidt , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Michal Hocko , Linux ARM , Eric Badger , Linux Kernel Mailing List , Andrew Morton , linuxppc-dev On 2020-02-29 3:33 p.m., Dan Williams wrote: > On Fri, Feb 21, 2020 at 10:25 AM Logan Gunthorpe wrote: >> >> For use in the 32bit arch_add_memory() to set the pgprot type of the >> memory to add. >> >> Cc: Thomas Gleixner >> Cc: Ingo Molnar >> Cc: Borislav Petkov >> Cc: "H. Peter Anvin" >> Cc: x86@kernel.org >> Cc: Dave Hansen >> Cc: Andy Lutomirski >> Cc: Peter Zijlstra >> Signed-off-by: Logan Gunthorpe >> --- >> arch/x86/include/asm/set_memory.h | 1 + >> arch/x86/mm/pat/set_memory.c | 7 +++++++ >> 2 files changed, 8 insertions(+) >> >> diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h >> index 64c3dce374e5..0aca959cf9a4 100644 >> --- a/arch/x86/include/asm/set_memory.h >> +++ b/arch/x86/include/asm/set_memory.h >> @@ -34,6 +34,7 @@ >> * The caller is required to take care of these. >> */ >> >> +int _set_memory_prot(unsigned long addr, int numpages, pgprot_t prot); > > I wonder if this should be separated from the naming convention of the > other routines because this is only an internal helper for code paths > where the prot was established by an upper layer. For example, I > expect that the kernel does not want new usages to make the mistake of > calling: > > _set_memory_prot(..., pgprot_writecombine(pgprot)) > > ...instead of > > _set_memory_wc() > > I'm thinking just a double underscore rename (__set_memory_prot) and a > kerneldoc comment for that pointing people to use the direct > _set_memory_ helpers. Thanks! Will do. Note, though, that even _set_memory_wc() is an internal x86-specific function. But the extra comment and underscore still make sense. > With that you can add: > > Reviewed-by: Dan Williams >