From patchwork Sun Mar 19 00:15:05 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: 71655 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp511331wrt; Sat, 18 Mar 2023 17:18:34 -0700 (PDT) X-Google-Smtp-Source: AK7set/YofQuTp1lIo8kFavKC1tcEYa3AMIPOMzbdAw+7GGiOzLuaCKWpKiwH2BVsEWCdIVbR3a3 X-Received: by 2002:a17:90b:1c85:b0:23d:1143:1e3c with SMTP id oo5-20020a17090b1c8500b0023d11431e3cmr13636879pjb.44.1679185114281; Sat, 18 Mar 2023 17:18:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679185114; cv=none; d=google.com; s=arc-20160816; b=FkEDujN7Y+t9Oeum5QmsamgkMrtfDCDeaACs2fX3izCSqF2/9Vl6/2rXZcb0s2iMWU jr7RzNZZSBfgf5TzddEKwL3/9fHI3zmNLzN68xanDOwt+YNAcezx5lPIEK2KjfvWeJPn v2/WpQSXlybh/5xXjlAx5nsitRC/NZG98c+F4pYOwSOxccjMwxzY117JtFheCtUNZ3am clY0J4ADOd5FsVgRqwl62H68sU2Bo7ALd7+c0qDX+FavoP1AKPWXAcwqpPvsbOthH7he KvXqPnNDIS1vMuE5JM6Y1RfluRxuNvYu0dHqfoLWX+QITCbfM3I4iuLanAoY+b0Cu43y idvg== 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=sRLLsxiM3hz9WKTUNGj41sd5fcP3AEYnmcR9FvvjXv8=; b=xnH0ICLykOfdsiNiC05MHgyFDjf95Cry9kA+FAORYYGQ3LyGX/kl9envL8iAPAHC+n X8TMtKdPAeVmitnL0nNqFlJWIRqu71fnyiMVq7soXGOcBHgLzVHsJTyKUTFdo3dEnSJV bXstKZcc4Q+bX8wi4HfdfwCwSBacp/kM6Yaz6i0ZQ1XFm6+d7FigUvgBZQ09pt/I7VjE fznRHJH8T6Z8bkrdvPvpdRVa24TBsjsy1noYawxHNi7CYv+njawx2HCV9iNDy02xX2Nl 79Wt9vd05ZGEN9OBWh3Ugk7lTzBNMIwT5H71yPjeBi/StkZscLithgM+JLzQZcNAKJ7Z RMKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RwYEX84C; 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 nv14-20020a17090b1b4e00b0023d1b2fb2d9si6894879pjb.165.2023.03.18.17.18.19; Sat, 18 Mar 2023 17:18:34 -0700 (PDT) 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=RwYEX84C; 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 S229878AbjCSARg (ORCPT + 99 others); Sat, 18 Mar 2023 20:17:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbjCSAQw (ORCPT ); Sat, 18 Mar 2023 20:16:52 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3855928E62; Sat, 18 Mar 2023 17:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679184973; x=1710720973; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Vja8kjxFIpUKpFfGiffO7CqOO8r6G2hYmB0i6nbkB4w=; b=RwYEX84ChaIWRDghDt+fDVKaSWBWMbigkMP2SpY1xgNOnUTTU2Nb6LD1 6cBpkGDIAMNiAaCliCGbvAEot17HbVyUMhM5+cm8dmUHhCBetC0mac266 KP9pZwHQqzUYreI6Oo8BYArzMCN2P7V1xRbuChAmrBzKtzQtqUdqNS+KF fZKim4euVPvwmHlGclOYzJmOCNyXlm6s0jqcFlwakRL6cmttzHaJYTARP QNO0m4Wt2pdvX85op/nYpWZheRvhjB+DL+sOn7kDN+kpdBRmx2oFSoGXD MJhLKSLJj7AOvUDZU2H0udhvDAMtlUdWKLwZKa1Rs/Y2UMzzVREmNAlWS w==; X-IronPort-AV: E=McAfee;i="6600,9927,10653"; a="338490937" X-IronPort-AV: E=Sophos;i="5.98,272,1673942400"; d="scan'208";a="338490937" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2023 17:16:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10653"; a="749672817" X-IronPort-AV: E=Sophos;i="5.98,272,1673942400"; d="scan'208";a="749672817" Received: from bmahatwo-mobl1.gar.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.135.34.5]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2023 17:16:10 -0700 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, szabolcs.nagy@arm.com Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu Subject: [PATCH v8 10/40] x86/mm: Move pmd_write(), pud_write() up in the file Date: Sat, 18 Mar 2023 17:15:05 -0700 Message-Id: <20230319001535.23210-11-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230319001535.23210-1-rick.p.edgecombe@intel.com> References: <20230319001535.23210-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?1760753210610587566?= X-GMAIL-MSGID: =?utf-8?q?1760753210610587566?= 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. Co-developed-by: Yu-cheng Yu Signed-off-by: Yu-cheng Yu Signed-off-by: Rick Edgecombe Reviewed-by: Kees Cook Reviewed-by: Kirill A. Shutemov Acked-by: Mike Rapoport (IBM) Tested-by: Pengfei Xu Tested-by: John Allen Tested-by: Kees Cook --- 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 7425f32e5293..56eea96502c6 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,