linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Hanjun Guo <guohanjun@huawei.com>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Hanjun Guo <guohanjun@huawei.com>,
	linux-arm-kernel@lists.infradead.org,
	Jason Yan <yanaijie@huawei.com>
Subject: [RFC PATCH] arm32: spectre-v2: using raw_smp_processor_id() for preemptible
Date: Fri, 5 Apr 2019 11:04:58 +0800	[thread overview]
Message-ID: <1554433498-58551-1-git-send-email-guohanjun@huawei.com> (raw)

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 --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();
 }
-- 
1.7.12.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

                 reply	other threads:[~2019-04-05  3:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1554433498-58551-1-git-send-email-guohanjun@huawei.com \
    --to=guohanjun@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=marc.zyngier@arm.com \
    --cc=yanaijie@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;
as well as URLs for NNTP newsgroup(s).