From patchwork Thu Jan 19 21:22:47 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: 45984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp555680wrn; Thu, 19 Jan 2023 13:34:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXs5Yvl4wzufzAZa0v6z9vtUTlIgKr9KxbLqXVl6uSg0rJ7KTzUl0m3h/jeMzLDXUC+jquYX X-Received: by 2002:a05:6a20:b282:b0:a3:a90f:5326 with SMTP id ei2-20020a056a20b28200b000a3a90f5326mr11511400pzb.61.1674164090761; Thu, 19 Jan 2023 13:34:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674164090; cv=none; d=google.com; s=arc-20160816; b=RXOak9Lga5uM22W4hJMDeQrqKtYB2LlEd3gLtWwnJXKjirHEjhytL/26kkrIadETK5 jXjXwOopRsvX8KRT9+TlJpPN8B50yCneJQB44LrdV3bCikrtEck00PdSOyDVy5MfokVM pEuCvdi5l/zcrjwRKshYXBijQ9POc9iJxKlN/Y86icwsrPvEU7Ra7Pk2LUGDYENjFWSa doTa2zYO3nHvEiJE7aMr/MUqfbTI2K7wlpndBJSiXAVe4T5UnjndA9mPbbT86sTEmwFq OlVvIg2v1MEOE+FZvbW2B2Bg5EmMWOXxTAWqmCoxF0EsR2ac6/5ESfhdNJiaJjoGfdg8 tY2w== 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=SLtGihyn/x9FzqL6Gl9syvqGmcYAMPQwgzBEC4XQqQQ=; b=zWMPIYhRFsDPrUX5QLSRI+RqdX87HUdBjuENAcWrFXlGqoX5optaTs8lQkNGWn6l40 RUjw6Kq/NYSDYWR03cckc31N97gdBE6u9Kmbdvt9fdv1YwImXm4P8RGDtOScUrQ3XNxa pWky0BDcWXJ03+7rNhBsNBxfvdYiTVZXLzd29ohVZJN0zgYd2r0BfQZPDO0yh41p9YgR SdDSzHPYP0kg0Pw2WqUlnh5fzPEQD2XG1m1UqE8wx0K2OF0cXysNyOAjFtCyB9CAdbBs NTvVukFlxjV+5ID9uXpQ8Jna0++EwJlwOxOVECWDYq+enIsDNRLnUxmfzyngoxmTX7jU vRzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OUOshJsK; 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 16-20020a631250000000b004c9b3574f66si11564216pgs.62.2023.01.19.13.34.34; Thu, 19 Jan 2023 13:34:50 -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=OUOshJsK; 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 S230310AbjASVdU (ORCPT + 99 others); Thu, 19 Jan 2023 16:33:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbjASVbO (ORCPT ); Thu, 19 Jan 2023 16:31:14 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C6D6A7934; Thu, 19 Jan 2023 13:25:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674163533; x=1705699533; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=tmt4cSd6A0kDS/7f4GwHJfynyFRJ89yUY8hbbxiN2tQ=; b=OUOshJsKRQlVruHXtVt5HbRVoMPr/ovawrjdFmalLu2IAWaByZXJMSbj jy+iAXt2ZYFsTC6yBbeAUU0lnW3IlUP4/T2KAF8sSau6BHGQhW7AE4Cop Md4ik5uSY4NZdKeKPqTA/k62UfSZar8G2Xc+kAAOXYF4WG5XA4hVSg9tK uk4LbCzlClfvfdz5t8oDQ5CgMCILTNH2zxbtUqn19MF3+YCI9JN+HF/pz n7lovzJVGKk2H/JP30cT0D0qz3mbjFoQhbgxru7qd9UzzsThTKhirRElG yG2qF+0hqy+8Fla+tHmL7pgua+d0HlrbFcI2CPJOFw6oy9ZX5UDwxYyiP w==; X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="323119364" X-IronPort-AV: E=Sophos;i="5.97,230,1669104000"; d="scan'208";a="323119364" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2023 13:23:39 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="989139027" X-IronPort-AV: E=Sophos;i="5.97,230,1669104000"; d="scan'208";a="989139027" Received: from hossain3-mobl.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.252.128.187]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2023 13:23:37 -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 Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu Subject: [PATCH v5 09/39] x86/mm: Move pmd_write(), pud_write() up in the file Date: Thu, 19 Jan 2023 13:22:47 -0800 Message-Id: <20230119212317.8324-10-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230119212317.8324-1-rick.p.edgecombe@intel.com> References: <20230119212317.8324-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?1755488285666034753?= X-GMAIL-MSGID: =?utf-8?q?1755488285666034753?= 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 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,