linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Anatol Pomozov <anatol.pomozov@gmail.com>
Cc: fw@strlen.de, Dmitry Vyukov <dvyukov@google.com>,
	paulmck@linux.ibm.com, LKML <linux-kernel@vger.kernel.org>
Subject: Re: seqcount usage in xt_replace_table()
Date: Thu, 10 Jan 2019 13:44:27 +0100	[thread overview]
Message-ID: <20190110124427.GB21224@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAOMFOmU=t9YbE68YpoQn0Ug0XN1F+0iuJp9J=htCRRrbdaPSVA@mail.gmail.com>

On Tue, Jan 08, 2019 at 11:33:39AM -0800, Anatol Pomozov wrote:
> 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.

(gets away from)

> 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?

This code is special enough to just do: READ_ONCE(->sequence) and be
done with it. It doesn't need the smp_rmb() or anything else.

  parent reply	other threads:[~2019-01-10 12:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-01-10 12:54   ` Dmitry Vyukov

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=20190110124427.GB21224@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=anatol.pomozov@gmail.com \
    --cc=dvyukov@google.com \
    --cc=fw@strlen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).