[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <538E7ACB.3010704@cn.fujitsu.com>
Date: Wed, 4 Jun 2014 09:47:55 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: <jjherne@...ux.vnet.ibm.com>, Sasha Levin <sasha.levin@...cle.com>,
Tejun Heo <tj@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
Dave Jones <davej@...hat.com>, Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: workqueue: WARN at at kernel/workqueue.c:2176
On 06/03/2014 10:28 PM, Peter Zijlstra wrote:
> On Tue, Jun 03, 2014 at 08:45:39PM +0800, Lai Jiangshan wrote:
>>
>> Hi, Peter,
>>
>> I rewrote the analyse. (scheduler_ipi() must be called before stopper-task,
>> so the part for workqueue of the old analyse maybe be wrong.)
>
> But I don't think there is any guarantee we'll do the wakeup before
> running the stop work.
You are right, but the race window in my old analyse is too narrow to
hit the WARN_ON(). so I rewrote the new analyse showing a much bigger window
which can hit the WARN_ON() in workqueue.c
>
> Suppose the initial task gets queued, and the thing gets send the
> interrupt, meanwhile we'll do the stopper work wakeup !queueing, the
> set_cpus_allowed_ptr() isn't crossing llc boundaries.
>
> Now, the remote cpu preempts/schedules before the interrupt hits and
> runs the stop task.
>
> At which point we'll run __migrate_task() while the task is still queued
> on the wake list.
>
>> ---
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 268a45e..1a198a5 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -4530,7 +4530,7 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
>> goto out;
>>
>> dest_cpu = cpumask_any_and(cpu_active_mask, new_mask);
>> - if (p->on_rq) {
>> + if (p->on_rq || p->state == TASK_WAKING) {
>> struct migration_arg arg = { p, dest_cpu };
>> /* Need help from migration thread: drop lock and wait. */
>> task_rq_unlock(rq, p, &flags);
>
> So while this will close the window somewhat, I don't think its entirely
> closed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists