From patchwork Sat Feb 18 21:14:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgecombe, Rick P" X-Patchwork-Id: 58995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp554668wrn; Sat, 18 Feb 2023 13:19:11 -0800 (PST) X-Google-Smtp-Source: AK7set+Igep0U8LilZP7VjcLWjsRnpVX3cFKca1Vh2wjYMDAFud/Esdba1qdK2PQfXKTdHyw/emJ X-Received: by 2002:a17:902:ea0c:b0:199:33ff:918a with SMTP id s12-20020a170902ea0c00b0019933ff918amr240107plg.21.1676755151346; Sat, 18 Feb 2023 13:19:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676755151; cv=none; d=google.com; s=arc-20160816; b=MzILh/Xltm+JtKV2u7azEy/UCba2X38w0mI4Bfqb7f4CWEpRl+fmvNuzOWHn07FQMq cxTqUvMVBrFf4wy+KuoHzUpDbGxBvQl/MzVGZWfxGATnXotWiZ30DtoHHynNP1adXK8Y I6cjvT+EZi5kyZmMZNKMNxcEi0xdryRpYlIpWy9fQ9HBeCdxF/yqDtXSCrPu9m54BeB9 BlBDu/xWqfs1Rn1u360J/mIaG4VCDSfA/+jOd0M7nIdXggsMPe2sl9HyFuUeO7GQx7Jt OdmVrJklRpTg6n1wNdq7A9NvvAzhODu11YSR0jY/fY3saAg8rN1oqajVOuBLs1TCtseT 0QGQ== 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=YxW9MJRFAPgDiRmr9UkkwMi91Qa7hNQXFFYWjlAnpjc=; b=Qn+LtwNB4LVbsbo38IvTArmu5ITQZcBZpg3su6PUoR8tFMhPMjUcwu/JnqYGV0602q nxDxhH20eMiw+smtm0YzbRod9xlM9SCZWX4vn3DUtUkZ6ZSdSWKlBwAbRxelwWPnJF5C 39FAgN+S3v/Xp1eBmlW3zH4eJ1FZlO4LuqH187hAO9v/5YK9z/wp68UTn2qVhGi6J52Q V5qUkh4Tk6cU5KZnY/pxHu9avfNyYwlL2M8EWM8thC+Q6Cr2dFq4+0oGMvBBPyKbET3L eFOyOVX+YP7bcgxb+C71kZX2cVtHpvtpo7Eb6Ho5GUzimZW9x2BzG3zVSzk6HwvUO2oE ed8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Nomi6enK; 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 ja4-20020a170902efc400b00194bdcf1aafsi3609322plb.541.2023.02.18.13.18.58; Sat, 18 Feb 2023 13:19:11 -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=Nomi6enK; 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 S230021AbjBRVS3 (ORCPT + 99 others); Sat, 18 Feb 2023 16:18:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbjBRVRv (ORCPT ); Sat, 18 Feb 2023 16:17:51 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA571969F; Sat, 18 Feb 2023 13:16:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676754990; x=1708290990; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=WNPU9K/uO1/sECVvbc1vvDXvcVrYVW+CWqRcIxYNITs=; b=Nomi6enKejYQEdT7Zv0UvI7hTvo77sJeFVT7WffkPWfRwBMkZJmu7SDn 9Z5HGEga+lPuX35r12Wviie5Oi21wGvPR2aI3zHWknx/r4q2CHOKni9zP HGmsfUbQ08gKwAr0zLbvQJrtaSXSjJDbV9T87GCal9wu+l+d01LgS9zWf WcNaeOOvTJJaWFFkQEVvX0Z8A+QAL4qFCcK7XpffRCzMq8aQ/ZNEc/dnz B6uiL5QdUtPfgsSdRzBtiGqHORJulheRPcDr/azGcA2k8VBuLl0g5v/eC Nj3VeKZgHrn5EX0Al2g9++rixDoEtq+xMie0KW/vELqLh1L3nyAX2M9jz A==; X-IronPort-AV: E=McAfee;i="6500,9779,10625"; a="418427295" X-IronPort-AV: E=Sophos;i="5.97,309,1669104000"; d="scan'208";a="418427295" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2023 13:16:05 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10625"; a="664241617" X-IronPort-AV: E=Sophos;i="5.97,309,1669104000"; d="scan'208";a="664241617" Received: from adityava-mobl1.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.209.80.223]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2023 13:16:04 -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, david@redhat.com, debug@rivosinc.com Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu Subject: [PATCH v6 10/41] x86/mm: Move pmd_write(), pud_write() up in the file Date: Sat, 18 Feb 2023 13:14:02 -0800 Message-Id: <20230218211433.26859-11-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230218211433.26859-1-rick.p.edgecombe@intel.com> References: <20230218211433.26859-1-rick.p.edgecombe@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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?1758205209191717389?= X-GMAIL-MSGID: =?utf-8?q?1758205209191717389?= From: Yu-cheng Yu To prepare the introduction of _PAGE_SAVED_DIRTY, 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 0564edd24ffb..b39f16c0d507 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -160,6 +160,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; @@ -1120,12 +1132,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) @@ -1155,12 +1161,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,