rcu: More on deadlock between CPU hotplug and expedited grace periods
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 22 Oct 2014 17:00:05 +0000 (10:00 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 23 Oct 2014 14:51:17 +0000 (07:51 -0700)
commitb2c4623dcd07af4b8ae3b56ae5f879e281c7b4f8
tree8a0aaf80f950011fafb6743d42457a22412ae6dd
parentf114040e3ea6e07372334ade75d1ee0775c355e1
rcu: More on deadlock between CPU hotplug and expedited grace periods

Commit dd56af42bd82 (rcu: Eliminate deadlock between CPU hotplug and
expedited grace periods) was incomplete.  Although it did eliminate
deadlocks involving synchronize_sched_expedited()'s acquisition of
cpu_hotplug.lock via get_online_cpus(), it did nothing about the similar
deadlock involving acquisition of this same lock via put_online_cpus().
This deadlock became apparent with testing involving hibernation.

This commit therefore changes put_online_cpus() acquisition of this lock
to be conditional, and increments a new cpu_hotplug.puts_pending field
in case of acquisition failure.  Then cpu_hotplug_begin() checks for this
new field being non-zero, and applies any changes to cpu_hotplug.refcount.

Reported-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Jiri Kosina <jkosina@suse.cz>
Tested-by: Borislav Petkov <bp@suse.de>
kernel/cpu.c