Re: [RFC PATCH 4/5] RCU: Add TASK_RCU_OFFSET

From: Lai Jiangshan
Date: Mon Apr 11 2011 - 04:31:21 EST


On 04/11/2011 01:12 PM, Paul E. McKenney wrote:
> On Mon, Apr 11, 2011 at 11:08:14AM +0800, Lai Jiangshan wrote:
>> On 04/08/2011 01:13 PM, Paul E. McKenney wrote:
>>> On Fri, Apr 08, 2011 at 09:26:16AM +0800, Lai Jiangshan wrote:
>>>> On 04/08/2011 12:26 AM, Paul E. McKenney wrote:
>>>>> On Thu, Apr 07, 2011 at 08:47:37AM -0700, Paul E. McKenney wrote:
>>>>>> On Thu, Apr 07, 2011 at 01:49:51PM +0800, Lai Jiangshan wrote:
>>>>>>> On 04/07/2011 08:30 AM, Paul E. McKenney wrote:
>>>>>>>> On Wed, Apr 06, 2011 at 02:27:39PM -0700, H. Peter Anvin wrote:
>>>>>>>>> On 04/06/2011 02:06 PM, Peter Zijlstra wrote:
>>>>>>>>>> On Wed, 2011-04-06 at 13:13 -0700, Paul E. McKenney wrote:
>>>>>>>>>>> And the following patch builds correctly for defconfig x86 builds,
>>>>>>>>>>> while allowing rcupdate.h to see the sched.h definitions as needed
>>>>>>>>>>> to inline rcu_read_lock() and rcu_read_unlock().
>>>>>>>>>>>
>>>>>>>>>> Looks like an entirely reasonable patch to me ;-)
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Quite... a lot better than the original proposal!
>>>>>>>>
>>>>>>>> Glad you both like it!
>>>>>>>>
>>>>>>>> When I do an allyesconfig build, I do get errors during the "CHECK"
>>>>>>>> phase, when it is putting things into the usr/include in the build tree.
>>>>>>>> I believe that this is because I am exposing different header files to
>>>>>>>> the library-export scripts. The following patch silences some of them,
>>>>>>>> but I am really out of my depth here.
>>>>>>>>
>>>>>>>> Sam, Jan, Michal, help?
>>>>>>>>
>>>>>>>> Thanx, Paul
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>
>>>>>>>
>>>>>>> Easy to split rcupdate.h, hard to resolve the dependence problem.
>>>>>>>
>>>>>>> You can apply the next additional patch when you test:
>>>>>>
>>>>>> I am sure that you are quite correct. ;-)
>>>>>>
>>>>>> I am moving _rcu_read_lock() and _rcu_read_unlock() into
>>>>>> include/linux/rcutree.h and include/linux/rcutiny.h, and I am sure that
>>>>>> more pain will ensue.
>>>>>>
>>>>>> One thing I don't understand... How does is it helping to group the
>>>>>> task_struct RCU-related fields into a structure? Is that generating
>>>>>> better code on your platform due to smaller offsets or something?
>>>>
>>>> You don't like task_rcu_struct patch? I think it can make code clearer,
>>>> and it can also check the code even when CONFIG_PREEMPT_RCU=n.
>>>>
>>>> For rcu_read_[un]lock(), it generates the same code, no better, no worse.
>>>>
>>>> It is just a cleanup patch, it is helpless for making rcu_read_[un]lock() inline,
>>>> if you don't like it, I will give up it.
>>>
>>> I don't know that I feel strongly either way about it. It was necessary
>>> with the integer-offset approach, but optional now.
>>>
>>>>>> Also, does your patchset address the CHECK warnings?
>>>>>
>>>>> I take it back... I applied the following patch on top of my earlier
>>>>> one, and a defconfig x86 build completed without error. (Though I have
>>>>> not tested the results of the build.)
>>>>>
>>>>> One possible difference -- I did this work on top of a recent Linus
>>>>> git commit (b2a8b4b81966) rather than on top of my -rcu tree. Also,
>>>>> I have not yet tried an allyesconfig build, which will no doubt locate
>>>>> some more problems.
>>>>>
>>>>> Thanx, Paul
>>>>>
>>>>
>>>> when defconfig or allyesconfig, CONFIG_PREEMPT=n and CONFIG_TREE_PREEMPT_RCU=n
>>>> when you make them "y":
>>>>
>>>> In file included from include/linux/rcupdate.h:764:0,
>>>> from include/linux/tracepoint.h:19,
>>>> from include/linux/module.h:18,
>>>> from include/linux/crypto.h:21,
>>>> from arch/x86/kernel/asm-offsets.c:8:
>>>> include/linux/rcutree.h:50:20: error: static declaration of â__rcu_read_lockâ follows non-static declaration
>>>> include/linux/rcupdate.h:76:13: note: previous declaration of â__rcu_read_lockâ was here
>>>> include/linux/rcutree.h:63:20: error: static declaration of â__rcu_read_unlockâ follows non-static declaration
>>>> include/linux/rcupdate.h:77:13: note: previous declaration of â__rcu_read_unlockâ was here
>>>> make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
>>>> make: *** [prepare0] Error 2
>>>
>>> Yep. I need to move the rcu_read_lock() APIs to follow the inclusion
>>> of rcutree.h and rcutiny.h. Also add include of sched.h to rcutiny.h.
>>> The code movement does bloat the patch a bit. But rcu_assign_pointer()
>>> must precede the inclusion of rcutree.h and rcutiny.h, so it is not
>>> possible to simply move the inclusions. See below.
>>>
>>> Thanx, Paul
>>>
>>
>> sched.h still contains rcupdate.h after applied this patch.
>
> Then we are not in sync -- sched.h does not include rcupdate.h in my tree.
> It instead gets the struct rcu_head definition from include/linux/types.h.
> See below for a consolidated patch.
>
> Thanx, Paul
>
>> See my [PATCH 2/4] for more info.
>>
>>
>> # make lib/is_single_threaded.o
>> CHK include/linux/version.h
>> CHK include/generated/utsrelease.h
>> CALL scripts/checksyscalls.sh
>> CC lib/is_single_threaded.o
>> In file included from include/linux/rcupdate.h:639:0,
>> from include/linux/rculist.h:10,
>> from include/linux/sched.h:82,
>> from lib/is_single_threaded.c:13:
>> include/linux/rcutree.h: In function â__rcu_read_lockâ:
>> include/linux/rcutree.h:52:15: error: dereferencing pointer to incomplete type
>> In file included from include/linux/rcupdate.h:639:0,
>> from include/linux/rculist.h:10,
>> from include/linux/sched.h:82,
>> from lib/is_single_threaded.c:13:
>> include/linux/rcutree.h: In function â__rcu_read_unlockâ:
>> include/linux/rcutree.h:68:5: error: dereferencing pointer to incomplete type
>> include/linux/rcutree.h:70:7: error: dereferencing pointer to incomplete type
>> include/linux/rcutree.h:71:46: error: dereferencing pointer to incomplete type
>> include/linux/rcutree.h:71:78: error: dereferencing pointer to incomplete type
>> include/linux/rcutree.h:71:6: warning: type defaults to âintâ in type name
>> make[1]: *** [lib/is_single_threaded.o] Error 1
>> make: *** [lib/is_single_threaded.o] Error 2
>
> drivers/scsi/scsi_sysctl.c | 1 +
> fs/proc/proc_sysctl.c | 1 +
> include/linux/kernel.h | 3 +++
> include/linux/pid.h | 2 +-
> include/linux/rcupdate.h | 29 +++++++++--------------------
> include/linux/rcutiny.h | 35 +++++++++++++++++++++++++++++++++++
> include/linux/rcutree.h | 37 +++++++++++++++++++++++++++++++++++++
> include/linux/sched.h | 10 ++++------
> include/linux/sem.h | 2 +-
> include/linux/soundcard.h | 2 ++
> include/linux/sysctl.h | 5 +++--
> include/linux/types.h | 10 ++++++++++
> kernel/pid_namespace.c | 2 ++
> kernel/rcutiny_plugin.h | 38 ++------------------------------------
> kernel/rcutree_plugin.h | 38 ++------------------------------------
> kernel/sysctl_binary.c | 1 +
> kernel/sysctl_check.c | 1 +
> net/core/sysctl_net_core.c | 1 +
> net/dccp/sysctl.c | 1 +
> net/ipv6/sysctl_net_ipv6.c | 1 +
> net/irda/irsysctl.c | 1 +
> net/phonet/sysctl.c | 1 +
> net/rds/ib_sysctl.c | 1 +
> net/rds/iw_sysctl.c | 1 +
> net/rds/sysctl.c | 1 +
> net/sctp/sysctl.c | 1 +
> net/sunrpc/sysctl.c | 1 +
> net/unix/sysctl_net_unix.c | 1 +
> net/xfrm/xfrm_sysctl.c | 1 +
> 29 files changed, 127 insertions(+), 102 deletions(-)
>

sched.h still contains rcupdate.h after applied this patch.
so it still fails.

Is other part of patch(or patch 2/2) not sent?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/