linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Rohan McLure <rmclure@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-xtensa@linux.xtensa.org
Cc: chris@zankel.net, elver@google.com, npiggin@gmail.com,
	jcmvbkbc@gmail.com, Rohan McLure <rmclure@linux.ibm.com>
Subject: [PATCH v4 4/7] powerpc: kcsan: Exclude udelay to prevent recursive instrumentation
Date: Wed,  8 Feb 2023 14:21:59 +1100	[thread overview]
Message-ID: <20230208032202.1357949-5-rmclure@linux.ibm.com> (raw)
In-Reply-To: <20230208032202.1357949-1-rmclure@linux.ibm.com>

In order for KCSAN to increase its likelihood of observing a data race,
it sets a watchpoint on memory accesses and stalls, allowing for
detection of conflicting accesses by other kernel threads or interrupts.

Stalls are implemented by injecting a call to udelay in instrumented code.
To prevent recursive instrumentation, exclude udelay from being instrumented.

Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
---
 arch/powerpc/kernel/time.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index d68de3618741..b894029f53db 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -356,7 +356,7 @@ void vtime_flush(struct task_struct *tsk)
 }
 #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
 
-void __delay(unsigned long loops)
+void __no_kcsan __delay(unsigned long loops)
 {
 	unsigned long start;
 
@@ -377,7 +377,7 @@ void __delay(unsigned long loops)
 }
 EXPORT_SYMBOL(__delay);
 
-void udelay(unsigned long usecs)
+void __no_kcsan udelay(unsigned long usecs)
 {
 	__delay(tb_ticks_per_usec * usecs);
 }
-- 
2.37.2


  parent reply	other threads:[~2023-02-08  3:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  3:21 [PATCH v4 0/7] powerpc: Add KCSAN Support Rohan McLure
2023-02-08  3:21 ` [PATCH v4 1/7] kcsan: Add atomic builtin stubs for 32-bit systems Rohan McLure
2023-02-08  4:23   ` Max Filippov
2023-02-08 12:23   ` Christophe Leroy
2023-02-08 23:14     ` Rohan McLure
2023-02-09 23:36       ` Rohan McLure
2023-02-08  3:21 ` [PATCH v4 2/7] xtensa: kcsan: Remove kcsan stubs for atomic builtins Rohan McLure
2023-02-08  4:24   ` Max Filippov
2023-02-08  3:21 ` [PATCH v4 3/7] powerpc: kcsan: Add exclusions from instrumentation Rohan McLure
2023-02-08  3:21 ` Rohan McLure [this message]
2023-02-08  3:22 ` [PATCH v4 5/7] powerpc: kcsan: Memory barriers semantics Rohan McLure
2023-02-08  3:22 ` [PATCH v4 6/7] powerpc: kcsan: Prevent recursive instrumentation with IRQ save/restores Rohan McLure
2023-02-08  3:22 ` [PATCH v4 7/7] powerpc: kcsan: Add KCSAN Support Rohan McLure
2023-02-08 10:10   ` Marco Elver
2023-02-08 12:25   ` Christophe Leroy

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=20230208032202.1357949-5-rmclure@linux.ibm.com \
    --to=rmclure@linux.ibm.com \
    --cc=chris@zankel.net \
    --cc=elver@google.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=linux-xtensa@linux.xtensa.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.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).