summaryrefslogtreecommitdiff
path: root/kernel/time/ntp.c
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2020-03-25 17:41:56 +0100
committerPaul E. McKenney <paulmck@kernel.org>2020-04-13 17:18:11 -0700
commit757a4cefde76697af2b2c284c8a320912b77e7e6 (patch)
tree977a8e0f86eb623366b89e15d298aa492dd28f46 /kernel/time/ntp.c
parent6119418f94ca5314392d258d27eb0cb58bb1774e (diff)
kcsan: Add support for scoped accesses
This adds support for scoped accesses, where the memory range is checked for the duration of the scope. The feature is implemented by inserting the relevant access information into a list of scoped accesses for the current execution context, which are then checked (until removed) on every call (through instrumentation) into the KCSAN runtime. An alternative, more complex, implementation could set up a watchpoint for the scoped access, and keep the watchpoint set up. This, however, would require first exposing a handle to the watchpoint, as well as dealing with cases such as accesses by the same thread while the watchpoint is still set up (and several more cases). It is also doubtful if this would provide any benefit, since the majority of delay where the watchpoint is set up is likely due to the injected delays by KCSAN. Therefore, the implementation in this patch is simpler and avoids hurting KCSAN's main use-case (normal data race detection); it also implicitly increases scoped-access race-detection-ability due to increased probability of setting up watchpoints by repeatedly calling __kcsan_check_access() throughout the scope of the access. The implementation required adding an additional conditional branch to the fast-path. However, the microbenchmark showed a *speedup* of ~5% on the fast-path. This appears to be due to subtly improved codegen by GCC from moving get_ctx() and associated load of preempt_count earlier. Suggested-by: Boqun Feng <boqun.feng@gmail.com> Suggested-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/time/ntp.c')
0 files changed, 0 insertions, 0 deletions