lkml.org 
[lkml]   [2015]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 12/13] stop_machine: Remove lglock
On Tue, Jun 23, 2015 at 12:21:52AM +0200, Oleg Nesterov wrote:

> Suppose that stop_two_cpus(cpu1 => 0, cpu2 => 1) races with stop_machine().
>
> - stop_machine takes the lock on CPU 0, adds the work
> and drops the lock
>
> - cpu_stop_queue_work() queues both works

cpu_stop_queue_work() only ever queues _1_ work.

> - stop_machine takes the lock on CPU 1, etc
>
> In this case both CPU 0 and 1 will run multi_cpu_stop() but they will
> use different multi_stop_data's, so they will wait for each other
> forever?

So what you're saying is:

queue_stop_cpus_work() stop_two_cpus()

cpu_stop_queue_work(0,..);
spin_lock(0);
spin_lock(1);

__cpu_stop_queue_work(0,..);
__cpu_stop_queue_work(1,..);

spin_unlock(1);
spin_unlock(0);
cpu_stop_queue_work(1,..);

Indeed, I don't know what I was thinking...

We can of course slap a percpu-rwsem in, but I wonder if there's
anything smarter we can do here.


\
 
 \ /
  Last update: 2015-06-23 12:21    [W:0.307 / U:1.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site