linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* seqcount usage in xt_replace_table()
@ 2019-01-08 19:33 Anatol Pomozov
  2019-01-08 22:37 ` Florian Westphal
                   ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Anatol Pomozov @ 2019-01-08 19:33 UTC (permalink / raw)
  To: fw, Dmitry Vyukov, paulmck, LKML

Hello folks,

A bit of context what I am doing. I am trying to port KTSAN (Kernel
Thread Sanitizer) tool to v4.20. That tool tracks shared data usage
and makes sure it is accessed in a thread-safe manner.

seqlock is a synchronization primitive used by Linux kernel. KTSAN
annotates read_seqbegin()/read_seqretry() and tracks what data been
accessed in its critical section.

During KTSAN port I found and interesting seqcount usage introduced in
commit 80055dab5de0c8677bc148c4717ddfc753a9148e

If I read this commit correctly xt_replace_table() does not use
seqlock in a canonical way to specify a critical section. Instead the
code reads the counter and waits until it gets to a specific value.

Now I want KTSAN to play with this code nicely. I need to tell KTSAN
something like "this raw_read_seqcount() does not start a critical
section, just ignore it". So temporary I introduced
raw_read_seqcount_nocritical() function that is ignored by KTSAN. Is
it a good solution?

Or maybe xt_replace_table() can be enhanced? When I hear that
something waits until an event happens on all CPUs I think about
wait_event() function. Would it be better for xt_replace_table() to
introduce an atomic counter that is decremented by CPUs, and the main
CPU waits until the counter gets zero?

WDYT?

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2019-01-11 14:08 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 19:33 seqcount usage in xt_replace_table() Anatol Pomozov
2019-01-08 22:37 ` Florian Westphal
2019-01-10 12:41   ` Peter Zijlstra
2019-01-10 12:53     ` Dmitry Vyukov
2019-01-10 20:18       ` Peter Zijlstra
2019-01-10 14:48     ` Florian Westphal
2019-01-10 20:20       ` Peter Zijlstra
2019-01-10 20:25       ` Peter Zijlstra
2019-01-10 22:29         ` Florian Westphal
2019-01-11  8:34           ` Peter Zijlstra
2019-01-11 14:08             ` Paul E. McKenney
2019-01-10 14:52     ` Paul E. McKenney
2019-01-09  0:02 ` Andrea Parri
2019-01-09  0:36   ` Anatol Pomozov
2019-01-09  5:35     ` Dmitry Vyukov
2019-01-09 11:24     ` Andrea Parri
2019-01-09 11:55       ` Dmitry Vyukov
2019-01-09 12:11         ` Andrea Parri
2019-01-09 12:29           ` Dmitry Vyukov
2019-01-09 17:10             ` Paul E. McKenney
2019-01-10  8:49               ` Dmitry Vyukov
2019-01-10 12:30                 ` Andrea Parri
2019-01-10 12:38                   ` Dmitry Vyukov
2019-01-10 12:46                     ` Andrea Parri
2019-01-10 13:25                       ` Dmitry Vyukov
2019-01-10 14:50                     ` Paul E. McKenney
2019-01-10 12:44 ` Peter Zijlstra
2019-01-10 12:54   ` Dmitry Vyukov

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).