[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191126183334.GE2867037@devbig004.ftw2.facebook.com>
Date: Tue, 26 Nov 2019 10:33:34 -0800
From: Tejun Heo <tj@...nel.org>
To: "Paul E. McKenney" <paulmck@...nel.org>
Cc: jiangshanlai@...il.com, linux-kernel@...r.kernel.org
Subject: Re: Workqueues splat due to ending up on wrong CPU
Hello, Paul.
On Mon, Nov 25, 2019 at 03:03:12PM -0800, Paul E. McKenney wrote:
> I am seeing this occasionally during rcutorture runs in the presence
> of CPU hotplug. This is on v5.4-rc1 in process_one_work() at the first
> WARN_ON():
>
> WARN_ON_ONCE(!(pool->flags & POOL_DISASSOCIATED) &&
> raw_smp_processor_id() != pool->cpu);
Hmm... so it's saying that this worker's pool is supposed to be bound
to a cpu but it's currently running on the wrong cpu.
> What should I do to help further debug this?
Do you always see rescuer_thread in the backtrace? Can you please
apply the following patch and reproduce the problem?
Thanks.
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 914b845ad4ff..6f7f185cd146 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1842,13 +1842,18 @@ static struct worker *alloc_worker(int node)
static void worker_attach_to_pool(struct worker *worker,
struct worker_pool *pool)
{
+ int ret;
+
mutex_lock(&wq_pool_attach_mutex);
/*
* set_cpus_allowed_ptr() will fail if the cpumask doesn't have any
* online CPUs. It'll be re-applied when any of the CPUs come up.
*/
- set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask);
+ ret = set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask);
+ if (ret && !(pool->flags & POOL_DISASSOCIATED))
+ printk("XXX worker pid %d failed to attach to cpus of pool %d, ret=%d\n",
+ task_pid_nr(worker->task), pool->id, ret);
/*
* The wq_pool_attach_mutex ensures %POOL_DISASSOCIATED remains
@@ -2183,8 +2188,10 @@ __acquires(&pool->lock)
lockdep_copy_map(&lockdep_map, &work->lockdep_map);
#endif
/* ensure we're on the correct CPU */
- WARN_ON_ONCE(!(pool->flags & POOL_DISASSOCIATED) &&
- raw_smp_processor_id() != pool->cpu);
+ WARN_ONCE(!(pool->flags & POOL_DISASSOCIATED) &&
+ raw_smp_processor_id() != pool->cpu,
+ "expected on cpu %d but on cpu %d, pool %d, workfn=%pf\n",
+ pool->cpu, raw_smp_processor_id(), pool->id, work->func);
/*
* A single work shouldn't be executed concurrently by
--
tejun
Powered by blists - more mailing lists