From patchwork Mon May 6 15:51:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655679 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A08BC41513 for ; Mon, 6 May 2024 15:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2rd/QnH3UzZ1R4ga6tymW091eyFY98kTIuKNX3gZJ48=; b=DbagV9UxK+kwV7 D8l0YYh/VSG4RbYbiaumjgb/+9QGaHNWKZermJPzXKGfdP7lEYbj7tmW4JDXjVirkgLXNFHVku9xY BQ2XbV6p2ZnLm9kdXzWj9rOq5MBjx1Z0h3yo5JRmN9XXX7M9dGv3tjgQDQnqHm8m4sm3UeS2ocH0D MQDN/s8+yCehJlxvUHOkamHg2PLbFNscuAKRWr9sZnl98KH5HN+1xaVGNXYbroLBvge/gydo6g/lS yfNDK70XAMjQMnU6OYpzzSZefgfOsVFZDRoCAA6+YDfIlkzPbUomJj80ciWFe7nI/GfSghS9l1Nrp w9wlqYIrkOPJxSPv35og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dS-00000007w7R-48P9; Mon, 06 May 2024 15:52:14 +0000 Received: from out0-203.mail.aliyun.com ([140.205.0.203]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dP-00000007w0M-0wrl for linux-riscv@lists.infradead.org; Mon, 06 May 2024 15:52:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010725; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=TKTzSti+PtAcGWZfYR7jaBIBKKIAPqWETl5mtmtjZos=; b=ZRea5w/IcGC9MV1SBNc5shJxg3XjcjfsV3j23iuZoBu92uc4o3luafLH/qPNmryQLElSLPmMXGrmre09/bPi7ye2IulZfheZ0cEBKldrc+NuKCBmJzG2dNqPF65/3RayOKdpjv8iNi0LL5Il4mstavOfGXiA5y4g4WD4DEuA9HU= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047201;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTd3ClE_1715010722; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTd3ClE_1715010722) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:02 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 1/5] LoongArch: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:16 +0800 Message-Id: <20240506155120.83105-2-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_085211_755511_CB042CAE X-CRM114-Status: UNSURE ( 5.86 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Added update_mmu_tlb_range function, we can batch update tlb of an address range. Signed-off-by: Bang Li --- arch/loongarch/include/asm/pgtable.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h index af3acdf3481a..924b6b031f06 100644 --- a/arch/loongarch/include/asm/pgtable.h +++ b/arch/loongarch/include/asm/pgtable.h @@ -470,6 +470,10 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, #define __HAVE_ARCH_UPDATE_MMU_TLB #define update_mmu_tlb update_mmu_cache +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +#define update_mmu_tlb_range(vma, addr, ptep, nr) \ + update_mmu_cache_range(NULL, vma, addr, ptep, nr) + static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) { From patchwork Mon May 6 15:51:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655680 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CA5BC25B74 for ; Mon, 6 May 2024 15:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nIxB9CB++oW+iuDQYMSHUhgbtKDgoeOQ7aBg5NyBX6k=; b=CQPfUvVFggmEw3 jYN53Xz5c0Kj/ErIya5CZdhVxH9HAAuMk9bAHBKBEDWo8E8pH2Wsx/eXO00kjQV2RydkUWbJXfbF+ X9bEif4P3HQoqtqHq1NyavzDlfWTt237IQkD5qCAdm20LhCRPvTZPV4udw48yYdzZrjN9wzPE8++0 5cOqACuw2trwbw4fHUjC3DW064dFJOEkmyWJTwOsg4Byl6ev2Xv6heGD24Yev1vjNNgXUA28pw2Nm xpxrTYdE8L+NrQ3zZ3DUUrYespefreUF+Jan/s29Jet/qXqGVh33BNgx9brsHzKt+w4GsL8s6ZGsh fW5xIVoh2qycg/WAx7Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dX-00000007wA0-21QU; Mon, 06 May 2024 15:52:19 +0000 Received: from out0-204.mail.aliyun.com ([140.205.0.204]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dQ-00000007w2v-0YJE for linux-riscv@lists.infradead.org; Mon, 06 May 2024 15:52:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010728; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=pTrt2D6LnlSlcqnfLWOg4gAqNc+Zz7gJTsSV/QHl4Kk=; b=qrwawR+a3cBMcpvZ1Dvb/wjFWn3C9OgHO8NL2dgZIiRYzRvjgbPljVA/fXyyNZeSYYj39in8BvvKi8RteLT8J0SmeJFXu5PFHpdRuxX87UAwew5VaIs7jyy4lOHs2dianVaKna1y7kE6n479+f+vzrEkAcq1145W/4cHI2etHXs= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047199;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTcewE9_1715010723; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTcewE9_1715010723) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:04 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 2/5] mips: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:17 +0800 Message-Id: <20240506155120.83105-3-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_085212_460859_08A1D500 X-CRM114-Status: UNSURE ( 5.77 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Added update_mmu_tlb_range function, we can batch update tlb of an address range. Signed-off-by: Bang Li --- arch/mips/include/asm/pgtable.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index e27a4c83c548..9416c9b971e5 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -597,6 +597,10 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, #define __HAVE_ARCH_UPDATE_MMU_TLB #define update_mmu_tlb update_mmu_cache +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +#define update_mmu_tlb_range(vma, address, ptep, nr) \ + update_mmu_cache_range(NULL, vma, address, ptep, nr) + static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) { From patchwork Mon May 6 15:51:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655683 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E26FC10F16 for ; Mon, 6 May 2024 15:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KHrvUyvF7Wi/h1hnlPUjbNR8b6zNxOppBuFz1LUb4gQ=; b=V+cLNHqOFFK4n9 oL6DVbN7skB5dgONkwvbVdTAPDs8CyoE7vLprEVWaPYvT12yXWhXrAMGgok7qnhADSKy0aMePZMC7 TTawlROYV9OieQZR+1mjG27bMdOZq9EiACQ1qG2Kwvktgkx2aBMbEYk0u6n2CvkFVyL5G7dyPFS1W 0ocp7sZvU0y4ZFKRv/g7Sf2/UOlidH8/iND9vB3LruTzfa7sl4rqMRuNsCbZozpdNncrPzoPNX+hU 2TetxGnIuTKicADItZLqo4Xj4vJ2fAKi7fZm2wspBEQ3nU0Uye7r4fyfqjsGXbd0Ux+ycQz0YGJEG 91wwQK/Rh0e+j7HE61Yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dc-00000007wDp-2Cr5; Mon, 06 May 2024 15:52:24 +0000 Received: from out0-209.mail.aliyun.com ([140.205.0.209]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dR-00000007w3r-1A8X for linux-riscv@lists.infradead.org; Mon, 06 May 2024 15:52:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010730; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=V5hA+ZyI44gZD58G2AfJieyG2gwT3Fy83Cv7WPpLrX0=; b=eHjTCGVIJ5K2jtTKlEcHdBAFNFJJHPhjkH8z5FrhbtooFlLnm/IjPaYkW7UnDDyUaM7WUiyPZGEuNTeTV5UQu/TdQJjfQbMKe+hDLBbjJyiczXRW5YVCxDLBzmOuUxXIwMbBK3pVaq9tzTT0cBb1lSuUZMwhljaFihUIcKYz9D0= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047202;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTd3Clf_1715010725; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTd3Clf_1715010725) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:06 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 3/5] riscv: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:18 +0800 Message-Id: <20240506155120.83105-4-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_085213_678250_1C22E60E X-CRM114-Status: UNSURE ( 5.77 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Added update_mmu_tlb_range function, we can batch update tlb of an address range. Signed-off-by: Bang Li Reviewed-by: Alexandre Ghiti --- arch/riscv/include/asm/pgtable.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 661b2b4fe758..f784c6dd2c66 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -489,6 +489,10 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, #define __HAVE_ARCH_UPDATE_MMU_TLB #define update_mmu_tlb update_mmu_cache +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +#define update_mmu_tlb_range(vma, addr, ptep, nr) \ + update_mmu_cache_range(NULL, vma, addr, ptep, nr) + static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) { From patchwork Mon May 6 15:51:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655682 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A30FC25B4F for ; Mon, 6 May 2024 15:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mWn6NwDB1iJdv0UgODozgBEsDv5pflM6SuQdOZ1h5dU=; b=L9zt+m3ucuO7Ai t1TF8ZRPumuY9J3Uprpf74tuMnXAOHMtPFA1TTaNGAOQD5c43UXDH5ThZwPK+HgxqwUnilG8B4Ya6 Gx5xvdUxzoLxbdc+JcxEcD+sFZhNIKAD4U5kOma80MXLznZDEk1mhGCwLQyTDETFZBMxNy7yrfofa Wbe5gnbJ/OpEpPNAQzkBb20LKgZrGitEk0wSFERKuLHQXSu/Hi07JwlSkC3Z8sSOl9PYSn363HIig gtjxzXhrXY4oLUv9NkWF/mCqZAUUvW8B9EoteClZbVCJcV6scv35wb0EJDQzWB+bnli9N9qKZKuM0 lIRiOnvmRRkkIKG+jUjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dZ-00000007wB9-2dVz; Mon, 06 May 2024 15:52:21 +0000 Received: from out0-213.mail.aliyun.com ([140.205.0.213]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dQ-00000007w37-2H3x for linux-riscv@lists.infradead.org; Mon, 06 May 2024 15:52:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010729; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=fZLMp0zX1lVO/AMMqpo0KyiatSIXbG3CSPTawlIjnSU=; b=aStQqaZOohz35DRBGFMCkuopRx0Plzkaz7/qx/bdVjo8Z3vieMhz0bKgcYtSB3MSv42bZluAWutG9ZcN1lAHQXvu/dimpoYpg8FAaPm0hX56hBb0HlPKkx5ot72wKBB7NNSwt41xrpgKJOPIK+8l+pwoTe2eXDixpsbXlBzeH4U= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R331e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047192;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTcewEm_1715010727; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTcewEm_1715010727) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:08 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 4/5] xtensa: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:19 +0800 Message-Id: <20240506155120.83105-5-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_085212_879252_284970B9 X-CRM114-Status: UNSURE ( 6.09 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Added update_mmu_tlb_range function, we can batch update tlb of an address range. Signed-off-by: Bang Li --- arch/xtensa/include/asm/pgtable.h | 4 ++++ arch/xtensa/mm/tlb.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h index 9a7e5e57ee9a..57f97e7e06d0 100644 --- a/arch/xtensa/include/asm/pgtable.h +++ b/arch/xtensa/include/asm/pgtable.h @@ -414,6 +414,10 @@ void update_mmu_tlb(struct vm_area_struct *vma, unsigned long address, pte_t *ptep); #define __HAVE_ARCH_UPDATE_MMU_TLB +void update_mmu_tlb_range(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep, unsigned int nr); +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE + #endif /* !defined (__ASSEMBLY__) */ #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG diff --git a/arch/xtensa/mm/tlb.c b/arch/xtensa/mm/tlb.c index d8b60d6e50a8..05efba86b870 100644 --- a/arch/xtensa/mm/tlb.c +++ b/arch/xtensa/mm/tlb.c @@ -169,6 +169,12 @@ void update_mmu_tlb(struct vm_area_struct *vma, local_flush_tlb_page(vma, address); } +void update_mmu_tlb_range(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep, unsigned int nr) +{ + local_flush_tlb_range(vma, address, address + PAGE_SIZE * nr); +} + #ifdef CONFIG_DEBUG_TLB_SANITY static unsigned get_pte_for_vaddr(unsigned vaddr) From patchwork Mon May 6 15:51:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655684 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C922FC10F16 for ; Mon, 6 May 2024 15:52:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bvWK8C3bMA2FjgW23Jueaz7p2V/mBvYYroDQmRwJiIs=; b=yFCqFXcuCym35b vy3rfxSR+crkIF6zXt8JdInnPLWqhNetbYYGEJHiZ8GbTjoCTAAxEl8I4GviU3lTWX4Yt5cQPsg3O O9G/I13ipSJA95UKa8evbKeUuje2KKz6+ffpu2utOtQTBh0pAOdVjWekMDFh54um/IL9hJuM27aqC mgZ2gtVyX3Ghvfisyzb3TgH/lSGuj8a7K7xHZbLdbAaJbo5UT4KxtaFA99lv+s4Q1Y+g80Ho7HEww IFXsO+jJFzIk9X5jXENegti8fEa79VXkEod3iZBxjAX9Cv/TrDBvg49uprcrXSGRDDV4RIEmNZAIx 7v1K4b5z4dn92s8XyvPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dg-00000007wGe-2auW; Mon, 06 May 2024 15:52:28 +0000 Received: from out0-203.mail.aliyun.com ([140.205.0.203]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s40dV-00000007w7z-2j1I for linux-riscv@lists.infradead.org; Mon, 06 May 2024 15:52:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010735; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=ymFvshx88TI9/EMP30aaqBdjrnITBbXYS6oOftHtOBQ=; b=oXToSApPtEK9/1viMmKccAM5oIJpOu3dmjnJ1wrczceq4v1GYkc7XdifB0OOObrZSMHpe8AD+5Ug1rXTW9UFKqMf6r775GTXetIlCw500KFpZMrrFtasDTp/7zCDiwn40XtyIYn24T+Sj7TZB6eMiWbnCbIXrSLEiPiPjDuHd3Q= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047198;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTf7qIH_1715010729; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTf7qIH_1715010729) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:10 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 5/5] mm: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:20 +0800 Message-Id: <20240506155120.83105-6-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_085218_271933_08DE7807 X-CRM114-Status: GOOD ( 11.20 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org After the commit 19eaf44954df ("mm: thp: support allocation of anonymous multi-size THP"), it may need to batch update tlb of an address range through the update_mmu_tlb function. We can simplify this operation by adding the update_mmu_tlb_range function, which may also reduce the execution of some unnecessary code in some architectures. Signed-off-by: Bang Li --- include/linux/pgtable.h | 8 ++++++++ mm/memory.c | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 18019f037bae..869bfe6054f1 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -737,6 +737,14 @@ static inline void update_mmu_tlb(struct vm_area_struct *vma, #define __HAVE_ARCH_UPDATE_MMU_TLB #endif +#ifndef __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +static inline void update_mmu_tlb_range(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep, unsigned int nr) +{ +} +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +#endif + /* * Some architectures may be able to avoid expensive synchronization * primitives when modifications are made to PTE's which are already diff --git a/mm/memory.c b/mm/memory.c index eea6e4984eae..2d53e29cf76e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4421,7 +4421,6 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) vm_fault_t ret = 0; int nr_pages = 1; pte_t entry; - int i; /* File mapping without ->vm_ops ? */ if (vma->vm_flags & VM_SHARED) @@ -4491,8 +4490,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) update_mmu_tlb(vma, addr, vmf->pte); goto release; } else if (nr_pages > 1 && !pte_range_none(vmf->pte, nr_pages)) { - for (i = 0; i < nr_pages; i++) - update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pte + i); + update_mmu_tlb_range(vma, addr, vmf->pte, nr_pages); goto release; }