linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Kulikov Vasiliy <segooon@gmail.com>,
	kernel-janitors@vger.kernel.org, Neil Brown <neilb@suse.de>,
	Jens Axboe <jaxboe@fusionio.com>,
	linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] md: do not use ++ in rcu_dereference() argument
Date: Thu, 9 Sep 2010 20:46:03 -0700	[thread overview]
Message-ID: <20100910034603.GA2612@linux.vnet.ibm.com> (raw)
In-Reply-To: <201009091714.44013.arnd@arndb.de>

On Thu, Sep 09, 2010 at 05:14:43PM +0200, Arnd Bergmann wrote:
> On Tuesday 07 September 2010, Paul E. McKenney wrote:
> > On Tue, Sep 07, 2010 at 10:00:58PM +0200, Arnd Bergmann wrote:
> > > On Tuesday 07 September 2010 21:21:55 Kulikov Vasiliy wrote:
> > > > #define __rcu_dereference_check(p, c, space) \
> > > >         ({ \
> > > >                 typeof(*p) *_________p1 = (typeof(*p)*__force )ACCESS_ONCE(p); \
> > > >                                                                    ^
> > > >                 rcu_lockdep_assert(c); \
> > > >                 (void) (((typeof (*p) space *)p) == p); \
> > > >                                       ^     ^
> > > >                 smp_read_barrier_depends(); \
> > > >                 ((typeof(*p) __force __kernel *)(_________p1)); \
> > > >         })
> > > > 
> > > > If I understand this, it is evaluated three times, right?
> > > 
> > > Yes, that looks like my own fault, I added that :(
> > > 
> > > This patch seems to fix it, but I need to think about it some more
> > > to make sure it still does everything we need.
> > 
> > Let me know when you are satisfied with it, and then I will pick it up.
> 
> I guess it would be good to put it in now. I haven't had the time
> to try out all cases, but the current code in -next is definitely
> broken, so please put the fix in now.

Hmmm...  One approach would be have a secondary macro that was:

	#define __rcu_dereference_check_sparse(p, space) \
		(void) (((typeof (*p) space *)p) == p);

when running sparse and:

	#define __rcu_dereference_check_sparse(p, space)

otherwise.

Would that do the trick?

							Thanx, Paul

  reply	other threads:[~2010-09-10  3:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-05 18:32 [PATCH] md: do not use ++ in rcu_dereference() argument Kulikov Vasiliy
2010-09-05 19:01 ` Sam Ravnborg
2010-09-05 19:23   ` Kulikov Vasiliy
2010-09-05 20:39     ` Sam Ravnborg
2010-09-06  5:29       ` Neil Brown
2010-09-06  7:43         ` walter harms
2010-09-06 11:05           ` Neil Brown
2010-09-06 19:21         ` Sam Ravnborg
2010-09-08  7:04           ` Neil Brown
2010-09-16 12:54         ` Avi Kivity
2010-09-17  3:18           ` Neil Brown
2010-09-06 20:10 ` Arnd Bergmann
2010-09-07 19:21   ` Kulikov Vasiliy
2010-09-07 20:00     ` Arnd Bergmann
2010-09-07 20:50       ` Paul E. McKenney
2010-09-09 15:14         ` Arnd Bergmann
2010-09-10  3:46           ` Paul E. McKenney [this message]
2010-09-14  0:33             ` Paul E. McKenney
2010-09-15 12:28               ` Arnd Bergmann
2010-09-16  6:15                 ` Paul E. McKenney

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=20100910034603.GA2612@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=arnd@arndb.de \
    --cc=jaxboe@fusionio.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=segooon@gmail.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).