public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: paulmck@linux.vnet.ibm.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: rcu_dereference() without protection in select_task_rq_fair()
Date: Mon, 15 Feb 2010 10:12:06 +0100	[thread overview]
Message-ID: <1266225126.5273.720.camel@laptop> (raw)
In-Reply-To: <20100214170409.GK7084@linux.vnet.ibm.com>

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.


  reply	other threads:[~2010-02-15  9:12 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 [this message]
2010-02-15 17:36       ` 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=1266225126.5273.720.camel@laptop \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    /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