From patchwork Mon Feb 27 22:29:26 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: 62161 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2682639wrd; Mon, 27 Feb 2023 14:34:26 -0800 (PST) X-Google-Smtp-Source: AK7set/1lyo5bPpE1dM2/N81MFuaBgi6nMSG3LuK7JBUZ2c+WlSaf9P5n/JZhTrzOY3WDjU0StQu X-Received: by 2002:a17:907:11d1:b0:8b1:304e:589e with SMTP id va17-20020a17090711d100b008b1304e589emr262458ejb.53.1677537266146; Mon, 27 Feb 2023 14:34:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677537266; cv=none; d=google.com; s=arc-20160816; b=zcALbo/8vf7vcJPZe0hw0p1RcWvQZj0NftNPh0fVt+NTjl6kzHkgnusdwcyJYZGYGG mYnaRqzPwHPlN+huqKgCUvlYpC0U/x9MPKXsPzR5qd7asNEzhDmBpGKPRaOQCvUr/W7n pZVUDZsCu35j6TrHdqUr3Mmh/A761nLZ+yU8Bv1bp+HMdza4Dg1CNmnNlDg6S0g9dfMA UKvyzNsBNiZ0zdDrejBwA5j7DPrRJTzdoAvUnEXv4+B34QTxTsjDkU8nTb3DJR2EIW5A fP+HNE++vMQvsJ1P0NE5J5uqFvjXpbTlBjwqZiQ7GymsSsuevOBJkfKXDaslNNXLS10q TiNw== 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=Ic4aJhbI+buGyHxHvTWd0ForjxPqTZwiqz8ffS9E0kM=; b=xrJqO+97W7PJI6cSinFlbIqIU1QT7iKil2y+YUUJGAVyGS0RfpbsPEYLlPOj2aXrJb hkhvXGht/O1NjNl23lnubUGbkYYszr7wmq/oNM9xi3gH8sHjsjK7NaXhFY+UPH111J2d bHyTc8GmsIkIcHhD8HwjTF97fGiJKNXIG3Ro3TzCKTWMgkuWQaCuo2hDYhTX6uDoUW9n sVTJ/whpeAPq4cl8nav/QQW64H2Gmt/ujP1iXVbipK9KJ6+E5LaWMvhRDRcDrbnNzj8i DcMkZW+5PBDDyxTZuM2T9YXUQpSUqb1DgpYXOj33UtX0v9k9Cbj4AV6iDkvFzcznK8H2 nnbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zf9iRryI; 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 ss4-20020a170907038400b008b176ccbf45si9653570ejb.621.2023.02.27.14.34.02; Mon, 27 Feb 2023 14:34:26 -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=Zf9iRryI; 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 S230264AbjB0WcY (ORCPT + 99 others); Mon, 27 Feb 2023 17:32:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjB0Wbp (ORCPT ); Mon, 27 Feb 2023 17:31:45 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65D82298FC; Mon, 27 Feb 2023 14:31:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677537095; x=1709073095; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=PJnxzPZePTV1h98WOAU1laXgjeyErhdpAXi/giQ17HE=; b=Zf9iRryIcAiVooo3vQ+jqSg1dtnEBsB1GbNhhK7zqEdVox1l/y4obcV4 ejMph7wmPKDmpUPUE9U/ck9k2vtK9jj3lIk4K1V+ygRVwjdHrl8ZCO2v4 /iBBru0D0/4M4V2vKOSePY6Gx8ZY/y/Bwo1PnBowOGHisbfn3Lf/00ufj 7oMpUSSoZ1FJYwDjwfrX1D5v+FS6l04eYnsTWX3AbgCLxtyWaA7/veIDg lJAUcUGlqXPARUYyNNB4BQ1ickRZzXhb7dYqQg+l5UKgHc63TgEy/9xgG 1ELcoQtpVV2plu8zIZwuFma1v6EG4f70v0UQkkQTmHZZmyAWw0ChJWcf/ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="313657224" X-IronPort-AV: E=Sophos;i="5.98,220,1673942400"; d="scan'208";a="313657224" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 14:31:15 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10634"; a="848024440" X-IronPort-AV: E=Sophos;i="5.98,220,1673942400"; d="scan'208";a="848024440" Received: from leonqu-mobl1.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.209.72.19]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 14:31:14 -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 v7 10/41] x86/mm: Move pmd_write(), pud_write() up in the file Date: Mon, 27 Feb 2023 14:29:26 -0800 Message-Id: <20230227222957.24501-11-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230227222957.24501-1-rick.p.edgecombe@intel.com> References: <20230227222957.24501-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_PASS,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?1759025316074577022?= X-GMAIL-MSGID: =?utf-8?q?1759025316074577022?= 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 Tested-by: Kees Cook Acked-by: Mike Rapoport (IBM) 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 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,