Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1530576 > unrolled thread

Re: [PATCH RFC] hlist_add_tail_rcu disable sparse warning

Started byDavid Miller <davem@davemloft.net>
First post2016-11-26 02:00 +0100
Last post2016-12-05 04:30 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH RFC] hlist_add_tail_rcu disable sparse warning David Miller <davem@davemloft.net> - 2016-11-26 02:00 +0100
    Re: [PATCH RFC] hlist_add_tail_rcu disable sparse warning "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-28 15:40 +0100
      Re: [PATCH RFC] hlist_add_tail_rcu disable sparse warning "Michael S. Tsirkin" <mst@redhat.com> - 2016-11-28 16:40 +0100
      Re: [PATCH RFC] hlist_add_tail_rcu disable sparse warning "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-05 04:50 +0100
    Re: [PATCH RFC] hlist_add_tail_rcu disable sparse warning "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-05 04:30 +0100

#1530576 — Re: [PATCH RFC] hlist_add_tail_rcu disable sparse warning

FromDavid Miller <davem@davemloft.net>
Date2016-11-26 02:00 +0100
SubjectRe: [PATCH RFC] hlist_add_tail_rcu disable sparse warning
Message-ID<sHzvr-7Sd-5@gated-at.bofh.it>
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Wed, 23 Nov 2016 22:48:19 +0200

> I would appreciate review to confirm the function doesn't
> do anything unsafe though.
> 
> In particular, should this use __hlist_for_each_rcu instead?
> I note that __hlist_for_each_rcu does rcu_dereference
> internally, which is missing here.

I personally think it should use __hlist_for_each_rcu, otherwise
nothing expresses the rcu-ness of the operation.

[toc] | [next] | [standalone]


#1531357

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2016-11-28 15:40 +0100
Message-ID<sIvg5-3iM-17@gated-at.bofh.it>
In reply to#1530576
On Fri, Nov 25, 2016 at 07:52:23PM -0500, David Miller wrote:
> From: "Michael S. Tsirkin" <mst@redhat.com>
> Date: Wed, 23 Nov 2016 22:48:19 +0200
> 
> > I would appreciate review to confirm the function doesn't
> > do anything unsafe though.
> > 
> > In particular, should this use __hlist_for_each_rcu instead?
> > I note that __hlist_for_each_rcu does rcu_dereference
> > internally, which is missing here.
> 
> I personally think it should use __hlist_for_each_rcu, otherwise
> nothing expresses the rcu-ness of the operation.

I like Dave's suggestion.  Michael, does that change work for you?

							Thanx, Paul

[toc] | [prev] | [next] | [standalone]


#1531397

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-11-28 16:40 +0100
Message-ID<sIwca-3Rx-21@gated-at.bofh.it>
In reply to#1531357
On Mon, Nov 28, 2016 at 06:39:19AM -0800, Paul E. McKenney wrote:
> On Fri, Nov 25, 2016 at 07:52:23PM -0500, David Miller wrote:
> > From: "Michael S. Tsirkin" <mst@redhat.com>
> > Date: Wed, 23 Nov 2016 22:48:19 +0200
> > 
> > > I would appreciate review to confirm the function doesn't
> > > do anything unsafe though.
> > > 
> > > In particular, should this use __hlist_for_each_rcu instead?
> > > I note that __hlist_for_each_rcu does rcu_dereference
> > > internally, which is missing here.
> > 
> > I personally think it should use __hlist_for_each_rcu, otherwise
> > nothing expresses the rcu-ness of the operation.
> 
> I like Dave's suggestion.  Michael, does that change work for you?
> 
> 							Thanx, Paul

I think it does, I'll try and post the patch.

-- 
MST

[toc] | [prev] | [next] | [standalone]


#1535790

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-12-05 04:50 +0100
Message-ID<sKSrU-7zW-11@gated-at.bofh.it>
In reply to#1531357
On Mon, Nov 28, 2016 at 06:39:19AM -0800, Paul E. McKenney wrote:
> On Fri, Nov 25, 2016 at 07:52:23PM -0500, David Miller wrote:
> > From: "Michael S. Tsirkin" <mst@redhat.com>
> > Date: Wed, 23 Nov 2016 22:48:19 +0200
> > 
> > > I would appreciate review to confirm the function doesn't
> > > do anything unsafe though.
> > > 
> > > In particular, should this use __hlist_for_each_rcu instead?
> > > I note that __hlist_for_each_rcu does rcu_dereference
> > > internally, which is missing here.
> > 
> > I personally think it should use __hlist_for_each_rcu, otherwise
> > nothing expresses the rcu-ness of the operation.
> 
> I like Dave's suggestion.  Michael, does that change work for you?
> 
> 							Thanx, Paul

I think we should change __hlist_for_each_rcu to skip rcu_dereference
though then, since it would be called outside any rcu read size critical
sections here.


-- 
MST

[toc] | [prev] | [next] | [standalone]


#1535777

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-12-05 04:30 +0100
Message-ID<sKS8x-7tO-5@gated-at.bofh.it>
In reply to#1530576
On Fri, Nov 25, 2016 at 07:52:23PM -0500, David Miller wrote:
> From: "Michael S. Tsirkin" <mst@redhat.com>
> Date: Wed, 23 Nov 2016 22:48:19 +0200
> 
> > I would appreciate review to confirm the function doesn't
> > do anything unsafe though.
> > 
> > In particular, should this use __hlist_for_each_rcu instead?
> > I note that __hlist_for_each_rcu does rcu_dereference
> > internally, which is missing here.
> 
> I personally think it should use __hlist_for_each_rcu, otherwise
> nothing expresses the rcu-ness of the operation.

What does "rcu-ness" mean in this context?

The question is not just about making the code pretty.

This operation is called outside any rcu critical section.
If you are going to call __hlist_for_each_rcu which
calls rcu_dereference, you should do it inside
a critical section.

Other operations such as hlist_add_behind_rcu manipulate
lists manually, maybe this one should, too?
Paul?

-- 
MST

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web