From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C42F74908D9 for ; Sat, 10 Oct 2026 14:26:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791642363; cv=none; b=kJBK0iiSeNFKlQ9xwDtq6O8lkwLnbWW2ZhUZ6MITdy0lZpg+camiUQDR1NbKIdG2uJ+PHiue4vhganoOCRrtPuOj2WVuRV/P8iLizfkiMO2KIS8rGe3CREgUTVA6j3K8oWL5cJLTHdKyJia8JuiOcDytgiD3liiR3vWEaXqO630= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791642363; c=relaxed/simple; bh=mw0uQktkLnEmrtN0ERsFxWHjWYRwLcVyb7ARzOK5ubE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jzAVDvJW4GUGm9ZSBGWJEbx9da9Yt/O7U5x2LKlEGE9NrR+HU0FQ3VPJmg4269LNiobK2yXUcmoYJDwrlJ6Na074uxF+vX0PhS/HixBlxFnxETYRqSpMUhwLbJywAA6ybHXvmdodbqeT6IBlMxBAsRRIYS1pMQPI4tdcU0VzDWQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CSAWu7TE; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CSAWu7TE" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-6afe8d3980aso758642a12.1 for ; Sat, 10 Oct 2026 07:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791642360; x=1792247160; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=b88sjkJ/RqBf+LyWYx8z8VDQ3/sowwhU6O/+Md+JWNs=; b=CSAWu7TEoIKwzGgU1AlAAj1YqP1UrzMzHpodzbIzfOmm4quml4b0d4S3gIVbI1X92n A6zE93ssYVRqr8ALcTL5yIRnthLHUsweAZ7vuaZKBWei3Id0C1qYZNixW4wKuuWxZjGx 794DbKVvw4P9r948UX2vYW1nPdx2+t7jDc+orj4PaUMt/RRl2JjgTJKHsNwtA2bSK31K j+E0UqT9y20plkNPyjnvTVRWGD6bjHDr//hs/eQqg5I7qiKg1Q+IpqZtBl5avTci6cY9 v2pV7PN7aTK7rKHhMl8m/w0WScjjCmBp7hBZGLJIRdEMTJEHSDHXn9R9A6Gy0iONhaow sX8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791642360; x=1792247160; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=b88sjkJ/RqBf+LyWYx8z8VDQ3/sowwhU6O/+Md+JWNs=; b=UZNLubc/Q4K6f+kWqTJsdpm67N3gUg8NcmxGMu4KytwCOgu6FOYax1+gqPH1AobZl8 dtQpbuxgfOiX3onzLWhdwfXwi06wBJIIv/MqkCw11e4/NOgz230Os4g9zCyyPGXQSJbL /zSUPtTlWfMSskVEhK91dWQm/Bpp/HAQ6LZ1gCXjpuVM+xN8wODG1lqnUYQoelyRFL0O is4Z55LNuwegUkw/o3wE/+AN+2qwa0Yw5r7saRibjzo/cWdtdR2oagE7vGwsCQ8y2tj8 QV0YoHDDhJfw47wdO+V87RBtHhCSqjgv3Nn/+uObQWpDYkR5SdqdnlA2OPoyZjQgltK+ 1uoQ== X-Forwarded-Encrypted: i=1; AKwUvBxUPNS9Rqyz2DqV4KV1hsJ+NHDAraNQC81LBP0WY1RSxQFXTpfUIPzAZ1AiElgGankeEB84Z9IwA79DqQw=@vger.kernel.org X-Gm-Message-State: AFq9FYK+U8zpELq6TVzs9Z6n7JyTw0FblRhpENwmZ0DmVJNZErnF7F+3 Bd1bdJfg/2G6y+d8+IY1FTf4Aam2CQs8XFS7ZaHZwXv5aYPYTBay46Tx X-Gm-Gg: AYBFou00J9h3PJeTXJLaAIGl4/RglwHbNgJilAa8kCcermQVaKbmK1XYvVubImF/aGe 0xahNrMwz512sQfrBJ9mNSrQTocNGRQhjJ9i22g6HY7MaaqaM97a2XHYhVMqvkq21X+f00hpdQX C4SZjvlqN8xR6ev9ZqdUcFUexG9efMceO9bXcUECNeYhI7QASRhTKt/cNNgXE3gjS9dgl1iE3VP ptTLy8aPsJfE+vsDNWlISK5RD2cMM7/u3v5EM0+/6MHAcTB9C49SPewsaBD2O8mnRIEGUpVA0pt vBO5wHJu0BEzhTe/fRMdi0ohskGicaqz0yOe1i1KKTYvKgLF9TLiP3aoy0cLgCYCucbqq9lNC1H FELfw1yFtuyJJPwgVTOXVhUJ3HfrmY9xt7Gbcmog06oFtDCKCuN4/lWoCS3KEBVKRk5YQ5duYdQ TzDwJ2sQEWy3QRz8UoDIgWCRU5/3dfeEo2A5nf7N+V2Z89GC0uONfO+azzhAUrZmKRWFCXSqR95 ewEjrZGvpZmQatTFiVg1vxiDhGR5QIMUjUfjhvRjMKJwRBbk24= X-Received: by 2002:a05:6402:11cc:b0:6af:82b2:90a with SMTP id 4fb4d7f45d1cf-6b17c291040mr4765042a12.43.1791642359841; Sat, 10 Oct 2026 07:25:59 -0700 (PDT) Received: from buildhost.darklands.se ([2001:9b1:ff:d701:51eb:176f:63d9:53f8]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6b179dfff40sm2635586a12.34.2026.10.10.07.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Oct 2026 07:25:58 -0700 (PDT) From: Magnus Lindholm To: richard.henderson@linaro.org, mattst88@gmail.com, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org Cc: linmag7@gmail.com, stable@vger.kernel.org Subject: [PATCH v5 7/8] alpha: invalidate the local context in flush_tlb_mm() Date: Sat, 10 Oct 2026 16:24:33 +0200 Message-ID: <20261010142533.974797-8-linmag7@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261010142533.974797-1-linmag7@gmail.com> References: <20261010142533.974797-1-linmag7@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit flush_tlb_mm() has the same caller-CPU omission that was fixed in flush_tlb_page(): when the target mm is not the calling CPU's active_mm nothing happens locally, and smp_call_function() handles only the other CPUs, so this CPU may later reuse the old ASN together with the translations it still holds. The active_mm test itself is left alone here. That path calls flush_tlb_current(), which loads a fresh context through __load_new_mm_context() rather than issuing a targeted tbi() against whatever ASN happens to be loaded, so it does not depend on which context is current. The uniprocessor implementation in asm/tlbflush.h already has the missing branch. Counted over a fork-heavy run, flush_tlb_mm() was entered with the mm not this CPU's active_mm 2934 times, and 632 times while otherwise idle. The proposed Alpha hugetlb support routes hugetlb invalidations through flush_tlb_range(), which calls this function. Unmapping or migrating a hugetlb folio from another context will also need this local invalidate. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Matt Turner Signed-off-by: Magnus Lindholm --- arch/alpha/kernel/smp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index a5a42ae4a7d8..988e397b0b8a 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c @@ -649,6 +649,9 @@ flush_tlb_mm(struct mm_struct *mm) preempt_enable(); return; } + } else { + /* smp_call_function() does not call back into this CPU. */ + flush_tlb_other(mm); } smp_call_function(ipi_flush_tlb_mm, mm, 1); -- 2.43.0