From patchwork Sat Dec 3 00:35:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgecombe, Rick P" X-Patchwork-Id: 29164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1142040wrr; Fri, 2 Dec 2022 16:39:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+di5VQtNsXe7/0MKjr927SdwArg/3FJtWKWeK36wPdkh+oBKSD/skIMRlzPxsRv44gtci X-Received: by 2002:a17:906:9709:b0:7c0:cb51:887c with SMTP id k9-20020a170906970900b007c0cb51887cmr3336591ejx.620.1670027963826; Fri, 02 Dec 2022 16:39:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670027963; cv=none; d=google.com; s=arc-20160816; b=YFFGr6t+csqN5BiMGpcelTomiA4WZi7/y1D0bssc/ovT4Xzund5+VyOWlncnYPr86A 6FCM+9JY+D7v5/6Jo2ph2zT7VVJd3CSm6rujFJTqzLlvnyG5jjG25KPSjl0l3OFeboYF hFQrnRmZRZxKnMu3rEuU7ein2HDWU0BzNxx7qavpbpFPzQ9RSFAUPrmhoRsndtFuxZuc /8D0Jb4XlB5eL14YDp0PlAlGI0NIZr79RAvf+ZdurdK3RtoCRB++fn1Z/9qmA8nkLLj8 Ku+ZRghKTEUEq7pNkNvpfSaebmrFjpINuq2YFv3/Cvl8ZiRHj+X7B3Vxd20XgkGOacmA oJUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=u+P+qa8kKTWg8AnGQCR7FIL5mFISVmI7FR/YQkztV68=; b=bNAO2WxJxdBzrT62Vn1DZbMjkeVZtJQvabWQ6W48zPUfPXPZTg5K9+ROhRMAoDrjWT 3sEkZ5Sk2og8LkM1PW2jQh2UHGvnrnSHkQ9WIPFDHLj7mhhsio2wpfa+fJrpP/z/woCb K7Q4FWv/0m2akKJeH4c+JQ20DtLBNdIY89O26OeMXEKOPTbMEDfBN5bDVjhh6nqxDDS/ O8ZWprUC82wKGASOo3nizkhIMIPYxLxp8ouLmLd9pK1HSKA2dBDUxhGgI29ZernmTlSt aXk2Z7DTSwjctg3MoWdY5S3uW546oIBOTvALc5ZbJ6b2K/wXFTJjmI6gxPKYbY6i6WFG Hsvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nXqy4FL9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu9-20020a170906eec900b007adfe2889efsi7339141ejb.607.2022.12.02.16.39.01; Fri, 02 Dec 2022 16:39:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nXqy4FL9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235126AbiLCAiE (ORCPT + 99 others); Fri, 2 Dec 2022 19:38:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235069AbiLCAhi (ORCPT ); Fri, 2 Dec 2022 19:37:38 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34770F818F; Fri, 2 Dec 2022 16:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670027811; x=1701563811; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=poplwKY6u8XD6c+b4FqOVfxOhvQPYQQiQgDKo7YigJ8=; b=nXqy4FL9uFIiuks9mHK4vdJkdO8HkTSJleHylvaWSIDztZFjD8vZR2C7 Vw6saoIxFpSYn2VLCiUbuDaB5PeWcgVnQO+20MhsPhgtcBJ6edJ5RD4oE iADmByIYfPCCVSfL9Vg7TQrLeo3Dx3OzUrNSOX4Fnyk+ncX+mC3zLqtvE t31McvDqWWFRhHaBW8HcYsrT4GpESMuHJSGDz5leTuA9HRmqKnUJPOSyt wyroZmhGa7Hul+D0ep83V18Uepq/+P6T1UXsNXyQtokPy9qzvcTMsHEIx qjAzfk0nM9XswWru2HPQrM6XMI0X/eevp/Mc6fUEs++grgdq5+QrjpDYB g==; X-IronPort-AV: E=McAfee;i="6500,9779,10549"; a="313710851" X-IronPort-AV: E=Sophos;i="5.96,213,1665471600"; d="scan'208";a="313710851" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 16:36:50 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10549"; a="787479798" X-IronPort-AV: E=Sophos;i="5.96,213,1665471600"; d="scan'208";a="787479798" Received: from bgordon1-mobl1.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.212.211.211]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 16:36:48 -0800 From: Rick Edgecombe To: x86@kernel.org, "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H . J . Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , Weijiang Yang , "Kirill A . Shutemov" , John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, akpm@linux-foundation.org, Andrew.Cooper3@citrix.com, christina.schimpe@intel.com Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu Subject: [PATCH v4 09/39] x86/mm: Move pmd_write(), pud_write() up in the file Date: Fri, 2 Dec 2022 16:35:36 -0800 Message-Id: <20221203003606.6838-10-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221203003606.6838-1-rick.p.edgecombe@intel.com> References: <20221203003606.6838-1-rick.p.edgecombe@intel.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751151242091680838?= X-GMAIL-MSGID: =?utf-8?q?1751151242091680838?= From: Yu-cheng Yu To prepare the introduction of _PAGE_COW, move pmd_write() and pud_write() up in the file, so that they can be used by other helpers below. No functional changes. Tested-by: Pengfei Xu Tested-by: John Allen Reviewed-by: Kees Cook Signed-off-by: Yu-cheng Yu Reviewed-by: Kirill A. Shutemov Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/pgtable.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 5059799bebe3..a1d6f121ee35 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -159,6 +159,18 @@ static inline int pte_write(pte_t pte) return pte_flags(pte) & _PAGE_RW; } +#define pmd_write pmd_write +static inline int pmd_write(pmd_t pmd) +{ + return pmd_flags(pmd) & _PAGE_RW; +} + +#define pud_write pud_write +static inline int pud_write(pud_t pud) +{ + return pud_flags(pud) & _PAGE_RW; +} + static inline int pte_huge(pte_t pte) { return pte_flags(pte) & _PAGE_PSE; @@ -1103,12 +1115,6 @@ extern int pmdp_clear_flush_young(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp); -#define pmd_write pmd_write -static inline int pmd_write(pmd_t pmd) -{ - return pmd_flags(pmd) & _PAGE_RW; -} - #define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp) @@ -1138,12 +1144,6 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, clear_bit(_PAGE_BIT_RW, (unsigned long *)pmdp); } -#define pud_write pud_write -static inline int pud_write(pud_t pud) -{ - return pud_flags(pud) & _PAGE_RW; -} - #ifndef pmdp_establish #define pmdp_establish pmdp_establish static inline pmd_t pmdp_establish(struct vm_area_struct *vma,