Messages in this thread | | | Date | Mon, 15 Feb 2010 09:36:45 -0800 | From | "Paul E. McKenney" <> | Subject | Re: rcu_dereference() without protection in select_task_rq_fair() |
| |
On Mon, Feb 15, 2010 at 10:12:06AM +0100, Peter Zijlstra wrote: > On Sun, 2010-02-14 at 09:04 -0800, Paul E. McKenney wrote: > > > OK, but doesn't the "preempt_count() != 0" that is in the current version > > of rcu_read_lock_sched_held() already cover this check? > > Hmm, yes it should. > > > In other words, I believe that I have located a usage of for_each_domain() > > that violates the rule that it may only be called within preempt-disabled > > sections. > > >From the trace: > > > [<ffffffff81033ec4>] select_task_rq_fair+0xc1/0x686 > > [<ffffffff810353f4>] wake_up_new_task+0x1e/0x13e > > Which reads like: > > void wake_up_new_task(...) > { > ... > > int cpu __maybe_unused = get_cpu(); > > #ifdef CONFIG_SMP > /* > * Fork balancing, do it here and not earlier because: > * - cpus_allowed can change in the fork path > * - any previously selected cpu might disappear through hotplug > * > * We still have TASK_WAKING but PF_STARTING is gone now, meaning > * ->cpus_allowed is stable, we have preemption disabled, meaning > * cpu_online_mask is stable. > */ > cpu = select_task_rq(p, SD_BALANCE_FORK, 0); > set_task_cpu(p, cpu); > #endif > > ... > > put_cpu() > } > > I cannot see how we can get there without preemption disabled.
Interesting point. I have seen this but once. If it reproduces, I will instrument the code path and see if I can track it down.
Thanx, Paul
| |