Bug 7786

Summary: CPU hotplug generates OOPS the second time a CPU is unplugged
Product: Platform Specific/Hardware Reporter: Mauro Carvalho Chehab (mchehab)
Component: x86-64Assignee: Andi Kleen (andi-bz)
Severity: low CC: akpm, pavel
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: Tree: Mainline
Regression: ---
Attachments: dmesg with the oops
This patch fixed the oops. However, kernel still complains about recursive locking

Description Mauro Carvalho Chehab 2007-01-07 12:29:38 UTC
Most recent kernel where this bug did *NOT* occur: none
Distribution: Mandriva 2007 Official
Hardware Environment: AMD 64 Dual Core 4200+

Problem Description:
The second trial to make the same CPU offline does generate an OOPS

Steps to reproduce:

echo 0 > /sys/devices/system/cpu/cpu1/online 
echo 1 > /sys/devices/system/cpu/cpu1/online 
echo 0 > /sys/devices/system/cpu/cpu1/online
Comment 1 Mauro Carvalho Chehab 2007-01-07 12:38:08 UTC
Created attachment 10020 [details]
dmesg  with the oops

I suspect that this trouble may be related to the circular dependency, as
reported by kernel:
[ INFO: possible circular locking dependency detected ] #1
stress/5670 is trying to acquire lock:
 (cpu_bitmask_lock){--..}, at: [<ffffffff8015af7d>] lock_cpu_hotplug+0x6d/0x80

but task is already holding lock:
 (workqueue_mutex){--..}, at: [<ffffffff8014962f>]

which lock already depends on the new lock.

stress is just a script doing echo to cpu hotplug sysfs interface:
	echo Making CPU online
	echo 0 >/sys/devices/system/cpu/cpu1/online
	echo Making CPU offline
	echo 1 >/sys/devices/system/cpu/cpu1/online
	echo Making CPU online
	echo 0 >/sys/devices/system/cpu/cpu1/online
Comment 2 Mauro Carvalho Chehab 2007-01-07 14:04:19 UTC
Created attachment 10025 [details]
This patch fixed the oops. However, kernel still complains about recursive locking
Comment 3 Mauro Carvalho Chehab 2007-01-07 14:08:18 UTC
Andrew Morton pointed to a patch from Christoph Lameter <clameter@sgi.com> that
fixes the issue. It would be better to have this patch applied to -stable.

After the patch, it still complains about bad locking.