diff mbox series

[RFC] arm32: spectre-v2: using raw_smp_processor_id() for preemptible

Message ID 1554433498-58551-1-git-send-email-guohanjun@huawei.com (mailing list archive)
State RFC
Headers show
Series [RFC] arm32: spectre-v2: using raw_smp_processor_id() for preemptible | expand

Commit Message

Hanjun Guo April 5, 2019, 3:04 a.m. UTC
When enabling CONFIG_DEBUG_PREEMPT, there is a BUG report:

BUG: using smp_processor_id() in preemptible [00000000] code: remap_file_page/29696
caller is __do_user_fault+0x34/0x114

It turns out that in harden_branch_predictor() using smp_processor_id()
to get current cpu's callback for harden_branch_predictor().

This seems to be a false positive report as we need this running cpu's
callback to clean the cache or BTB event it's preemptible, so using
raw_smp_processor_id() instead to eliminate the false positive report.

Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
Hi,

Not sure I'm doing the right thing, so send as RFC.

 arch/arm/include/asm/system_misc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h
index 66f6a3a..55e3b2b 100644
--- a/arch/arm/include/asm/system_misc.h
+++ b/arch/arm/include/asm/system_misc.h
@@ -22,7 +22,7 @@ 
 static inline void harden_branch_predictor(void)
 {
 	harden_branch_predictor_fn_t fn = per_cpu(harden_branch_predictor_fn,
-						  smp_processor_id());
+						  raw_smp_processor_id());
 	if (fn)
 		fn();
 }