From: Gautham R Shenoy <ego@in.ibm.com>
To: Gregory Haskins <ghaskins@novell.com>
Cc: suresh.b.siddha@intel.com, rjw@sisk.pl,
akpm@linux-foundation.org, dmitry.adamushko@gmail.com,
mingo@elte.hu, oleg@sign.ru, yi.y.yang@intel.com,
linux-kernel@vger.kernel.org, tglx@linutronix.de
Subject: Re: [PATCH] keep rd->online and cpu_online_map in sync
Date: Mon, 10 Mar 2008 19:51:17 +0530 [thread overview]
Message-ID: <20080310142117.GG17646@in.ibm.com> (raw)
In-Reply-To: <20080310133755.4689.83217.stgit@novell1.haskins.net>
On Mon, Mar 10, 2008 at 09:39:34AM -0400, Gregory Haskins wrote:
> >>> On Mon, Mar 10, 2008 at 4:14 AM, in message
> <20080310081425.GA11031@in.ibm.com>, Gautham R Shenoy <ego@in.ibm.com> wrote:
>
> > On Sat, Mar 08, 2008 at 12:10:15AM -0500, Gregory Haskins wrote:
>
> [ snip ]
>
> >> @@ -5813,6 +5813,13 @@ migration_call(struct notifier_block *nfb, unsigned
> > long action, void *hcpu)
> >> /* Must be high prio: stop_machine expects to yield to it. */
> >> rq = task_rq_lock(p, &flags);
> >> __setscheduler(rq, p, SCHED_FIFO, MAX_RT_PRIO-1);
> >> +
> >> + /* Update our root-domain */
> >> + if (rq->rd) {
> >> + BUG_ON(!cpu_isset(cpu, rq->rd->span));
> >> + cpu_set(cpu, rq->rd->online);
> >> + }
> >
> > Hi Greg,
> >
> > Suppose someone issues a wakeup at some point between CPU_UP_PREPARE
> > and CPU_ONLINE, then isn't there a possibility that the task could
> > be woken up on the cpu which has not yet come online ?
> > Because at this point in find_lowest_cpus()
> >
> > cpus_and(*lowest_mask, task_rq(task)->rd->online, task->cpus_allowed);
> >
> > the cpu which has not yet come online is set in both rd->online map
> > and the task->cpus_allowed.
>
> Hi Gautham,
> This is a good point. I think I got it backwards (or rather, I had the ordering more correct before the patch): I really want to keep the set() on ONLINE as I had it originally. Its the clear() that is misplaced, as DOWN_PREPARE is too early in the chain. I probably should have used DYING to defer the clear out to the point right before the cpu_online_map is updated. Thanks to Dmitry for highlighting the smpboot path which helped me to find the proper notifier symbol.
I think CPU_DYING is a more apt point to clear the bit.
Vatsa had infact suggested that we do it in cpu_disable(), but since we
have an event, we might as well make use of it.
>
> >
> > I wonder if assigning a priority to the update_sched_domains() notifier
> > so that it's called immediately after migration_call() would solve the
> > problem.
>
> Possibly (and I just saw your patch). But note that migration_call was previously declared as "should run first" so I am not sure if moving update_sched_domain() above it will not have a ripple effect in some other area. If that is "ok", then I agree your solution solves the ordering problem, albeit in a bit heavy handed manner. Otherwise s/CPU_DOWN_PREPARE/CPU_DYING in migrate call will fix the issue as well, I believe. This will push the update of rd->online to be much more tightly coupled with updates to cpu_online_map.
The reason why migration_call() was declared as "should run first" was
to ensure that all the migration happens before the other subsystems run
their CPU_DEAD events. This is important, else when the subsystems issue
a kthread_stop(subsystem_thread) in their CPU_DEAD case, the
subsystem_thread might still be affined to the offlined cpu, thus
resulting in a deadlock.
That requirement is taken care of in the patch I had sent since
migration_call() will be called immediately after update_sched_domains().
>
> Ingo/Andrew: Please drop the earlier fix I submitted. I don't think it is correct on several fronts. Please try the one below. As before, I have tested that I can offline/online CPUs, but I dont have s2ram capability here.
>
> Regards,
> -Greg
>
> ---------------------------------------------
> keep rd->online and cpu_online_map in sync
>
> It is possible to allow the root-domain cache of online cpus to
> become out of sync with the global cpu_online_map. This is because we
> currently trigger removal of cpus too early in the notifier chain.
> Other DOWN_PREPARE handlers may in fact run and reconfigure the
> root-domain topology, thereby stomping on our own offline handling.
>
> The end result is that rd->online may become out of sync with
> cpu_online_map, which results in potential task misrouting.
>
> So change the offline handling to be more tightly coupled with the
> global offline process by triggering on CPU_DYING intead of
> CPU_DOWN_PREPARE.
>
> Signed-off-by: Gregory Haskins <ghaskins@novell.com>
> ---
>
> kernel/sched.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 52b9867..a616fa1 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -5881,7 +5881,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
> spin_unlock_irq(&rq->lock);
> break;
>
> - case CPU_DOWN_PREPARE:
> + case CPU_DYING:
> /* Update our root-domain */
> rq = cpu_rq(cpu);
> spin_lock_irqsave(&rq->lock, flags);
--
Thanks and Regards
gautham
next prev parent reply other threads:[~2008-03-10 14:21 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-02 18:42 [BUG 2.6.25-rc3] scheduler/hotplug: some processes are dealocked when cpu is set to offline Yi Yang
2008-03-03 11:54 ` Dmitry Adamushko
2008-03-03 11:56 ` Ingo Molnar
2008-03-03 12:02 ` Dmitry Adamushko
2008-03-03 14:53 ` Yi Yang
2008-03-03 17:37 ` Yi Yang
2008-03-03 15:31 ` Gautham R Shenoy
2008-03-03 14:45 ` Yi Yang
2008-03-04 5:26 ` Gautham R Shenoy
2008-03-04 9:09 ` Gautham R Shenoy
2008-03-03 21:56 ` Yi Yang
2008-03-04 15:01 ` Oleg Nesterov
2008-03-04 14:37 ` Yi Yang
2008-03-06 20:05 ` Yi Yang
2008-03-05 10:05 ` Gautham R Shenoy
2008-03-05 13:53 ` Oleg Nesterov
2008-03-06 11:15 ` Gautham R Shenoy
2008-03-06 12:22 ` Gautham R Shenoy
2008-03-06 13:44 ` Gautham R Shenoy
2008-03-07 2:54 ` Oleg Nesterov
2008-03-07 9:10 ` Gautham R Shenoy
2008-03-07 10:51 ` Gautham R Shenoy
2008-03-06 23:20 ` Yi Yang
2008-03-07 13:02 ` Dmitry Adamushko
2008-03-07 13:55 ` Gautham R Shenoy
2008-03-07 15:50 ` Gautham R Shenoy
2008-03-07 19:14 ` [BUG 2.6.25-rc3] scheduler/hotplug: some processes aredealocked " Suresh Siddha
2008-03-07 20:18 ` [BUG 2.6.25-rc3] scheduler/hotplug: some processes are dealocked " Andrew Morton
2008-03-07 21:36 ` Rafael J. Wysocki
2008-03-07 23:01 ` Suresh Siddha
2008-03-07 23:29 ` Andrew Morton
2008-03-07 23:43 ` Rafael J. Wysocki
2008-03-08 1:50 ` Suresh Siddha
2008-03-08 2:09 ` Andrew Morton
2008-03-08 5:10 ` [PATCH] adjust root-domain->online span in response to hotplug event Gregory Haskins
2008-03-08 8:41 ` Ingo Molnar
2008-03-08 17:50 ` [PATCH] adjust root-domain->online span in response to hotplugevent Gregory Haskins
2008-03-09 0:31 ` Dmitry Adamushko
2008-03-10 14:12 ` Gregory Haskins
2008-03-09 2:35 ` [PATCH] adjust root-domain->online span in response to hotplug event Suresh Siddha
2008-03-10 12:41 ` Gregory Haskins
2008-03-10 8:14 ` Gautham R Shenoy
2008-03-10 13:13 ` [PATCH] cpu-hotplug: Register update_sched_domains() notifier with higher prio Gautham R Shenoy
2008-03-10 22:25 ` Andrew Morton
2008-03-10 13:39 ` [PATCH] keep rd->online and cpu_online_map in sync Gregory Haskins
2008-03-10 14:21 ` Gautham R Shenoy [this message]
2008-03-10 18:12 ` Suresh Siddha
2008-03-10 22:03 ` Rafael J. Wysocki
2008-03-10 22:00 ` Gregory Haskins
2008-03-10 22:10 ` Suresh Siddha
2008-03-10 21:59 ` [PATCH v2] " Gregory Haskins
2008-03-10 23:36 ` Andrew Morton
2008-03-11 1:34 ` Suresh Siddha
2008-03-11 4:39 ` Gautham R Shenoy
-- strict thread matches above, loose matches on Subject: below --
2008-03-10 16:20 [PATCH] " Gregory Haskins
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=20080310142117.GG17646@in.ibm.com \
--to=ego@in.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dmitry.adamushko@gmail.com \
--cc=ghaskins@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@sign.ru \
--cc=rjw@sisk.pl \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=yi.y.yang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.