All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: linux-block@vger.kernel.org, bvanassche@acm.org,
	Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Subject: Re: [PATCH] blktrace: Avoid sparse warnings when assigning q->blk_trace
Date: Tue, 2 Jun 2020 15:10:33 +0000	[thread overview]
Message-ID: <20200602151033.GG13911@42.do-not-panic.com> (raw)
In-Reply-To: <20200602141734.GL11244@42.do-not-panic.com>

On Tue, Jun 02, 2020 at 02:17:34PM +0000, Luis Chamberlain wrote:
> On Tue, Jun 02, 2020 at 09:12:05AM +0200, Jan Kara wrote:
> > Here is version of my patch rebased on top of Luis' blktrace fixes. Luis, if
> > the patch looks fine, can you perhaps include it in your series since it seems
> > you'll do another revision of your series due to discussion over patch 5/7?
> > Thanks!
> 
> Sure thing, will throw in the pile.

I've updated the commit log as follows as well, as I think its important
to annotate that the check for processing of the blktrace only makes
sense if it was not set. Let me know if this is fine. The commit log
is below.

From: Jan Kara <jack@suse.cz>
Date: Tue, 2 Jun 2020 09:12:05 +0200
Subject: [PATCH 1/8] blktrace: Avoid sparse warnings when assigning
 q->blk_trace

Mostly for historical reasons, q->blk_trace is assigned through xchg()
and cmpxchg() atomic operations. Although this is correct, sparse
complains about this because it violates rcu annotations since commit
c780e86dd48e ("blktrace: Protect q->blk_trace with RCU") which started
to use rcu for accessing q->blk_trace. Furthermore there's no real need
for atomic operations anymore since all changes to q->blk_trace happen
under q->blk_trace_mutex *and* since it also makes more sense to check
if q->blk_trace is set with the mutex held *earlier* and this is now
done through the patch titled "blktrace: break out on concurrent calls"
and was already before on blk_trace_setup_queue().

So let's just replace xchg() with rcu_replace_pointer() and cmpxchg()
with explicit check and rcu_assign_pointer(). This makes the code more
efficient and sparse happy.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

  reply	other threads:[~2020-06-02 15:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02  7:12 [PATCH] blktrace: Avoid sparse warnings when assigning q->blk_trace Jan Kara
2020-06-02 14:17 ` Luis Chamberlain
2020-06-02 15:10   ` Luis Chamberlain [this message]
2020-06-03  8:35     ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2020-05-28  9:29 Jan Kara
2020-05-28 14:44 ` Bart Van Assche
2020-05-28 14:55   ` Luis Chamberlain
2020-05-28 18:31   ` Jan Kara
2020-05-28 18:43     ` Luis Chamberlain
2020-05-28 18:55       ` Jan Kara
2020-05-29  8:00         ` Luis Chamberlain
2020-05-29  9:04           ` Jan Kara
2020-05-29 11:43             ` Luis Chamberlain
2020-05-29 12:11               ` Jan Kara
2020-05-29 12:22                 ` Luis Chamberlain

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=20200602151033.GG13911@42.do-not-panic.com \
    --to=mcgrof@kernel.org \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.