Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1631453
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] hlist_add_tail_rcu disable sparse warning |
| Date | 2017-04-26 15:20 +0200 |
| Message-ID | <tAv1o-2KI-7@gated-at.bofh.it> (permalink) |
| References | <t9nNT-6VN-1@gated-at.bofh.it> <tfyGC-1cf-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Paul,
Did you see this email?
-- Steve
On Mon, 27 Feb 2017 20:26:01 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Fri, Feb 10, 2017 at 07:39:49PM +0200, Michael S. Tsirkin wrote:
> > sparse is unhappy about this code in hlist_add_tail_rcu:
> >
> > struct hlist_node *i, *last = NULL;
> >
> > for (i = hlist_first_rcu(h); i; i = hlist_next_rcu(i))
> > last = i;
> >
> > This is because hlist_next_rcu and hlist_next_rcu return
> > __rcu pointers.
> >
> > It's a false positive - it's a write side primitive and so
> > does not need to be called in a read side critical section.
> >
> > The following trivial patch disables the warning
> > without changing the behaviour in any way.
> >
> > Note: __hlist_for_each_rcu would also remove the warning but it would be
> > confusing since it calls rcu_derefence and is designed to run in the rcu
> > read side critical section.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
>
> ping
>
> > changes since RFC
> > added commit log text to explain why don't we use __hlist_for_each_rcu
> >
> > include/linux/rculist.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/rculist.h b/include/linux/rculist.h
> > index 4f7a956..bf578e8 100644
> > --- a/include/linux/rculist.h
> > +++ b/include/linux/rculist.h
> > @@ -509,7 +509,7 @@ static inline void hlist_add_tail_rcu(struct hlist_node *n,
> > {
> > struct hlist_node *i, *last = NULL;
> >
> > - for (i = hlist_first_rcu(h); i; i = hlist_next_rcu(i))
> > + for (i = h->first; i; i = i->next)
> > last = i;
> >
> > if (last) {
> > --
> > MST
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH] hlist_add_tail_rcu disable sparse warning Steven Rostedt <rostedt@goodmis.org> - 2017-04-26 15:20 +0200 Re: [PATCH] hlist_add_tail_rcu disable sparse warning "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-26 16:10 +0200
csiph-web