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 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 BCB80C4451C for ; Tue, 21 Jul 2026 17:09:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/eAumxzMklKt7KlxDDtQy7bkz7VKZym9Gf7t+LB3cbo=; b=e9kGMxoKFaREpsMkMgdxP0Gewn bsNwyW+5p9yqsrqgl8Dn8j+NN9FY3OnCFIY8Mza0NlJrmnC66aysmAplhSrSJ6WgfQSyIUjnWmaxu SA3Yqc1mPlXyZJpc7Aq8GKPId7w0lNZh/9lwMZmxslXFLqGRUK1gss8kCwxEKU6OXUcXrrS/xRtjF sAy8rgeEgRWdTJtaSp3Yz/qQD4g8Hr8JTuCB6btICDb0A6XDeiHP3V7I0vuY1dOAkkjw/HTalcSoh aOqvLD4G6Kszg/gueYhfmX+QO5m1muvgI31vckMZnCCLzDskT9lAJ2uLKOovCp84v2lsIoP32KU7F 7WwM9Zrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wmDwk-0000000A0TF-00O9; Tue, 21 Jul 2026 17:07:58 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wmDwi-0000000A0T7-3017 for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2026 17:07:56 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 7848F4179C; Tue, 21 Jul 2026 17:07:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0DDB1F000E9; Tue, 21 Jul 2026 17:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784653676; bh=/eAumxzMklKt7KlxDDtQy7bkz7VKZym9Gf7t+LB3cbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y1JsRoGqdh4q1f/UXtl0lxL00yaQQFwe0BMpt1WfxPbTPkmXFHCaley76+C/6+kb1 GdAgAg6yN3MJuIYso4TSf+iTy0BoRALcqGVrimk8xojwc7JeGkWFn8WX3LQJ7kr2Yw wEAdBESqi59tPXN7Sj1DnlePkWczus7lAraejaKo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Catalin Marinas , Will Deacon , Ryan Roberts , David Hildenbrand , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ben Hutchings , Anshuman Khandual , Sasha Levin Subject: [PATCH 7.1 1416/2077] arm64/mm: Optimize TLB flush in unmap_hotplug_[pmd|pud]_range() Date: Tue, 21 Jul 2026 17:18:09 +0200 Message-ID: <20260721152626.202569384@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anshuman Khandual [ Upstream commit ff4c5a0de1f2ef7737a8688a86e19301e567020d ] Commit 48478b9f7913 ("arm64/mm: Enable batched TLB flush in unmap_hotplug_range") inadvertently introduced redundant TLB invalidation when clearing a block entry, resulting in unnecessary broadcast invalidation on CPUs without support for range-based invalidation. Re-introduce the old behaviour, along with some expanded comments to help people working in this area next time around. Cc: Catalin Marinas Cc: Will Deacon Cc: Ryan Roberts Cc: David Hildenbrand Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reported-by: Ben Hutchings Closes: https://lore.kernel.org/all/b0d5836032ce3135bfc473f6bff791306d086925.camel@decadent.org.uk/ Fixes: 48478b9f7913 ("arm64/mm: Enable batched TLB flush in unmap_hotplug_range()") Signed-off-by: Anshuman Khandual Reviewed-by: David Hildenbrand (Arm) Reviewed-by: Catalin Marinas [will: Reword comments and commit message] Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/mm/mmu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 8242f93f05e4fc..fd756390fe925c 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -1509,7 +1509,13 @@ static void unmap_hotplug_pmd_range(pud_t *pudp, unsigned long addr, if (free_mapped) { /* CONT blocks are not supported in the vmemmap */ WARN_ON(pmd_cont(pmd)); - flush_tlb_kernel_range(addr, addr + PMD_SIZE); + /* + * Invalidating a block entry requires just + * a single overlapping TLB invalidation, + * so limit the range of the flush to a single + * page. + */ + flush_tlb_kernel_range(addr, addr + PAGE_SIZE); free_hotplug_page_range(pmd_page(pmd), PMD_SIZE, altmap); } @@ -1539,7 +1545,8 @@ static void unmap_hotplug_pud_range(p4d_t *p4dp, unsigned long addr, if (pud_leaf(pud)) { pud_clear(pudp); if (free_mapped) { - flush_tlb_kernel_range(addr, addr + PUD_SIZE); + /* See comment in unmap_hotplug_pmd_range(). */ + flush_tlb_kernel_range(addr, addr + PAGE_SIZE); free_hotplug_page_range(pud_page(pud), PUD_SIZE, altmap); } -- 2.53.0