From: "Paul E. McKenney" <paulmck@kernel.org>
To: linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com,
kernel-team@fb.com, mingo@kernel.org
Cc: elver@google.com, andreyknvl@google.com, glider@google.com,
dvyukov@google.com, cai@lca.pw, boqun.feng@gmail.com,
"Paul E . McKenney" <paulmck@kernel.org>
Subject: [PATCH kcsan 8/9] kcsan: Move ctx to start of argument list
Date: Wed, 15 Sep 2021 17:31:45 -0700 [thread overview]
Message-ID: <20210916003146.3910358-8-paulmck@kernel.org> (raw)
In-Reply-To: <20210916003126.GA3910257@paulmck-ThinkPad-P17-Gen-1>
From: Marco Elver <elver@google.com>
It is clearer if ctx is at the start of the function argument list;
it'll be more consistent when adding functions with varying arguments
but all requiring ctx.
No functional change intended.
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/kcsan/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/kcsan/core.c b/kernel/kcsan/core.c
index 8b20af541776..4b84c8e7884b 100644
--- a/kernel/kcsan/core.c
+++ b/kernel/kcsan/core.c
@@ -222,7 +222,7 @@ static noinline void kcsan_check_scoped_accesses(void)
/* Rules for generic atomic accesses. Called from fast-path. */
static __always_inline bool
-is_atomic(const volatile void *ptr, size_t size, int type, struct kcsan_ctx *ctx)
+is_atomic(struct kcsan_ctx *ctx, const volatile void *ptr, size_t size, int type)
{
if (type & KCSAN_ACCESS_ATOMIC)
return true;
@@ -259,7 +259,7 @@ is_atomic(const volatile void *ptr, size_t size, int type, struct kcsan_ctx *ctx
}
static __always_inline bool
-should_watch(const volatile void *ptr, size_t size, int type, struct kcsan_ctx *ctx)
+should_watch(struct kcsan_ctx *ctx, const volatile void *ptr, size_t size, int type)
{
/*
* Never set up watchpoints when memory operations are atomic.
@@ -268,7 +268,7 @@ should_watch(const volatile void *ptr, size_t size, int type, struct kcsan_ctx *
* should not count towards skipped instructions, and (2) to actually
* decrement kcsan_atomic_next for consecutive instruction stream.
*/
- if (is_atomic(ptr, size, type, ctx))
+ if (is_atomic(ctx, ptr, size, type))
return false;
if (this_cpu_dec_return(kcsan_skip) >= 0)
@@ -637,7 +637,7 @@ check_access(const volatile void *ptr, size_t size, int type, unsigned long ip)
else {
struct kcsan_ctx *ctx = get_ctx(); /* Call only once in fast-path. */
- if (unlikely(should_watch(ptr, size, type, ctx)))
+ if (unlikely(should_watch(ctx, ptr, size, type)))
kcsan_setup_watchpoint(ptr, size, type, ip);
else if (unlikely(ctx->scoped_accesses.prev))
kcsan_check_scoped_accesses();
--
2.31.1.189.g2e36527f23
next prev parent reply other threads:[~2021-09-16 0:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 0:31 [PATCH kcsan 0/9] Kernel Concurrency Sanitizer (KCSAN) updates for v5.16 Paul E. McKenney
2021-09-16 0:31 ` [PATCH kcsan 1/9] kcsan: test: Defer kcsan_test_init() after kunit initialization Paul E. McKenney
2021-09-16 0:31 ` [PATCH kcsan 2/9] kcsan: test: Use kunit_skip() to skip tests Paul E. McKenney
2021-09-16 0:31 ` [PATCH kcsan 3/9] kcsan: test: Fix flaky test case Paul E. McKenney
2021-09-16 0:31 ` [PATCH kcsan 4/9] kcsan: Add ability to pass instruction pointer of access to reporting Paul E. McKenney
2021-09-16 0:31 ` [PATCH kcsan 5/9] kcsan: Save instruction pointer for scoped accesses Paul E. McKenney
2021-09-16 0:31 ` [PATCH kcsan 6/9] kcsan: Start stack trace with explicit location if provided Paul E. McKenney
2021-09-16 0:31 ` [PATCH kcsan 7/9] kcsan: Support reporting scoped read-write access type Paul E. McKenney
2021-09-16 0:31 ` Paul E. McKenney [this message]
2021-09-16 0:31 ` [PATCH kcsan 9/9] kcsan: selftest: Cleanup and add missing __init Paul E. McKenney
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=20210916003146.3910358-8-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=andreyknvl@google.com \
--cc=boqun.feng@gmail.com \
--cc=cai@lca.pw \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
/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