From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 4A19D3B5319 for ; Sun, 9 Aug 2026 08:55:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786265743; cv=none; b=the8p7tyPqHcoEfxUeVrRnyuXXLyuoSuRmnDmV6zp3CpRe8pvu+8tmSePNVBMdArjkwOXZxSk/SCA4dG0LugnFGVLJ+EUnvzHIh+XHS427BkYW2FSUt2bUCR2OC3QFzLGCLfrTKjotMgrKs7B3CtczHw86czg7vFhS5amYXYIjY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786265743; c=relaxed/simple; bh=jNdVta5xUXSTjnpylN4yxJ+wUC0ZRwFWI3FqxiileXU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MAfOkThj3xRJ0F/UfoBwm04npc8pD3l0++ps9HXWj6ASPSRkJVOUVX8Ed9OvyoK4Wyik90x9nkXg3KG8y1yk1wx/O6KLBiJ9bVVE/4bNNZLWZzjRUcKo7vS1SYyCzzLRbV45Q93wdR4A2obxnX2Ev1TstNA1gTz9oBRVyzRipPs= 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=dNJgQH49; arc=none smtp.client-ip=209.85.208.48 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="dNJgQH49" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-6a205b0df35so424189a12.1 for ; Sun, 09 Aug 2026 01:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786265734; x=1786870534; 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=4JHbNy7t36m8QFac0Mb9Mig7FuHxoP3xq252YSUXqrc=; b=dNJgQH49l6zbKr9imy/1OjgiiDsdZZY1E5GhanIdp0IWxmjWJ4fkNiJJylr8W7r7sY SenOYRGaGn6tFgEFINSycr36O9giQx9PFwrTXrBVIzV9+bvYVhlboSTS5YgKxhx7dkXO 8gj5xZEg24GTLBP51E2JVYGPb3utVR6M0yL09igzyeGWgUyeGkmfCTQX+iIUWE+aRDVj 7sJTRvZVCjT9w43qcmqtvLq4M7STuK3XZMefF38+Hw515VKpYfaRJFKinbUZEIxczZ2Y zuYOUm/ogSSKAd2c6LXLgGARwk1/IMIOMgQyIilyWNDCIWBzwfZMZ3JvWW5T3o7DrOob uIkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786265734; x=1786870534; 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=4JHbNy7t36m8QFac0Mb9Mig7FuHxoP3xq252YSUXqrc=; b=FslF0crHOsgnR0FQXnurn3AqNw/2on26PGoKig95Szjqx4biAvJNdw8lPbhAQ2cW44 NFVSlnWNHeD37NVVWhVa8b4dfNrYJR4JRX79gX1RcHPfR8hUzUFfj8p+PamasRgaDNdh tzSq5oETLkQIl3Lh/tz3XiG5TF0785w7orDa2K4FOUBEKLWkkW9C6z7xMNBFW+KTo+Zc rPLmOguWDAkofezZZUr8p0xxiyaKvHUGvg/DCucj8Yzh3YCxKuf2CyJCnNhoMpuwMGrQ +U57Jjl/dXhVwy5Ig5FQUUUbLmwk/lhav4eqrsCUaCmBcxdxdQ9/7BFIYFiZKcc/mJas 6Z2w== X-Forwarded-Encrypted: i=1; AHgh+RqDJyzqYHH1QW+wmsMmvocVNeiAmAFv7n2bdx1fkUec7xCAbkBw7st9alODmXjo6bckxBs24rQknTcJw98=@vger.kernel.org X-Gm-Message-State: AOJu0Yzf/u8XusjxnMsp9e86BZVP5f/ub6HbGXDd3mmXhN/6HN6T2Ec2 d99H1DQUcaCEechfTlW7DV2KzP64IpDvf5f+H6WzrtXjtJxPZXYaqXx3 X-Gm-Gg: AR+sD13V+oAe5A5ALZrmsnxmiX2cqYd/lyvCRtFpd/q//bERGSQGgPkxOjMht9JFoQo AbCRrTVEzvD8YGDv/xS6Bfa6nuGAE3IVqTEzgEtSo+06qkqYz5YoqopbzkFAO1RYvL1kER3rjLz zPiQDvLptbPVoNpTYbzEz9JuJkA8MfQpmD+G57ZP1fL8uW7VeM+8C8PZjNXbx13WIEl1KwCTIDW 9nECAAYyvNmvlM9+t/Zk9uqs8JLIt6Qtbg8KYasrrTRjMw2jNSXKdytVtdH0Y4Ns3YIif51gISN jdxvyQAhwKIq54Y0lVaHcx0/X0mwVzlp1OBTY16YKj48oblSIwlNd1P/YDZeSD8HT1/JxFI/WQ/ PMq5czuTc8NLVQu0OJ+3Vr9hEj0VoYZI69xYKkIjBp5ZF+CDyUHHelaGYo9gF3oEikmewlViiCQ axSiWScTVWePHjDwnS9q664K6h0ujOURGDW8310YaVW9suE7+2mnnwBKIPL+70sbos8I8vCR9U2 ZitXdVJasvd+MsSxbR4CYz82/ka2+I= X-Received: by 2002:a05:6402:2344:b0:6a0:c763:89e5 with SMTP id 4fb4d7f45d1cf-6a14f2576f8mr16999516a12.19.1786265734380; Sun, 09 Aug 2026 01:55:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Aug 2026 01:55:34 -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 6/6] alpha: invalidate the local context in flush_icache_user_page() Date: Sun, 9 Aug 2026 10:49:38 +0200 Message-ID: <20260809085208.3262799-7-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 flush_icache_user_page() has the same caller-CPU omission that the previous patch fixed in flush_tlb_mm(): if (mm == current->active_mm) { __load_new_mm_context(mm); ... } smp_call_function(ipi_flush_icache_page, mm, 1); 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. This matters here in particular because the function exists for operating on another process's mappings: the comment above it describes setting breakpoints through ptrace, and access_remote_vm() reaches it through copy_to_user_page(). The calling CPU is therefore often running something other than the target mm. As in flush_tlb_mm(), the UP implementation in asm/cacheflush.h already has the missing case: if (current->active_mm == mm) __load_new_mm_context(mm); else mm->context[smp_processor_id()] = 0; 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 f501a91001cc..13b86f7224de 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c @@ -780,6 +780,13 @@ flush_icache_user_page(struct vm_area_struct *vma, struct page *page, preempt_enable(); return; } + } else { + /* + * As in flush_tlb_mm(): smp_call_function() does not call + * back into this CPU, and this function is used precisely + * when operating on another process's mappings. + */ + flush_tlb_other(mm); } smp_call_function(ipi_flush_icache_page, mm, 1); -- 2.53.0