Re: [PATCH v3] CPU hotplug: active_writer not woken up in some cases - deadlock

2014-12-10 Thread Oleg Nesterov
On 12/10, David Hildenbrand wrote: > > > Why active_writer should see .puts_pending != 0 if this is called > > right after cpu_hotplug_begin() takes cpu_hotplug.lock but before > > it sets TASK_UNINTERRUPTIBLE? > > get_online_cpus() increased the refcount. > put_online_cpus() will increment puts_pe

Re: [PATCH v3] CPU hotplug: active_writer not woken up in some cases - deadlock

2014-12-09 Thread David Hildenbrand
> (sorry if this was already discussed, I ignored most of my emails > I got this week) > > On 12/09, David Hildenbrand wrote: > > > > @@ -116,7 +118,13 @@ void put_online_cpus(void) > > if (cpu_hotplug.active_writer == current) > > return; > > if (!mutex_trylock(&cpu_hotplug.l

Re: [PATCH v3] CPU hotplug: active_writer not woken up in some cases - deadlock

2014-12-09 Thread Paul E. McKenney
On Wed, Dec 10, 2014 at 01:26:19AM +0100, Oleg Nesterov wrote: > On 12/09, Paul E. McKenney wrote: > > > > Would wait_event()/wake_up() work for the wakeup-writer case? > > Yes, and in this case we could probably kill this puts_pending logic > and avoid cpu_hotplug.lock in put_online_cpus() altoge

Re: [PATCH v3] CPU hotplug: active_writer not woken up in some cases - deadlock

2014-12-09 Thread Oleg Nesterov
On 12/09, Paul E. McKenney wrote: > > Would wait_event()/wake_up() work for the wakeup-writer case? Yes, and in this case we could probably kill this puts_pending logic and avoid cpu_hotplug.lock in put_online_cpus() altogether? Can't we just make cpu_hotplug.refcount atomic_t? Anyway, this makes

Re: [PATCH v3] CPU hotplug: active_writer not woken up in some cases - deadlock

2014-12-09 Thread Oleg Nesterov
(sorry if this was already discussed, I ignored most of my emails I got this week) On 12/09, David Hildenbrand wrote: > > @@ -116,7 +118,13 @@ void put_online_cpus(void) > if (cpu_hotplug.active_writer == current) > return; > if (!mutex_trylock(&cpu_hotplug.lock)) { > +

Re: [PATCH v3] CPU hotplug: active_writer not woken up in some cases - deadlock

2014-12-09 Thread Paul E. McKenney
On Tue, Dec 09, 2014 at 05:24:27PM +0100, David Hildenbrand wrote: > > On Tue, Dec 09, 2014 at 01:23:31PM +0100, David Hildenbrand wrote: > > > Commit b2c4623dcd07 ("rcu: More on deadlock between CPU hotplug and > > > expedited > > > grace periods") introduced another problem that can easily be re

Re: [PATCH v3] CPU hotplug: active_writer not woken up in some cases - deadlock

2014-12-09 Thread David Hildenbrand
> On Tue, Dec 09, 2014 at 01:23:31PM +0100, David Hildenbrand wrote: > > Commit b2c4623dcd07 ("rcu: More on deadlock between CPU hotplug and > > expedited > > grace periods") introduced another problem that can easily be reproduced by > > starting/stopping cpus in a loop. > > > > E.g.: > > for

Re: [PATCH v3] CPU hotplug: active_writer not woken up in some cases - deadlock

2014-12-09 Thread Paul E. McKenney
On Tue, Dec 09, 2014 at 01:23:31PM +0100, David Hildenbrand wrote: > Commit b2c4623dcd07 ("rcu: More on deadlock between CPU hotplug and expedited > grace periods") introduced another problem that can easily be reproduced by > starting/stopping cpus in a loop. > > E.g.: > for i in `seq 5000`; do

[PATCH v3] CPU hotplug: active_writer not woken up in some cases - deadlock

2014-12-09 Thread David Hildenbrand
Commit b2c4623dcd07 ("rcu: More on deadlock between CPU hotplug and expedited grace periods") introduced another problem that can easily be reproduced by starting/stopping cpus in a loop. E.g.: for i in `seq 5000`; do echo 1 > /sys/devices/system/cpu/cpu1/online echo 0 > /sys/devices