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: 13180138 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 AC5E8C7619A for ; Sun, 19 Mar 2023 00:16:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07349280008; Sat, 18 Mar 2023 20:16:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F416D280001; Sat, 18 Mar 2023 20:16:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1B3A280008; Sat, 18 Mar 2023 20:16:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B9EA6280001 for ; Sat, 18 Mar 2023 20:16:14 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6BA13A0D06 for ; Sun, 19 Mar 2023 00:16:14 +0000 (UTC) X-FDA: 80583730668.28.A1BE286 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf16.hostedemail.com (Postfix) with ESMTP id 5CD84180003 for ; Sun, 19 Mar 2023 00:16:12 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=gBekljT1; spf=pass (imf16.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.115 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=1679184972; a=rsa-sha256; cv=none; b=voHiw0KlZ5PVCFzzKfGfCSu7MPf2vqcYInHzF1MOJBcKSPx62UtupXRZCpz3MqafyyWCiv 0o+94kyHaeow7u9ORCIds4fN/Sbg+jl3RuFmf9D9L6WlSh3kXkC6t7BkSjafQsz81w4pAc cToJMsFWt392bNYZ5U8vVg97hJORraE= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=gBekljT1; spf=pass (imf16.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=rick.p.edgecombe@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679184972; 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=sRLLsxiM3hz9WKTUNGj41sd5fcP3AEYnmcR9FvvjXv8=; b=jknMp4bv9a9FOpApiiox/zyKRJM9Wfo8rW8eB9h7Y/JvdQmW87XDJ0elscUwjXIwGEIsa2 WSEyLfaGoWnS0VJ+Vz6kC+MvLEvOTJUO0c2k1B9A/h80kf9EGuc3uNY363szxeje5dg3kY /mBhgJSbiRhG9Ly6xgrkGIWtJx9GHG8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679184972; x=1710720972; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Vja8kjxFIpUKpFfGiffO7CqOO8r6G2hYmB0i6nbkB4w=; b=gBekljT1/CzDPKZxkPqipY7WIYhhWU7X4p7ZcScxOp7JOrnti06om6xy ZzFYBh0Liq9YFB81BO5Fwb7m6iQgoGEOVysKi0igWM5yXQ9jem8fB3j0M lTNelCv+cu6hL08ovxht2HdZw7YJPxkdnO4d8579vzqPTFqgJ9KaRKeP9 ZmGUe+uPcGSqZLipdSlzSpOiFkp0cg7KvEKWixxsqXogE5fRuu+JwLOtU aVW9MJRrtjoA6DixCVMGhsCGCecDxShpjyBHol1172grmTCED8IMDlHr7 sT2mL6d9AFGdhswu1JCm24uu94gO5EY94Yzrr77NqQMrf3r9HfgZ96P+V Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10653"; a="338490949" X-IronPort-AV: E=Sophos;i="5.98,272,1673942400"; d="scan'208";a="338490949" 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-Rspam-User: X-Rspamd-Queue-Id: 5CD84180003 X-Rspamd-Server: rspam01 X-Stat-Signature: xoip3qqga7rgez1fsagdb3i55einwiaj X-HE-Tag: 1679184972-446234 X-HE-Meta: U2FsdGVkX1+eJgdPLFSBMDNsbtYoWDP++9Ld1LQVXLUQwmrQhQUEt23IILTqGgzJIKGGDRqu87q2WRe6hcTBvfFDvyb4a20yUU8vtj6wC/W6HhVtS7S/xRuwvYhbOE0pgpS+xpVPQdb9selvoNkbqoPVTVtCxxtzz2HbOvqHHfei1bOZtInhQ3JDIM4ffUlf2We0w0OzOCDBXp41jrnw8dRFgxdVH5/8LleCMmRD9BKcnY/oN9oxagepCZWbsy3u+D3UJ5EXYFiE4tv/sfZ7CkfnvV768voGDjFWzYQ/3AjonPWkxcSd1rDJX93j4laJnSeG0AzyNT4k/iaaTERRC8pFqBt3ycYt7xpuxrKhZSQGBZ8LqW3bK5x4qb4qodKDlmvdj6yWvSr2TIwenQ6QI99U9C9SL0a8OrvmXk6O9xrdLW9qMZQ/h8sTdY7Z53jSwl2kNMLJfNzf/gYuJtRrZ/mQd9YUHX77L6RBxUn5hMpxXLHzcyPyabvDT141WnOq/+CK4TffU4svCHObrdjJXjXHOhx+y4KLXQIOCHvXlJfwzklhn2d2l5xa/iLKZpn+nLrGROW92i1m/ckR6Eb1bocsXHANFp8opVZ4P0+N8rqe0kE2f6EMmmk31S+0gv5gGeiowGdK8zjLfW0NZi833+7fKx5qQeQ+iWP4h1oshZzXI+yvDuTaNQrxvENEHNQpxCZwzzs8BSo0q7CwXk2rkMtX6yLvv2LteRH8E9clVvnBiU1GFLVjwHEXcHNAMDuJYmPaDV0v3+CuipkDTS2qJql6JWbgQrLI0avDBI1aSHUOwEbohsVZZNl22vieaapKRab9J2awgg8iLJZIMuUcDrdd8OFOjuL01PJYmz57z+ri8GTNmq8b3kZefX0bZxlAR6QUVJkeZ9NC4GambppnJon66Wot8SnB4f3KGfo5Lw6QZAVkbX9BuTD5Cy3ZxYS4HLiaxsMjvVvoGB8ispd MZjB44hT 9En1hTzWbizo8uiinysELefdNUyN4AU//J/+Hj07ZbnSRpt2+/8x90+qSRw+d8qIbx26hOdlHs9+9SuTVHnTZzCGxVY0mwHfeemWRlGmBkAyLGt23xquUvhMSyXWFKYrHQo0DY6TEv9Hq7vb1in5xvGbTxT+2fJj06YRnFJ/KheD5gs255kfN4p/JRitNNdnUp3FUEpVkF42qHKOLOGekk7wY9srO8HFDQwfuTPr9rPD4dWVX/il/dxnjDnrv4pjBbmjuyOz8VYUjNxxSOfOrE/Tt4MhNjpdEa40ossxPN3os5v2GXawq6/DMJUBVfx4TMKE3i2nqlGmjLd7hJZjJTtDAb+YLs0z2hErESNy0I5hZDjwWtMas9lWGF+Qtlk9dH8vgYnaz90E/jcw= 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: 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,