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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DE59C433F5 for ; Fri, 22 Apr 2022 05:10:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B766F6B0072; Fri, 22 Apr 2022 01:10:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AFEB36B0073; Fri, 22 Apr 2022 01:10:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A0866B0074; Fri, 22 Apr 2022 01:10:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 8C7406B0072 for ; Fri, 22 Apr 2022 01:10:58 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5742024292 for ; Fri, 22 Apr 2022 05:10:58 +0000 (UTC) X-FDA: 79383340596.27.D4095C8 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf14.hostedemail.com (Postfix) with ESMTP id D74F9100017 for ; Fri, 22 Apr 2022 05:10:56 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B38E11570; Thu, 21 Apr 2022 22:10:56 -0700 (PDT) Received: from [10.163.40.48] (unknown [10.163.40.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AD00C3F5A1; Thu, 21 Apr 2022 22:10:47 -0700 (PDT) Message-ID: <905f22d6-0671-21b2-a341-bdc5ba02e59c@arm.com> Date: Fri, 22 Apr 2022 10:41:34 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH -next v5 2/5] mm: page_table_check: move pxx_user_accessible_page into x86 Content-Language: en-US To: Tong Tiangen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Pasha Tatashin , Andrew Morton , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Kefeng Wang , Guohanjun References: <20220421082042.1167967-1-tongtiangen@huawei.com> <20220421082042.1167967-3-tongtiangen@huawei.com> From: Anshuman Khandual In-Reply-To: <20220421082042.1167967-3-tongtiangen@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: D74F9100017 X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf14.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Stat-Signature: 9oqku131ubhs7eti9okuwr8zc18x8z7r X-HE-Tag: 1650604256-5022 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Similar to previous commits on the same file, the following subject line format, would have been preferred. mm/page_table_check: On 4/21/22 13:50, Tong Tiangen wrote: > From: Kefeng Wang > > The pxx_user_accessible_page() check the PTE bit, it's s/check/checks ^^^^ > architecture-specific code, move them into x86's pgtable.h The commit message should have been more clear, atleast complete in sentences. I dont want to be bike shedding here but this is definitely incomplete. These helpers are being moved out to make the page table check framework, platform independent. Hence the commit message should mention this. > > Signed-off-by: Kefeng Wang > Signed-off-by: Tong Tiangen > Acked-by: Pasha Tatashin > --- > arch/x86/include/asm/pgtable.h | 19 +++++++++++++++++++ > mm/page_table_check.c | 17 ----------------- > 2 files changed, 19 insertions(+), 17 deletions(-) > > diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h > index b7464f13e416..564abe42b0f7 100644 > --- a/arch/x86/include/asm/pgtable.h > +++ b/arch/x86/include/asm/pgtable.h > @@ -1447,6 +1447,25 @@ static inline bool arch_has_hw_pte_young(void) > return true; > } > > +#ifdef CONFIG_PAGE_TABLE_CHECK > +static inline bool pte_user_accessible_page(pte_t pte) > +{ > + return (pte_val(pte) & _PAGE_PRESENT) && (pte_val(pte) & _PAGE_USER); > +} > + > +static inline bool pmd_user_accessible_page(pmd_t pmd) > +{ > + return pmd_leaf(pmd) && (pmd_val(pmd) & _PAGE_PRESENT) && > + (pmd_val(pmd) & _PAGE_USER); > +} > + > +static inline bool pud_user_accessible_page(pud_t pud) > +{ > + return pud_leaf(pud) && (pud_val(pud) & _PAGE_PRESENT) && > + (pud_val(pud) & _PAGE_USER); A line break is not really required here (and above as well). As single complete line would still be within 100 characters. > +} > +#endif > + > #endif /* __ASSEMBLY__ */ > > #endif /* _ASM_X86_PGTABLE_H */ > diff --git a/mm/page_table_check.c b/mm/page_table_check.c > index eb0d0b71cdf6..3692bea2ea2c 100644 > --- a/mm/page_table_check.c > +++ b/mm/page_table_check.c > @@ -52,23 +52,6 @@ static struct page_table_check *get_page_table_check(struct page_ext *page_ext) > return (void *)(page_ext) + page_table_check_ops.offset; > } > > -static inline bool pte_user_accessible_page(pte_t pte) > -{ > - return (pte_val(pte) & _PAGE_PRESENT) && (pte_val(pte) & _PAGE_USER); > -} > - > -static inline bool pmd_user_accessible_page(pmd_t pmd) > -{ > - return pmd_leaf(pmd) && (pmd_val(pmd) & _PAGE_PRESENT) && > - (pmd_val(pmd) & _PAGE_USER); > -} > - > -static inline bool pud_user_accessible_page(pud_t pud) > -{ > - return pud_leaf(pud) && (pud_val(pud) & _PAGE_PRESENT) && > - (pud_val(pud) & _PAGE_USER); > -} > - > /* > * An enty is removed from the page table, decrement the counters for that page > * verify that it is of correct type and counters do not become negative. With above mentioned code cleanup and commit message changes in place. Reviewed-by: Anshuman Khandual