Files
linux/kernel
Nathan Chancellor c3f98ff630 rcu/nocb: Avoid unsequenced accesses to jiffies in show_rcu_nocb_state()
After a recent improvement in clang to warn on unsequenced accesses to
volatile variables [1], an instance appears in show_rcu_nocb_state(),
which can break the build with CONFIG_WERROR=y / W=e:

  In file included from kernel/rcu/tree.c:5123:
  kernel/rcu/tree_nocb.h:1651:3: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
   1650 |                 jiffies - rdp->nocb_bypass_first,
        |                 ~~~~~~~
   1651 |                 jiffies - rdp->nocb_nobypass_last,
        |                 ^

Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11
6.5.2, unsequenced side effects on the same scalar object are undefined
behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a
function call is indeterminately sequenced, meaning any side effects in
the arguments are unsequenced.

Add a local variable to hold the value of jiffies before the function
call so that there are no unsequenced side effects, clearing up the
warning.

Cc: [email protected]
Fixes: f7a81b12d6 ("rcu/nocb: Print no-CBs diagnostics when rcutorture writer unduly delayed")
Closes: https://github.com/ClangBuiltLinux/linux/issues/2192
Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
Signed-off-by: Nathan Chancellor <[email protected]>
Reviewed-by: Joel Fernandes <[email protected]>
Signed-off-by: Joel Fernandes <[email protected]>
2026-11-15 18:52:04 -05:00
..
…
…
2026-09-28 08:44:41 +02:00
…
…
…
…
…
2026-11-11 12:32:07 +01:00
2026-10-12 11:13:01 +02:00
…
…
…
2026-10-24 00:46:49 -07:00
…
…
2026-09-04 12:46:45 +02:00