From patchwork Fri Nov 4 22: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: 13032644 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 E1707C433FE for ; Fri, 4 Nov 2022 22:39:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B1D38E0001; Fri, 4 Nov 2022 18:39:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43C6E6B007E; Fri, 4 Nov 2022 18:39:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1563B6B0080; Fri, 4 Nov 2022 18:39:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D6A3F6B007D for ; Fri, 4 Nov 2022 18:39:32 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A4AB81602AC for ; Fri, 4 Nov 2022 22:39:32 +0000 (UTC) X-FDA: 80097227784.14.0F62E2C Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf22.hostedemail.com (Postfix) with ESMTP id 3816DC0002 for ; Fri, 4 Nov 2022 22:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667601572; x=1699137572; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=poplwKY6u8XD6c+b4FqOVfxOhvQPYQQiQgDKo7YigJ8=; b=ixXvDEVITJFONbkGEbwFLekz0+8eaG3bIWWN6COvdI4h1wttvhA3lbWM zY3rU8uwK3c/Lok+3BlggrN4XQ2M6xTrfP4lNwXGMNSCI/oQthMibeIjx sotHzOx3vNH9f6Cdr31FIZ3lBpQ5QiLtAluO+RSw1weK8JkhOX1NM/Fw0 0EW2PgtgZfTPkHJW/mqTkF2JniCZphmLDAWL2ewmQZWiBykNQuqvx+rxM mQ56NEdfuscvoJKQAKaBetqIeEYt5MIz6vABLFgXZ/z6/btvOaN/3EzSG nAH2U+IsW0gCgV4Zhh46PIPb9ek20+LWVL1iVabqSF/LFPhH/UaZmqMP9 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="289816279" X-IronPort-AV: E=Sophos;i="5.96,138,1665471600"; d="scan'208";a="289816279" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 15:39:30 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="668514015" X-IronPort-AV: E=Sophos;i="5.96,138,1665471600"; d="scan'208";a="668514015" Received: from adhjerms-mobl1.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.212.227.68]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 15:39:29 -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 , "Ravi V . Shankar" , 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 Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu Subject: [PATCH v3 09/37] x86/mm: Move pmd_write(), pud_write() up in the file Date: Fri, 4 Nov 2022 15:35:36 -0700 Message-Id: <20221104223604.29615-10-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221104223604.29615-1-rick.p.edgecombe@intel.com> References: <20221104223604.29615-1-rick.p.edgecombe@intel.com> ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=ixXvDEVI; spf=pass (imf22.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=rick.p.edgecombe@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667601572; a=rsa-sha256; cv=none; b=FSRMF8ukmllCyHXgACS5W44HjI3eraIzjelNQHRtgjt/tvFwMw1ZF7s09yUmyFgHJuvV5o IsyrhKp5xnK7hn74xtipbPHHQuXMe/4PrXkqcUEOGfAnt9Vi4sVFsHMI638qtaG9oBOo78 vPUp5LEOjjtYMBOAW7meKHrC3FO3JL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667601572; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=u+P+qa8kKTWg8AnGQCR7FIL5mFISVmI7FR/YQkztV68=; b=gv6ic74sEsI55MXGviqNuMdQSj1bdD2L6a9JPcOMqkFWGkkMympiFD12sngAsNcAFaO6sa BXpznELBa2OCIgidVtGJSIKMF4R/B9w1+y01TrSBTByUVyQ0bv8E1ipKaqkM1QxxfLbzKS 0QdHOVR8ksFRUZxakgUETbcZMCMLl7E= X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=ixXvDEVI; spf=pass (imf22.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=rick.p.edgecombe@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3816DC0002 X-Stat-Signature: aqp47t1pgweuz7nzh93yij7fptc9ur34 X-HE-Tag: 1667601571-944213 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: 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,