From mboxrd@z Thu Jan 1 00:00:00 1970 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 E9C39E77197 for ; Tue, 7 Jan 2025 09:58:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 455986B00AD; Tue, 7 Jan 2025 04:58:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 405596B00AE; Tue, 7 Jan 2025 04:58:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A62C6B00B4; Tue, 7 Jan 2025 04:58:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 08E586B00AD for ; Tue, 7 Jan 2025 04:58:12 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AB2EA160813 for ; Tue, 7 Jan 2025 09:58:11 +0000 (UTC) X-FDA: 82980205182.20.672084E Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf04.hostedemail.com (Postfix) with ESMTP id CE7AE40008 for ; Tue, 7 Jan 2025 09:58:09 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf04.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736243890; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zdmYeT6nirJQQeULEz/Mx26Ga9KASAi8ohiMId5QGl8=; b=Lh6KUmpwfHp12kQ2xhJU/4bUtH7HSIwN6RgiuC5c3T2y7443UD/L+MT01NQ0p7NhL4biFC nnlgvRuWV8bYMho9sAjuRtbGgZlS5O0ZFS0s3HL7uWdowwIqp50XI7PuPnV+Ngx0AusPLG JBCLn6UFbqCk8iDep7bv/zxSUFxnpWs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736243890; a=rsa-sha256; cv=none; b=PVwdS5qJ9IW07tZkVIDRo2M0VqJv8yXdqf57IO44Up1BK7GxXB+1TOYSwlipyQGdSxV5sM WacGqU5gcma1dGWYYbj+v0N0h9bVyWYoDV3G3GZwd1sdrRYG+DAi0MVisdXHIfoYEw8jF3 8gOaBJCep0VhM8e1bJCh3WXDm91AseI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf04.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3D1D0143D; Tue, 7 Jan 2025 01:58:37 -0800 (PST) Received: from [10.44.160.93] (e126510-lin.lund.arm.com [10.44.160.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 46B0F3F673; Tue, 7 Jan 2025 01:58:01 -0800 (PST) Message-ID: Date: Tue, 7 Jan 2025 10:57:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 10/15] riscv: pgtable: move pagetable_dtor() to __tlb_remove_table() To: Qi Zheng Cc: agordeev@linux.ibm.com, palmer@dabbelt.com, tglx@linutronix.de, david@redhat.com, jannh@google.com, hughd@google.com, yuzhao@google.com, willy@infradead.org, muchun.song@linux.dev, vbabka@kernel.org, lorenzo.stoakes@oracle.com, rientjes@google.com, vishal.moola@gmail.com, arnd@arndb.de, will@kernel.org, aneesh.kumar@kernel.org, npiggin@gmail.com, dave.hansen@linux.intel.com, rppt@kernel.org, ryan.roberts@arm.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, peterz@infradead.org, akpm@linux-foundation.org References: <0e8f0b3835c15e99145e0006ac1020ae45a2b166.1735549103.git.zhengqi.arch@bytedance.com> <1b09335c-f0b6-4ccb-9800-5fb22f7e8083@arm.com> <7e2c26c8-f5df-4833-a93f-3409b00b58fd@arm.com> <31e1a033-00a7-4953-81e7-0caedd0227a9@bytedance.com> Content-Language: en-GB From: Kevin Brodsky In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CE7AE40008 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: 1hbedsbi43enrs7wfwfmk5hr7m7w5m49 X-HE-Tag: 1736243889-165447 X-HE-Meta: U2FsdGVkX18j5knUSh3JQhfChPyIi7QoKhho5PPVpEDTT3prDO3BlJzYZx9h/39GisNRd7V3NVLb7TbYd6pu5stOjILLait38fLH9VV9fkiK8+eKSfoTzpR642Do7GQipEoCyZwkiEbi3MuDLVIh5VDVl71S8f+Gs4+z+UL3Fo+Hn55uZG6rZ0Fct5WUm9TAKztKonhhHRsJLmdOwmYftWJO8NU4jODeD4rXv9IbOvYWZIBrw78w/V/mLjxkGKpy/Q5cOF4gj1OBe+4S6TSY1nXNnVEP7G+DdOi2Bj7j8pOACghd1X4VYwtQ3fKBjpvy/sPhKj9oywhYpQREZwHBqDY5DWRWjvVzh8g9FXNqSd4jdRzGm1dE21niwoj/mb0ReJ8gtJYbho0Ygwrp/DtPHxufI4y0HMGeWjT5+6GjqzEO50ThuTchBpNWxXrxGzEXlmAe6OQuCyTs0sDjUOxyNjzqtQdaqU82W75y1AsTEUulsLlJ+6+TLFA9vbWtkA2YFJmZYAIFKYNauCD5hMEjD9M/SgXNG6BZvzNA5B+BOsjnYPLPvo0ztMyMKj1biLBRcV0eYEQC7SacSR5MKS5/T2IjhvdVBAFufS+vSp4F5FBTjK1psQOkMUuiEMV8i9eKkNfatnx2z9BQ1+MA6q9b59rUaZ4kXKrSvQbGM2tx2GG//UbcI+DW28hW7aJWzMWLvV8mf556k6Etd5mMN/C6LJ84PCRf/LjZ01hjgveVS6IjbptrZ1Nacd6hBB1ctMzO4QJ7J0RHjrPmr2MgcwDRbEPlQrgTjEX5VPqycNKL5aCBZ8t/Ca8XiGy0La7HYqMYqO4qgC13mDjRdkuNn1hstjTqtNpnr2wo4T17fEe/b6MODgj5St/DQR1rVy7axheEhvM6RLx6BwvnDlmHXXYd/EYqxoz5m8V4FgFWsdTmI5ia8gMJtKAmDD8JfhraxZDay1Xn4k3xFP0hpvmA4sO zhsh1eUS B2xbwwaqSzlEX7JTPk6I8grrh+Gdgd2Vau2NDQIWj0IowQ+k3ZmzYzHmm9kXAPoc/68tcVMaEEgvDCUPJySrHq64ws7FDgC/o0nzLdyVNBUzu8oWUuYEvZEbhEE0T7jCYxm7wZQrO7SWdPND5rlugCfSBHOgTn8YNMBTP/XokoniL3CgsOpv4CVB8QPwCYSD8OxTfMLdvtOQhLxRAig4Z/4Sy7td3qaULGCOc2pKLJZq0aFt/Ksuzl7GKgnydeP4KPDlALnAwQnHLMChQFR5OdMBBknmtqk8FS2G3 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: On 06/01/2025 04:49, Qi Zheng wrote: > [...] > >> Once this is done, we should be able to replace all those confusing >> calls to tlb_remove_page() on PTPs with tlb_remove_table() and remove >> the explicit call to pagetable_dtor(). AIUI this is essentially what >> Peter suggested on v3 [2]. > > Since this patch series is mainly for bug fix, I think that these things > can be done in separate patch series later. Sure that's fair. > >> >> [...] >> >>> Or can we just not let tlb_remove_table() fall back to >>> tlb_remove_page()? Like the following: >>> >>> diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h >>> index a59205863f431..354ffaa4bd120 100644 >>> --- a/include/asm-generic/tlb.h >>> +++ b/include/asm-generic/tlb.h >>> @@ -195,8 +195,6 @@ >>>    *  various ptep_get_and_clear() functions. >>>    */ >>> >>> -#ifdef CONFIG_MMU_GATHER_TABLE_FREE >>> - >>>   struct mmu_table_batch { >>>   #ifdef CONFIG_MMU_GATHER_RCU_TABLE_FREE >>>          struct rcu_head         rcu; >>> @@ -219,16 +217,6 @@ static inline void __tlb_remove_table(void *table) >>> >>>   extern void tlb_remove_table(struct mmu_gather *tlb, void *table); >>> >>> -#else /* !CONFIG_MMU_GATHER_HAVE_TABLE_FREE */ >>> - >>> -/* >>> - * Without MMU_GATHER_TABLE_FREE the architecture is assumed to have >>> page based >>> - * page directories and we can use the normal page batching to free >>> them. >>> - */ >>> -#define tlb_remove_table(tlb, page) tlb_remove_page((tlb), (page)) >> >> We still need a different implementation of tlb_remove_table() in this >> case. We could define it inline here: >> >> static inline void tlb_remove_table(struct mmu_gather *tlb, void *table) >> { >>      struct page *page = table; >> >>      pagetable_dtor(page_ptdesc(page)); >>      tlb_remove_page(page); >> } > > Right. As I said above, will add this to the updated patch #8. I think it would be preferable to make it a standalone patch, because this is a change to generic code that could in principle impact other arch's too. - Kevin