From: Oleg Nesterov <oleg@redhat.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Eric Dumazet <eric.dumazet@gmail.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Davide Libenzi <davidel@xmailserver.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCH] epoll: fix sparse error on RCU assignment
Date: Fri, 15 Mar 2013 18:42:40 +0100 [thread overview]
Message-ID: <20130315174240.GA1069@redhat.com> (raw)
In-Reply-To: <20130314024559.GA19856@dcvr.yhbt.net>
On 03/14, Eric Wong wrote:
>
> Oleg Nesterov <oleg@redhat.com> wrote:
> > On 03/10, Eric Wong wrote:
> > >
> > > This fixes the following sparse error when using
> > > CONFIG_SPARSE_RCU_POINTER=y and "make C=2 fs/eventpoll.o"
> > >
> > > fs/eventpoll.c:514:17: error: incompatible types in comparison expression (different address spaces)
> >
> > ep_remove_wait_queue() does rcu_dereference(pwq->whead) and
> > rcu_dereference_sparse(__rcu) complains, I guess.
> >
> > > --- a/fs/eventpoll.c
> > > +++ b/fs/eventpoll.c
> > > @@ -228,7 +228,7 @@ struct eppoll_entry {
> > > wait_queue_t wait;
> > >
> > > /* The wait queue head that linked the "wait" wait queue item */
> > > - wait_queue_head_t *whead;
> > > + wait_queue_head_t __rcu *whead;
> >
> > Well, perhaps this change is fine... but otoh this this a bit misleading.
> > It is not actually __rcu. The special case is sighand->signalfd_wqh, and
> > the commemt in ep_remove_wait_queue() means: if ->whead is not stable then
> > we can only race with signalfd_cleanup(), and rcu_read_lock() ensures this
> > memory can't go away.
> >
> > We do not even need smp_read_barrier_depends() here, ACCESS_ONCE() should
> > be enough.
> >
> > Perhaps it would be better to simply shut up this warning somehow...
>
> Hi, I've been hoping others would give a reply and offer a better
> solution than min.
Me too ;)
OK, probably we should use your patch, although personally I'd prefer
to simply shut up the warning, say
- whead = rcu_dereference(pwq->whead);
+ whead = rcu_dereference((void __rcu*)pwq->whead);
> Without my proposed patch, sparse _errors_ out on me,
it is only sparse...
But OK, I won't argue with you patch.
Oleg.
next prev parent reply other threads:[~2013-03-15 17:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-10 11:35 [PATCH] epoll: fix sparse error on RCU assignment Eric Wong
2013-03-10 18:23 ` Oleg Nesterov
2013-03-14 2:45 ` Eric Wong
2013-03-15 17:42 ` Oleg Nesterov [this message]
2013-03-28 19:34 ` Eric Wong
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=20130315174240.GA1069@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=davidel@xmailserver.org \
--cc=eric.dumazet@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=normalperson@yhbt.net \
--cc=paulmck@linux.vnet.ibm.com \
--cc=viro@ZenIV.linux.org.uk \
/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.