public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: rcu_dereference() without protection in select_task_rq_fair()
Date: Mon, 15 Feb 2010 09:36:45 -0800	[thread overview]
Message-ID: <20100215173645.GA6750@linux.vnet.ibm.com> (raw)
In-Reply-To: <1266225126.5273.720.camel@laptop>

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

      reply	other threads:[~2010-02-15 17:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 16:52 rcu_dereference() without protection in select_task_rq_fair() Paul E. McKenney
2010-02-14 10:12 ` Peter Zijlstra
2010-02-14 17:04   ` Paul E. McKenney
2010-02-15  9:12     ` Peter Zijlstra
2010-02-15 17:36       ` Paul E. McKenney [this message]

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=20100215173645.GA6750@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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