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: Rick Edgecombe X-Patchwork-Id: 13145648 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 DE9B2C64ED8 for ; Sat, 18 Feb 2023 21:16:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60BDE280007; Sat, 18 Feb 2023 16:16:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 56D6E280004; Sat, 18 Feb 2023 16:16:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BFEE280007; Sat, 18 Feb 2023 16:16:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 20E49280004 for ; Sat, 18 Feb 2023 16:16:10 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E950A160498 for ; Sat, 18 Feb 2023 21:16:09 +0000 (UTC) X-FDA: 80481670458.10.63685D1 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf16.hostedemail.com (Postfix) with ESMTP id E52F5180007 for ; Sat, 18 Feb 2023 21:16:07 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="byzbw/l0"; spf=pass (imf16.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.43 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=1676754968; 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=YxW9MJRFAPgDiRmr9UkkwMi91Qa7hNQXFFYWjlAnpjc=; b=vth7OgsDftFI++2NQoqniVqrVahQLS4gGmmAYcvC0kvNzlPdTuyqTHG6uGbYs5tCiLBL0a JjF+Ltl/h5yyx3zBtP+HNoG6L31X4kyn3l2sTaOTQi74yAqWSz0ebSCzT6YpBR/cHkY8eq Y9tLIDhk2BOTeSrKBHCwMGQ/cv+hjFg= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="byzbw/l0"; spf=pass (imf16.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.43 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=1676754968; a=rsa-sha256; cv=none; b=Q9G1gimUdLTcUS+jZCOrlKol8r4695WQscoyfd+9Ds63IkCiTTWV/uLKGp+j7Pedk6GPYV b2Mzf24pAkosDZAV/JyDQ9RLP8ZsFGTPF7B+2H7tKTVv322h1n5aCYReNPIhqWoq/wxnEW rQ3rYTeCzJgxwlxxWp5jHyXuQK4guy4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676754968; x=1708290968; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=WNPU9K/uO1/sECVvbc1vvDXvcVrYVW+CWqRcIxYNITs=; b=byzbw/l0nDj40VMR6a0M73aj+1lj0+mmB5zVh1/D/eY3bchUkCEquLrh BxFq25CI14FclWsOEccBzCXra1HNU58UZgF84qam7uoR7/OtfsEiVr7sv 0Xi6jrk4OHrGWWmPtxjHBlCWAy1bcw5d+7bT+2Q8PPpnfVNKB+MmjZAIO ml4VJhNW0hK54G6yhxJCTAlJyBqpovoN85DZjhBg54VQcwfEzElm3eAac ow6x4pPIwxbUDrWlwSiiDI3esYSyWvgsZW1/InJ6BbPoFKjcvPbyZEdvI W2ihys6zxJUUsdEVf9dhsYou4kIAaVwUquWhtWcqAgf9vka4n8FTIb+Hw A==; X-IronPort-AV: E=McAfee;i="6500,9779,10625"; a="418427301" X-IronPort-AV: E=Sophos;i="5.97,309,1669104000"; d="scan'208";a="418427301" 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-Rspamd-Queue-Id: E52F5180007 X-Stat-Signature: e34ob4d9xg1mrpqdxrdkqyrwa18nffuy X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1676754967-774732 X-HE-Meta: U2FsdGVkX1/SkW3eY06MX7xic2crxOIggrKOTDzAlVkgVC32a8LKLws3jAQUsCh4aVAgOvgioloeISucnVycfGV+tHN6ZOne2lafzPJHkl3xfPI/7aQ+1A7hv4VnTFb2ADcz5d4M9cRZAVuSDEknD5PEPl9JDfyrb9IOujmRsZv5ATOu4L4jFzQ0Hj1wTDYwp7BML9VICoBqDeT8Ql8yZHZ+/+0XQWqwMKI90lAdpzM1nZEaazgAjgVl6twdAN/3FZryWiM2aFthVbe7UHuLcUWJxlnjgh/0z+TSvk86fwh9L0O4fSf4Wd1vbpQF2TFCvwnbfMmPFhOF7cuRHFjC8Yp8Pe1Oc32FOc8oOQa3x55I+jDz42o0BGyQfS+sD4QZ6dD0s5WB/NkIpx1rkIwajPfEwlX5WJrcHiMR5TJ150CddJgpapxNjupccDbaS6XZmoV/QSpJnL+nVKs3G1Ta0BJlm0tW6UcnEFp/LqiL0edPKf992qHYrdz3Wmx+4n+EsZtHMSrz4JZtE5LuSugKS0uMn7awob54+r6fw709dUIzJAtxzfiNZItDSeuooRJRqo0FQXIEaFHxMmkxvAZDbrbA776NGy8nHjmpwnfw3VxHTd4lPCUnj7YBCYy2bxFIm0JIFbx54G/ceQwKwL2Lgf51NR6c1xd2KDdc68LWuBvtPz+wQnyOwxCfH1UN4+V0lnc7p+yAX9ArGAoXilqKzVIbLit2tCoQ/uQPqdZshQBW96LBBwLLKog9lWRzXPM8vM3JWvlKVcBFpn6j70GnnVPA3WzGTi3QqTpnzCvHVGwNeML0bs2P7FL5VyjhHMg3/2q7i9ojJeURMRwu/WJ9yZ+/zHeexUNfbotbQesAM6saq5T4GanvDLEYzvxtK0M17nXYa1J1T0v2zcfwstxd7uBUP8I38f2q2kh1N2HjWg5lSgYSqc87pmymCdIASF8z1hW07UZoOXzwObKY0b8 +ZDlzB8L Yt8Vf6UI1IGuAVTp2M+YAHRX65skQHCD9Q4/siA4gwdh2iJnEzw7EKSVYe3n57K/k6117UJ/ibqfKli8ykLA+rFrA5bNS051Sy740J69Dq0A4ostWfpTDGTaSv9/yXRa0O+SFZZYSwe/t2Z34DNjj2zc+TayEBmWjLOoJS7aIqywSE0bdBK7/c/+iGQXawPBPq+mnLn4H1kJa/Ud0rXaDzNIw0iIRAo1IcAZRNxijzBchWF61zCi9N7rR30Bf1zmE1QisteFkDKpDh/4ze7kvQ7Spw49egp7sMGZccMwTb+d7TriCWka+aKrLam624gc1yj1dmJVmPdA+deI= 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_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,