linux/arch/x86/kernel/cpu/mtrr
Thomas Gleixner 84393817db x86/mtrr: Prevent CPU hotplug lock recursion
Larry reported a CPU hotplug lock recursion in the MTRR code.

============================================
WARNING: possible recursive locking detected

systemd-udevd/153 is trying to acquire lock:
 (cpu_hotplug_lock.rw_sem){.+.+.+}, at: [<c030fc26>] stop_machine+0x16/0x30
 
 but task is already holding lock:
  (cpu_hotplug_lock.rw_sem){.+.+.+}, at: [<c0234353>] mtrr_add_page+0x83/0x470

....

 cpus_read_lock+0x48/0x90
 stop_machine+0x16/0x30
 mtrr_add_page+0x18b/0x470
 mtrr_add+0x3e/0x70

mtrr_add_page() holds the hotplug rwsem already and calls stop_machine()
which acquires it again.

Call stop_machine_cpuslocked() instead.

Reported-and-tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1708140920250.1865@nanos
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Borislav Petkov <bp@suse.de>
2017-08-15 13:03:47 +02:00
..
amd.c x86, mtrr: Constify struct mtrr_ops 2010-02-01 11:20:43 -08:00
centaur.c x86/cpu: Convert printk(KERN_<LEVEL> ...) to pr_<level>(...) 2016-02-03 10:30:03 +01:00
cleanup.c x86/boot/e820: Prefix the E820_* type names with "E820_TYPE_" 2017-01-28 22:55:22 +01:00
cyrix.c x86/cpufeature: Remove cpu_has_pge 2016-03-31 13:35:09 +02:00
generic.c x86/kernel: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:41 +02:00
if.c x86: Audit and remove any remaining unnecessary uses of module.h 2016-07-14 15:07:00 +02:00
main.c x86/mtrr: Prevent CPU hotplug lock recursion 2017-08-15 13:03:47 +02:00
Makefile x86, mtrr: Remove unused mtrr/state.c 2010-02-04 10:01:38 +01:00
mtrr.h x86: Apply more __ro_after_init and const 2016-08-10 14:55:05 +02:00