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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEE30C3F2D1 for ; Mon, 2 Mar 2020 18:47:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0B1821739 for ; Mon, 2 Mar 2020 18:47:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727511AbgCBSr0 (ORCPT ); Mon, 2 Mar 2020 13:47:26 -0500 Received: from ale.deltatee.com ([207.54.116.67]:56870 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbgCBSr0 (ORCPT ); Mon, 2 Mar 2020 13:47:26 -0500 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.92) (envelope-from ) id 1j8q54-0005pv-89; Mon, 02 Mar 2020 11:46:19 -0700 To: Dan Williams Cc: Linux Kernel Mailing List , Linux ARM , linux-ia64@vger.kernel.org, linuxppc-dev , linux-s390 , Linux-sh , platform-driver-x86@vger.kernel.org, Linux MM , Michal Hocko , David Hildenbrand , Andrew Morton , Christoph Hellwig , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Eric Badger , "H. Peter Anvin" , X86 ML References: <20200221182503.28317-1-logang@deltatee.com> <20200221182503.28317-5-logang@deltatee.com> From: Logan Gunthorpe Message-ID: <1be997b0-e17a-5d48-efad-a01d84d5e496@deltatee.com> Date: Mon, 2 Mar 2020 11:46:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: x86@kernel.org, hpa@zytor.com, ebadger@gigaio.com, peterz@infradead.org, luto@kernel.org, dave.hansen@linux.intel.com, bp@alien8.de, mingo@redhat.com, tglx@linutronix.de, benh@kernel.crashing.org, will@kernel.org, catalin.marinas@arm.com, hch@lst.de, akpm@linux-foundation.org, david@redhat.com, mhocko@kernel.org, linux-mm@kvack.org, platform-driver-x86@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-ia64@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dan.j.williams@intel.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v3 4/7] x86/mm: Introduce _set_memory_prot() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Logan Gunthorpe Subject: Re: [PATCH v3 4/7] x86/mm: Introduce _set_memory_prot() Date: Mon, 2 Mar 2020 11:46:13 -0700 Message-ID: <1be997b0-e17a-5d48-efad-a01d84d5e496@deltatee.com> References: <20200221182503.28317-1-logang@deltatee.com> <20200221182503.28317-5-logang@deltatee.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-CA Sender: linux-ia64-owner@vger.kernel.org To: Dan Williams Cc: Linux Kernel Mailing List , Linux ARM , linux-ia64@vger.kernel.org, linuxppc-dev , linux-s390 , Linux-sh , platform-driver-x86@vger.kernel.org, Linux MM , Michal Hocko , David Hildenbrand , Andrew Morton , Christoph Hellwig , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Andy List-Id: platform-driver-x86.vger.kernel.org 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45C0CC3F2D1 for ; Mon, 2 Mar 2020 18:49:24 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 031F72166E for ; Mon, 2 Mar 2020 18:49:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 031F72166E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=deltatee.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48WThL1qZ7zDqf1 for ; Tue, 3 Mar 2020 05:49:22 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=deltatee.com (client-ip=207.54.116.67; helo=ale.deltatee.com; envelope-from=logang@deltatee.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=deltatee.com Received: from ale.deltatee.com (ale.deltatee.com [207.54.116.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48WTdx6rg7zDqcw for ; Tue, 3 Mar 2020 05:47:16 +1100 (AEDT) Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.92) (envelope-from ) id 1j8q54-0005pv-89; Mon, 02 Mar 2020 11:46:19 -0700 To: Dan Williams References: <20200221182503.28317-1-logang@deltatee.com> <20200221182503.28317-5-logang@deltatee.com> From: Logan Gunthorpe Message-ID: <1be997b0-e17a-5d48-efad-a01d84d5e496@deltatee.com> Date: Mon, 2 Mar 2020 11:46:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: x86@kernel.org, hpa@zytor.com, ebadger@gigaio.com, peterz@infradead.org, luto@kernel.org, dave.hansen@linux.intel.com, bp@alien8.de, mingo@redhat.com, tglx@linutronix.de, benh@kernel.crashing.org, will@kernel.org, catalin.marinas@arm.com, hch@lst.de, akpm@linux-foundation.org, david@redhat.com, mhocko@kernel.org, linux-mm@kvack.org, platform-driver-x86@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-ia64@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dan.j.williams@intel.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v3 4/7] x86/mm: Introduce _set_memory_prot() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Michal Hocko , Linux ARM , Eric Badger , Linux Kernel Mailing List , Andrew Morton , linuxppc-dev Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B003C3F2CD for ; Mon, 2 Mar 2020 18:47:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E42972166E for ; Mon, 2 Mar 2020 18:47:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QCQQVdCu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E42972166E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=deltatee.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Dq1SFU3F+4UxVVVdvA+PANZxt1BHFrSqEHd++vnFx9A=; b=QCQQVdCu1FEPJ6 5chiSlkRS5RSRTs+SXZiItfx47b+66DZ/dC2yBU6bnzBgI+AWSGUJ5A1EDcqtc7sgdzumOIqG2+sG oAhNR7Ctb+9c73zcmAtcbl8DjtG8VGGmHfxB/zT6a+crEbXk7gOssnH9n6N/9URzl/JLb42vpLM3I lSWTCennSHlaV5H8AWFVhkUmFughjaNZrewBdFDwiSIVYC4M7/akTMZHtA1CW6H4HczzsxLfNMSm7 DQI5RWOu6QXIIEaX7T9wGpe8HmhWeQV0cONNJ0cbYvKzLOyeZh7vWfiaa+q+BOkHLRvH/7ZjmZ0+g 5V7EzFczvRfxnw2Wr7FQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j8q6A-0003pk-8H; Mon, 02 Mar 2020 18:47:26 +0000 Received: from ale.deltatee.com ([207.54.116.67]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j8q67-0003p2-0V for linux-arm-kernel@lists.infradead.org; Mon, 02 Mar 2020 18:47:24 +0000 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.92) (envelope-from ) id 1j8q54-0005pv-89; Mon, 02 Mar 2020 11:46:19 -0700 To: Dan Williams References: <20200221182503.28317-1-logang@deltatee.com> <20200221182503.28317-5-logang@deltatee.com> From: Logan Gunthorpe Message-ID: <1be997b0-e17a-5d48-efad-a01d84d5e496@deltatee.com> Date: Mon, 2 Mar 2020 11:46:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-CA X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: x86@kernel.org, hpa@zytor.com, ebadger@gigaio.com, peterz@infradead.org, luto@kernel.org, dave.hansen@linux.intel.com, bp@alien8.de, mingo@redhat.com, tglx@linutronix.de, benh@kernel.crashing.org, will@kernel.org, catalin.marinas@arm.com, hch@lst.de, akpm@linux-foundation.org, david@redhat.com, mhocko@kernel.org, linux-mm@kvack.org, platform-driver-x86@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-ia64@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dan.j.williams@intel.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v3 4/7] x86/mm: Introduce _set_memory_prot() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200302_104723_057178_D98DADA3 X-CRM114-Status: GOOD ( 18.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel