From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 0F80A3B71DC for ; Sun, 9 Aug 2026 08:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786265736; cv=none; b=hkZpZaCZtnheN4t23J202woildm1B4bnAsbtQblAgq1ZR1eG8/NyGuO1VIHdeFBx//VFC9UEZ9i/G6bzLk1ixgMxaoJhR17EXRMB+0AKsF/g7gO08DVwLnyzWb372ISlrlKf9BuImXS4VXJZayZsh1MQVdn1Wpj32rACTLtp6CA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786265736; c=relaxed/simple; bh=OLtwvEZhh/H9sdbvrxT5KViQxXMRD5pB2TH7wole/jk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KXrmiijEuz0nyoX/eyOdehcwThcIVSxRxPJJ9+8co5XECU/yTx/+VG6tEkkO5tmKsHalRsBToJcaVvnm+9dEIAY2tlaBl7T4XX5HsMrcGKxvY3nVU9DA0Digd6FqrW4et7/17hJd37X+CNQOlHtaJKKKf+QcE5UdxwrW65/XkEU= 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=RYNGnY23; arc=none smtp.client-ip=209.85.208.51 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="RYNGnY23" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-6a1995ac437so1603489a12.0 for ; Sun, 09 Aug 2026 01:55:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786265733; x=1786870533; 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=Im1M3BLw7bmxcZcAK4CCU6quas0ztWTFGLp+A3NEnA0=; b=RYNGnY23uFdfzFxfyojAQA/YVEkNCVMmi/EYE8uQiLtb8Z5t037CDVRa9wnLEipqeE g7+a7P9pJ+mkb45NfxHG0KKRfxXMGNPC+vwvyzterZN8rQxi3BcWpn6xnqpMrOdhL9HW 0cIe6EGuBPSpQTXVqpk1tpzv3b5dG85ddVPYy0Z7/C/FUTFHYwS6vnufI7lNAty71tOB OnYGqaQv6o6JLpzKYNgFt3NKJHKc16rJ3/l8TRw+WwKYBYGEPhTSVdDThgTQmpNk6fND Y5ttXWUaIxoS3JRvJvM9llAkch97y/so70qStmQYVVooye7zn/16E5KpdfQKmw6B96Ee QjgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786265733; x=1786870533; 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=Im1M3BLw7bmxcZcAK4CCU6quas0ztWTFGLp+A3NEnA0=; b=k2STYA8qvfexqiN4bCBdibYAb7T478d7BzB7mzRx1xpjzXXJq9ZKI06/3HQCQNCdCO 2TMrbl7k7wbAODE5OOvFi6RmnCDNZpiksLqKpY5ULy09pnh0AFrSuBMELyNYBlA9YsM8 A629gItKzs42MyEdRa8qLiO2FuRjYmCQxu1NBocvVXIpukcEWk+dudmdRqptD5474hq0 XDwFOGoywWVxPGJKupMJrReCjUbS40d4ukQqRXdQRnrvbUwZ+vQy/zTle8hI+02Kn7zs mKjnsVeWqJSJQ7Ckg/YpVMa7o70AtTzhPwoDcilJxBV9qrX6p8UUQw1Ha0KJXg9o4xTF o9eQ== X-Forwarded-Encrypted: i=1; AHgh+RqfBNiywsZ5tqzz0VjUTtJH+ZbbJixMK38/nVzuT7oG+UJwN1MrQGUfI68ZfIp0ZXk3drmO5knXExZixog=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1x1cxBELnNewcZxZvY/pHgp1ozb3tSV0gQ4a/923UtuxeUy7F MJGQhnl8AvnfDWfLw/IqjGl5N1/yVVQw8EYIAhMam7Y9SqJqYz2fCq7t X-Gm-Gg: AR+sD11ZgIoI1po5Vm79PRAmIMyru18un9Czs9GQPmO5IaSrBTxpBDjOnHhOG606jIh WINzA8RBT31Lh7jC95T1PBcuxMFrOJssvYoLxVuKoqRZROrlKS5DjoIMtVvLFTAkcL0pM1W31IB 6/0b6iylLZJbGbEUpsmAAeFzCtsxmWCmle0W5RA5P4kKx5BxSL+lvXrZQznzD5HGmbtWdc/5dfB KdYQpKs02AjJtHslShTzHAZTusHDW1Sn2+DpQlBOjQUtg070VYcDtXwEzx5AQo32dn+D/ZJ4t7+ QSOwshEjZmAsuivU2VIOmHZgCIV1J5sph61h/PlPYPKb9fa8HpBtls2kD2oiRbL/ObFGqd6wHFy lGHweXrSl+9PqH5QytGJwM7P8Ebf4Fm6WGyuHHwk9QSpxH8p4P2sM2VXmwFjgIwGJBNKWYRsPA3 firAAsC76NdUYM4bM1cjxPBeYgxb38guuAlrdXouqRzePGd6DJ4KJR5OVGv6MTDCETqnDql/7r8 66FRrd4hyRtzEXe42DNa0qjWfknhng= X-Received: by 2002:a05:6402:44da:b0:69e:14ab:5966 with SMTP id 4fb4d7f45d1cf-6a1f4e32f44mr3820453a12.8.1786265733291; Sun, 09 Aug 2026 01:55:33 -0700 (PDT) Received: from buildhost.darklands.se ([2001:9b1:ff:d701:51eb:176f:63d9:53f8]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6a1f630a4afsm1606681a12.3.2026.08.09.01.55.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Aug 2026 01:55:32 -0700 (PDT) From: Magnus Lindholm To: richard.henderson@linaro.org, mattst88@gmail.com, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org Cc: glaubitz@physik.fu-berlin.de, mcree@orcon.net.nz, ink@unseen.parts, macro@orcam.me.uk, Magnus Lindholm Subject: [PATCH 5/6] alpha: invalidate the local context in flush_tlb_mm() Date: Sun, 9 Aug 2026 10:49:37 +0200 Message-ID: <20260809085208.3262799-6-linmag7@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260809085208.3262799-1-linmag7@gmail.com> References: <20260809085208.3262799-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 The SMP flush_tlb_mm() only touches the calling CPU when the mm is its active_mm: if (mm == current->active_mm) { flush_tlb_current(mm); ... } smp_call_function(ipi_flush_tlb_mm, mm, 1); If it is not, nothing happens locally at all: smp_call_function() does not call back into the caller. mm->context[cpu] is left valid, so this CPU may later reuse the old ASN, and any translations it still holds for MM stay usable. Callers reach this regularly - counting the branch gave 2934 such calls over a fork-heavy workload and 632 while otherwise idle. Add the missing else. The UP implementation in asm/tlbflush.h already has exactly this shape: if (mm == current->active_mm) flush_tlb_current(mm); else flush_tlb_other(mm); Unlike flush_tlb_page(), the active_mm test itself is valid here: flush_tlb_current() calls __load_new_mm_context(), which allocates and loads a fresh context rather than relying on a targeted tbi() to operate on whatever ASN happened to be loaded beforehand. Signed-off-by: Magnus Lindholm --- arch/alpha/kernel/smp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index d167b3ba1303..f501a91001cc 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c @@ -649,6 +649,13 @@ flush_tlb_mm(struct mm_struct *mm) preempt_enable(); return; } + } else { + /* + * smp_call_function() below does not call back into this + * CPU, so this is the only chance to retire what it holds + * for MM. The UP implementation already does this. + */ + flush_tlb_other(mm); } smp_call_function(ipi_flush_tlb_mm, mm, 1); -- 2.53.0