Re: [PATCH v2 2/2] Do not change worker's running cpu in cmci_rediscover().

From: Tang Chen
Date: Sun Oct 21 2012 - 23:34:26 EST


On 10/20/2012 01:21 AM, Luck, Tony wrote:
In this case, the following BUG_ON in try_to_wake_up_local() will be triggered:
BUG_ON(rq != this_rq());

Logically this looks OK - what is the test case to trigger this? I've done a moderate
amount of testing of cpu online/offline while injecting corrected errors (when testing
the CMCI storm patches) ... but didn't see this problem.

Hi Tony, Borislav,

Here is my case.

I have 2 nodes, node0 and node1. node1 could be hotpluged.
node0 has cpu0 ~ cpu15, node1 has cpu16 ~ cpu31.

I online all the cpus on node1, and hot-remove node1 directly.

When this problem is triggered, current is a work thread.

For example: cpu20 is dying. current is on cpu21, it migrates
itself to cpu22.

Assume current is process1, and it is a work thread.

cpu21 cpu22
p1:
....
cmci_rediscover()
|-set_cpus_allowed_ptr()
|-stop_one_cpu()
|-create a work to excute migration_cpu_stop()
|-wait_for_completion()
|-wait_for_common()
|-might_sleep()
Here, p1 gives up cpu21.

The work starts:
migration_cpu_stop()
|-migrate p1 to cpu22

On cpu22, p1 wakes up:
p1:
In wait_for_common()
|-do_wait_for_common()
|-schedule_timeout()
|-schedule()
|-__schedule()
|-try_to_wake_up_local()
|-wq_worker_sleeping()
|-BUG_ON(rq != this_rq())

On cpu22, wq_worker_sleeping() uses p1's worker_pool to find a worker
to go on to execute p1. But p1's worker_pool is on cpu21, and p1 is now
on cpu22. So the BUG_ON(rq != this_rq()) is triggered.

Thanks. :)


-Tony


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/