From patchwork Mon Jan 20 02:40:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rik van Riel X-Patchwork-Id: 13944708 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 C31F8C02188 for ; Mon, 20 Jan 2025 02:42:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29950280004; Sun, 19 Jan 2025 21:42:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 223EB280003; Sun, 19 Jan 2025 21:42:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09C8A280004; Sun, 19 Jan 2025 21:42:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E169C280003 for ; Sun, 19 Jan 2025 21:42:35 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9B8D5A263E for ; Mon, 20 Jan 2025 02:42:35 +0000 (UTC) X-FDA: 83026281870.29.8FFEC15 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf30.hostedemail.com (Postfix) with ESMTP id 256D080004 for ; Mon, 20 Jan 2025 02:42:33 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of riel@shelob.surriel.com designates 96.67.55.147 as permitted sender) smtp.mailfrom=riel@shelob.surriel.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737340954; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dHsoEyJZ5XLC7JY7dTW5E1So6h81yzYLCyPTrStsqgs=; b=wuTSMiurbs4tDMz/G7b5UrdGk7GJN8eQcmIMl/N9pS1HYO8o35zl9Av515T9osui+dJtg5 M/tVWPyfbi4FOv+bRV0OyIrlavPiDvpv9qZf4+X8oo4DHm+5bQ4upxSKC1PJZAcvI6BcOF f1KEKzMbFmEB64vzDg/IECyJP0NE1w0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of riel@shelob.surriel.com designates 96.67.55.147 as permitted sender) smtp.mailfrom=riel@shelob.surriel.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737340954; a=rsa-sha256; cv=none; b=m86U6ZVRl5gbThccPdZgn/3sLMYZddjqJ+efP8eNiaBsZVjbx/madPSw97kiAAKbUrmJml O/nytFos5jaiVkEF4Q5RfqAaNznY6eGQTqqoK7GDXIkLBez9LBy8Qbuoumuc6WF1VlrDom U4nez5n8/LOjX9SUBwvFmDsG4GxIPLg= Received: from fangorn.home.surriel.com ([10.0.13.7]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1tZhis-000000002w5-0lGF; Sun, 19 Jan 2025 21:41:06 -0500 From: Rik van Riel To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, bp@alien8.de, peterz@infradead.org, dave.hansen@linux.intel.com, zhengqi.arch@bytedance.com, nadav.amit@gmail.com, thomas.lendacky@amd.com, kernel-team@meta.com, linux-mm@kvack.org, akpm@linux-foundation.org, jannh@google.com, mhklinux@outlook.com, andrew.cooper3@citrix.com, Rik van Riel Subject: [PATCH v6 02/12] x86/mm: remove pv_ops.mmu.tlb_remove_table call Date: Sun, 19 Jan 2025 21:40:10 -0500 Message-ID: <20250120024104.1924753-3-riel@surriel.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250120024104.1924753-1-riel@surriel.com> References: <20250120024104.1924753-1-riel@surriel.com> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 256D080004 X-Stat-Signature: 7e1fpmmwafw1gygatijom8575ffywbyn X-Rspam-User: X-HE-Tag: 1737340953-280521 X-HE-Meta: U2FsdGVkX1/wOMhTTmqww0Jm70z5YFU+XDNcEmHBa2wP69w508hx0hqs/ecAiBe6LSDjPhQK9hVkvcSbqLqibNCq4Ekz853O/6XOLDfwzbxi6MnrsRrd5qN+IpMrRZJ8Nr3Q4yPvDLVXarbKrjRYmw9A1ZVnNiQuqRzNiIUFvy5kJj8WV47VCrzZ2zMWEKlTYmdm/R3qA2GvAS3xFCk9K4YExuoZMMromWkQBpd4NeUpMLUAMJoDmZ4BbKT6l8hkK37h7Q2D5xzinquzJhjCuxZJ2S7ZmTbNfdlxToPWj4SGSVuU4WxCE9tXyfp3vIdxQql/XfdiHRqLZMwi77THzL2X3P0eXDLA+eqxMD1LsJoWylSSomdaK9Dp/fei4AVwOW5y8xYA9SHYxFOOqHJysTJPyb0uUfAkBVBPdSFNXzNno9eoaDvo+XYAanO2qIvxry910LmkzOxVgBp6t6ou09s5VgxPaMmhd0jbAhdqVC6D63CYG12wYlo0Sn9m90nvrMd5iUBEKButqvoKgXY/4EOZsQZdzj4apafxmN0qKqidgY/AsfnA+LXTBHxqyjiLgSKw5GKmBpnV7VQj9P1i04yymKj8OktbOxzlAdLyZrCcnI25kc9tLuIKcVqzZOkaGwqOa7DcZgN2K9XVAtA9eHD+k71LlHen3lbt98vL4WbJkA/u6xIVrxvz9JCyBr/Xhgdym9XgwXv+yAfgioIAGMBgwBt9h7q+J8toIssROxrMGFtHRnzHoishQ5/tyWQ9C1CdHYGtSTRvmsmYiYaSotu4EbpMR5bLbn4/yzbpVFqMQFB+nnUX5y8CMZO/mjQCKF+EAHCRPVzj0K1soCJgIn9P5P9pCQ2muKMryNHO7OoouNgeiizoGR3Wsu4JrbZ8E0seoWNzYCjUF4RegudbG7vML8Z1HE95zWT2ebH+u9bgF5cUbYsmxiettSwQ4tOg9J6jPC90CtDXqGmtmYt S4h319il j/CN9fr4EVeza094lQAblR+soQl08NQCnXvpMMINW7hYV45I1bi79KoE8WBy3cXkLaovZTF/Hh2bBpqqiFBGVfKhgpGKl2Mt+pzkz1qwOkI9TTAAwbYFZ1nJOiPl1mRQCd5y4FVYMwKPrCEJEJO/xfThreSpXX4VV8AcYEOz68GrFPNJpUgSzVE4yTx2Z7HUz2Jzy73sGTgPpV+q2Dd3QhDG+Og0BaW3OksDdUdKuiTGIXGhC7uhFhx2/3yEdo5O0dEEGOKLhXwdDbUPH0YqLxRYVYqzo6JPLsiI1/uDPPTlyCHt4qtURacA6V4Bac57+8TStM4Nl3lMlgCaffDsZsCvi0sxPUJxOsVFd3BKlvDNcDkxL9y7ItZe26NP4/fFSqlx+RVZfRUcgM1KsEOriPFrzLwKapoqZakl64yZ2YWTwwEeGTTHqL6ne0zqGayp8ieimnnkU5qFogzE= 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: List-Subscribe: List-Unsubscribe: Every pv_ops.mmu.tlb_remove_table call ends up calling tlb_remove_table. Get rid of the indirection by simply calling tlb_remove_table directly, and not going through the paravirt function pointers. Signed-off-by: Rik van Riel Suggested-by: Qi Zheng --- arch/x86/hyperv/mmu.c | 1 - arch/x86/include/asm/paravirt.h | 5 ----- arch/x86/include/asm/paravirt_types.h | 2 -- arch/x86/kernel/kvm.c | 1 - arch/x86/kernel/paravirt.c | 1 - arch/x86/mm/pgtable.c | 16 ++++------------ arch/x86/xen/mmu_pv.c | 1 - 7 files changed, 4 insertions(+), 23 deletions(-) diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c index 1cc113200ff5..cbe6c71e17c1 100644 --- a/arch/x86/hyperv/mmu.c +++ b/arch/x86/hyperv/mmu.c @@ -240,5 +240,4 @@ void hyperv_setup_mmu_ops(void) pr_info("Using hypercall for remote TLB flush\n"); pv_ops.mmu.flush_tlb_multi = hyperv_flush_tlb_multi; - pv_ops.mmu.tlb_remove_table = tlb_remove_table; } diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index d4eb9e1d61b8..794ba3647c6c 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -91,11 +91,6 @@ static inline void __flush_tlb_multi(const struct cpumask *cpumask, PVOP_VCALL2(mmu.flush_tlb_multi, cpumask, info); } -static inline void paravirt_tlb_remove_table(struct mmu_gather *tlb, void *table) -{ - PVOP_VCALL2(mmu.tlb_remove_table, tlb, table); -} - static inline void paravirt_arch_exit_mmap(struct mm_struct *mm) { PVOP_VCALL1(mmu.exit_mmap, mm); diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 8d4fbe1be489..13405959e4db 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -136,8 +136,6 @@ struct pv_mmu_ops { void (*flush_tlb_multi)(const struct cpumask *cpus, const struct flush_tlb_info *info); - void (*tlb_remove_table)(struct mmu_gather *tlb, void *table); - /* Hook for intercepting the destruction of an mm_struct. */ void (*exit_mmap)(struct mm_struct *mm); void (*notify_page_enc_status_changed)(unsigned long pfn, int npages, bool enc); diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 7a422a6c5983..3be9b3342c67 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -838,7 +838,6 @@ static void __init kvm_guest_init(void) #ifdef CONFIG_SMP if (pv_tlb_flush_supported()) { pv_ops.mmu.flush_tlb_multi = kvm_flush_tlb_multi; - pv_ops.mmu.tlb_remove_table = tlb_remove_table; pr_info("KVM setup pv remote TLB flush\n"); } diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 2b78a6b466ed..c019771e0123 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c @@ -186,7 +186,6 @@ struct paravirt_patch_template pv_ops = { .mmu.flush_tlb_kernel = native_flush_tlb_global, .mmu.flush_tlb_one_user = native_flush_tlb_one_user, .mmu.flush_tlb_multi = native_flush_tlb_multi, - .mmu.tlb_remove_table = tlb_remove_table, .mmu.exit_mmap = paravirt_nop, .mmu.notify_page_enc_status_changed = paravirt_nop, diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 5745a354a241..3dc4af1f7868 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -18,14 +18,6 @@ EXPORT_SYMBOL(physical_mask); #define PGTABLE_HIGHMEM 0 #endif -#ifndef CONFIG_PARAVIRT -static inline -void paravirt_tlb_remove_table(struct mmu_gather *tlb, void *table) -{ - tlb_remove_page(tlb, table); -} -#endif - gfp_t __userpte_alloc_gfp = GFP_PGTABLE_USER | PGTABLE_HIGHMEM; pgtable_t pte_alloc_one(struct mm_struct *mm) @@ -54,7 +46,7 @@ void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) { pagetable_pte_dtor(page_ptdesc(pte)); paravirt_release_pte(page_to_pfn(pte)); - paravirt_tlb_remove_table(tlb, pte); + tlb_remove_table(tlb, pte); } #if CONFIG_PGTABLE_LEVELS > 2 @@ -70,7 +62,7 @@ void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) tlb->need_flush_all = 1; #endif pagetable_pmd_dtor(ptdesc); - paravirt_tlb_remove_table(tlb, ptdesc_page(ptdesc)); + tlb_remove_table(tlb, ptdesc_page(ptdesc)); } #if CONFIG_PGTABLE_LEVELS > 3 @@ -80,14 +72,14 @@ void ___pud_free_tlb(struct mmu_gather *tlb, pud_t *pud) pagetable_pud_dtor(ptdesc); paravirt_release_pud(__pa(pud) >> PAGE_SHIFT); - paravirt_tlb_remove_table(tlb, virt_to_page(pud)); + tlb_remove_table(tlb, virt_to_page(pud)); } #if CONFIG_PGTABLE_LEVELS > 4 void ___p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d) { paravirt_release_p4d(__pa(p4d) >> PAGE_SHIFT); - paravirt_tlb_remove_table(tlb, virt_to_page(p4d)); + tlb_remove_table(tlb, virt_to_page(p4d)); } #endif /* CONFIG_PGTABLE_LEVELS > 4 */ #endif /* CONFIG_PGTABLE_LEVELS > 3 */ diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index 55a4996d0c04..041e17282af0 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -2137,7 +2137,6 @@ static const typeof(pv_ops) xen_mmu_ops __initconst = { .flush_tlb_kernel = xen_flush_tlb, .flush_tlb_one_user = xen_flush_tlb_one_user, .flush_tlb_multi = xen_flush_tlb_multi, - .tlb_remove_table = tlb_remove_table, .pgd_alloc = xen_pgd_alloc, .pgd_free = xen_pgd_free,