From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: rostedt@goodmis.org
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
josh@joshtriplett.org, LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [RFC PATCH] rcu: don't ignore preempt_disable() in the idle loop
Date: Wed, 10 Mar 2010 08:57:46 +0800 [thread overview]
Message-ID: <4B96EE8A.5050003@cn.fujitsu.com> (raw)
In-Reply-To: <1268139138.10871.1868.camel@gandalf.stny.rr.com>
Steven Rostedt wrote:
> On Tue, 2010-03-09 at 19:13 +0800, Lai Jiangshan wrote:
>> Current, synchronize_sched() ignores preempt-disable()
>> sequences in the idle loop. It makes synchronize_sched()
>> is not so pure, and it hurts tracing.
>>
>> Paul have a proposal before:
>> http://lkml.org/lkml/2009/4/5/140
>> http://lkml.org/lkml/2009/4/6/496
>> But old fix needs to hack into all architectures' idle loops.
>>
>> This is another try, it uses the fact that idle loops
>> are executing with preept_count()=1.
>> But I didn't look deep into all idle loops.
>
> Lai,
>
> Does this (with your patch) fix the bug you were seeing with the ring
> buffer code?
>
No, this can not fix the bug we found with the ring buffer code.
I think the bug is not come from this issue or from RCU.
Lai
>
>> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
>> ---
>> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
>> index 3ec8160..0761723 100644
>> --- a/kernel/rcutree.c
>> +++ b/kernel/rcutree.c
>> @@ -80,6 +80,10 @@ DEFINE_PER_CPU(struct rcu_data, rcu_sched_data);
>> struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
>> DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
>>
>> +#ifndef IDLE_CORE_LOOP_PREEMPT_COUNT
>> +#define IDLE_CORE_LOOP_PREEMPT_COUNT (1)
>> +#endif
>> +
>> /*
>> * Return true if an RCU grace period is in progress. The ACCESS_ONCE()s
>> * permit this function to be invoked without holding the root rcu_node
>> @@ -1114,6 +1118,26 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
>> raise_softirq(RCU_SOFTIRQ);
>> }
>>
>> +static inline int rcu_idle_qs(int cpu)
>> +{
>> + if (!idle_cpu(cpu))
>> + return 0;
>> +
>> + if (!rcu_scheduler_active)
>> + return 0;
>> +
>> + if (in_softirq())
>> + return 0;
>> +
>> + if (hardirq_count() > (1 << HARDIRQ_SHIFT))
>> + return 0;
>> +
>> + if ((preempt_count() & PREEMPT_MASK) > IDLE_CORE_LOOP_PREEMPT_COUNT)
>> + return 0;
>> +
>> + return 1;
>> +}
>> +
>> /*
>> * Check to see if this CPU is in a non-context-switch quiescent state
>> * (user mode or idle loop for rcu, non-softirq execution for rcu_bh).
>> @@ -1127,9 +1151,7 @@ void rcu_check_callbacks(int cpu, int user)
>> {
>> if (!rcu_pending(cpu))
>> return; /* if nothing for RCU to do. */
>> - if (user ||
>> - (idle_cpu(cpu) && rcu_scheduler_active &&
>> - !in_softirq() && hardirq_count() <= (1 << HARDIRQ_SHIFT))) {
>> + if (user || rcu_idle_qs(cpu)) {
>>
>> /*
>> * Get here if this CPU took its interrupt from user
>>
>
>
>
>
next prev parent reply other threads:[~2010-03-10 0:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 11:13 [RFC PATCH] rcu: don't ignore preempt_disable() in the idle loop Lai Jiangshan
2010-03-09 12:52 ` Steven Rostedt
2010-03-10 0:57 ` Lai Jiangshan [this message]
2010-03-10 13:51 ` Steven Rostedt
2010-03-10 0:54 ` Frederic Weisbecker
2010-03-10 1:30 ` Paul E. McKenney
2010-03-10 2:13 ` Lai Jiangshan
2010-03-10 2:28 ` Paul E. McKenney
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=4B96EE8A.5050003@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox