[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKQMxzTAK_0BJge6r=jC_wT+TqBK0k6MLZyuSvKBOq0AicnnDQ@mail.gmail.com>
Date: Mon, 13 Apr 2015 13:39:04 +0200
From: Patrick Marlier <patrick.marlier@...il.com>
To: Paul McKenney <paulmck@...ux.vnet.ibm.com>
Cc: linux-kernel@...r.kernel.org, Josh Triplett <josh@...htriplett.org>
Subject: Re: [PATCH 1/3] rculist: Fix list_entry_rcu to read ptr with rcu_dereference_raw
Strange I don't get any conflict.
Maybe due to my email client so I attached the patches to this email.
Thanks,
--
Patrick
On Sat, Mar 28, 2015 at 11:47 AM, Paul E. McKenney
<paulmck@...ux.vnet.ibm.com> wrote:
> On Sat, Mar 28, 2015 at 03:42:10AM -0700, Paul E. McKenney wrote:
>> On Wed, Mar 25, 2015 at 04:01:24PM +0100, Patrick Marlier wrote:
>> > On 03/25/2015 03:30 PM, Paul E. McKenney wrote:
>> > >On Tue, Mar 24, 2015 at 11:31:38AM +0100, Patrick Marlier wrote:
>> > >>Change to read effectively ptr with rcu_dereference_raw and not the
>> > >>__ptr variable on the stack.
>> > >>
>> > >>Signed-off-by: Patrick Marlier <patrick.marlier@...il.com>
>> > >Avoiding an extra load could be worthwhile in a number of situations,
>> > >agreed.
>> > Not only a load. It adds a store and a load on the stack and I think
>> > this creates a dependency in the processor pipeline.
>> >
>> > >However, won't this change cause sparse to complain if invoked on a
>> > >non-RCU-protected pointer? The ability to use list-RCU API
>> > >members on both RCU and non-RCU pointers was one of the points
>> > >of the previous commit, right?
>> > Probably we can put back the cast but I am not familiar enough with
>> > the RCU API.
>> >
>> > Also, the problem here is that you probably want ACCESS_ONCE to
>> > happen on the content of 'ptr' and not on the stack variable
>> > '__ptr'.
>> >
>> > (you have to follow this chain: rcu_dereference_raw ->
>> > rcu_dereference_check -> __rcu_dereference_check ->
>> > lockless_dereference -> ACCESS_ONCE)
>> >
>> > #define lockless_dereference(p) \
>> > ({ \
>> > typeof(p) _________p1 = ACCESS_ONCE(p); \
>> > smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
>> > (_________p1); \
>> > })
>> >
>> > #define __ACCESS_ONCE(x) ({ \
>> > __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \
>> > (volatile typeof(x) *)&(x); })
>> > #define ACCESS_ONCE(x) (*__ACCESS_ONCE(x))
>> >
>> > Note that ACCESS_ONCE is doing "&" on x.
>> >
>> > IMHO, I would prefer saving some useless instructions for better
>> > performance rather than giving too much flexibility on the API (also
>> > pretty sure the cast can be still done).
>>
>> OK, what I am going to do is to apply your patches for testing purposes.
>> If there are no complaints, they will likely go into v4.3 or thereabouts.
>
> Except that I hit conflicts. Could you please rebase to rcu/dev at
> git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git?
>
> Thanx, Paul
>
View attachment "0001-rculist-Fix-list_entry_rcu-to-read-ptr-with-rcu_dere.patch" of type "text/x-patch" (1157 bytes)
View attachment "0002-netfilter-fix-list_entry_rcu-usage.patch" of type "text/x-patch" (948 bytes)
View attachment "0003-md-bitmap-fix-list_entry_rcu-usage.patch" of type "text/x-patch" (915 bytes)
Powered by blists - more mailing lists