diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2021-05-13 20:17:02 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2021-07-20 22:52:03 +0200 |
commit | 1846a7fa767fbf8cf42d71daf75d51e30e3c8327 (patch) | |
tree | 3e74cbd36a43ad73d5d1696271a6568fe66f7b57 /tools/memory-model | |
parent | Linux 5.14-rc2 (diff) | |
download | linux-1846a7fa767fbf8cf42d71daf75d51e30e3c8327.tar.xz linux-1846a7fa767fbf8cf42d71daf75d51e30e3c8327.zip |
tools/memory-model: Make read_foo_diagnostic() more clearly diagnostic
The current definition of read_foo_diagnostic() in the "Lock Protection
With Lockless Diagnostic Access" section returns a value, which could
be use for any purpose. This could mislead people into incorrectly
using data_race() in cases where READ_ONCE() is required. This commit
therefore makes read_foo_diagnostic() simply print the value read.
Reported-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'tools/memory-model')
-rw-r--r-- | tools/memory-model/Documentation/access-marking.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/memory-model/Documentation/access-marking.txt b/tools/memory-model/Documentation/access-marking.txt index 1ab189f51f55..58bff2619876 100644 --- a/tools/memory-model/Documentation/access-marking.txt +++ b/tools/memory-model/Documentation/access-marking.txt @@ -259,9 +259,9 @@ diagnostic purposes. The code might look as follows: return ret; } - int read_foo_diagnostic(void) + void read_foo_diagnostic(void) { - return data_race(foo); + pr_info("Current value of foo: %d\n", data_race(foo)); } The reader-writer lock prevents the compiler from introducing concurrency |