public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Xie Yuanbin <xieyuanbin1@huawei.com>
Cc: rmk+kernel@armlinux.org.uk, linux@armlinux.org.uk,
	rppt@kernel.org, vbabka@suse.cz, pfalcato@suse.de,
	brauner@kernel.org, lorenzo.stoakes@oracle.com,
	kuninori.morimoto.gx@renesas.com, tony@atomide.com,
	arnd@arndb.de, akpm@linux-foundation.org, punitagrawal@gmail.com,
	rjw@rjwysocki.net, marc.zyngier@arm.com, will@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, liaohua4@huawei.com,
	lilinjie8@huawei.com
Subject: Re: [PATCH v2 RESEND 1/2] ARM: spectre-v2: Fix potential missing mitigations
Date: Tue, 28 Oct 2025 17:28:25 +0100	[thread overview]
Message-ID: <20251028162825.x-4ryn3p@linutronix.de> (raw)
In-Reply-To: <20251028162005.bLKC89Hy@linutronix.de>

On 2025-10-28 17:20:06 [+0100], To Xie Yuanbin wrote:
> The requirement is to invoke the mitigation callback of the right CPU.
> What about disabling preemption before getting the callback and doing
> the invocation?

Something like this:

diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h
--- a/arch/arm/include/asm/system_misc.h
+++ b/arch/arm/include/asm/system_misc.h
@@ -20,8 +20,10 @@ typedef void (*harden_branch_predictor_fn_t)(void);
 DECLARE_PER_CPU(harden_branch_predictor_fn_t, harden_branch_predictor_fn);
 static inline void harden_branch_predictor(void)
 {
-	harden_branch_predictor_fn_t fn = per_cpu(harden_branch_predictor_fn,
-						  smp_processor_id());
+	harden_branch_predictor_fn_t fn;
+
+	guard(preempt)();
+	fn = per_cpu(harden_branch_predictor_fn, smp_processor_id());
 	if (fn)
 		fn();
 }

Sebastian


  reply	other threads:[~2025-10-28 16:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16 12:16 [PATCH v2 RESEND 1/2] ARM: spectre-v2: Fix potential missing mitigations Xie Yuanbin
2025-10-16 12:16 ` [PATCH v2 RESEND 2/2] ARM: mm: Optimize page_fault to reduce the impact of spectre-v2 bugfix Xie Yuanbin
2025-10-28 16:20 ` [PATCH v2 RESEND 1/2] ARM: spectre-v2: Fix potential missing mitigations Sebastian Andrzej Siewior
2025-10-28 16:28   ` Sebastian Andrzej Siewior [this message]
2025-10-28 18:20   ` Sebastian Andrzej Siewior
2025-10-29  2:41     ` Xie Yuanbin
2025-10-29  7:11       ` Sebastian Andrzej Siewior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251028162825.x-4ryn3p@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=brauner@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=liaohua4@huawei.com \
    --cc=lilinjie8@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=marc.zyngier@arm.com \
    --cc=pfalcato@suse.de \
    --cc=punitagrawal@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=rppt@kernel.org \
    --cc=tony@atomide.com \
    --cc=vbabka@suse.cz \
    --cc=will@kernel.org \
    --cc=xieyuanbin1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox