aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2017-05-24 04:15:30 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-05-26 04:10:43 -0400
commit1ba143a5216fb148211160a0ecc1f8d3f92f06bb (patch)
treee3aa79ee7f498f6931759b5acc454ed305d8eb3f
parent27d3b157fee0bad264eb745d5c547e2e0676f1a2 (diff)
perf/x86/intel: Drop get_online_cpus() in intel_snb_check_microcode()
If intel_snb_check_microcode() is invoked via microcode_init -> perf_check_microcode -> intel_snb_check_microcode then get_online_cpus() is invoked nested. This works with the current implementation of get_online_cpus() but prevents converting it to a percpu rwsem. intel_snb_check_microcode() is also invoked from intel_sandybridge_quirk() unprotected. Drop get_online_cpus() from intel_snb_check_microcode() and add it to intel_sandybridge_quirk() so both call sites are protected. Convert *_online_cpus() to the new interfaces while at it. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ingo Molnar <mingo@kernel.org> Acked-by: Borislav Petkov <bp@suse.de> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Borislav Petkov <bp@alien8.de> Link: http://lkml.kernel.org/r/20170524081548.594862191@linutronix.de
-rw-r--r--arch/x86/events/intel/core.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index a6d91d4e37a1..b9174aacf42f 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3410,12 +3410,10 @@ static void intel_snb_check_microcode(void)
3410 int pebs_broken = 0; 3410 int pebs_broken = 0;
3411 int cpu; 3411 int cpu;
3412 3412
3413 get_online_cpus();
3414 for_each_online_cpu(cpu) { 3413 for_each_online_cpu(cpu) {
3415 if ((pebs_broken = intel_snb_pebs_broken(cpu))) 3414 if ((pebs_broken = intel_snb_pebs_broken(cpu)))
3416 break; 3415 break;
3417 } 3416 }
3418 put_online_cpus();
3419 3417
3420 if (pebs_broken == x86_pmu.pebs_broken) 3418 if (pebs_broken == x86_pmu.pebs_broken)
3421 return; 3419 return;
@@ -3488,7 +3486,9 @@ static bool check_msr(unsigned long msr, u64 mask)
3488static __init void intel_sandybridge_quirk(void) 3486static __init void intel_sandybridge_quirk(void)
3489{ 3487{
3490 x86_pmu.check_microcode = intel_snb_check_microcode; 3488 x86_pmu.check_microcode = intel_snb_check_microcode;
3489 cpus_read_lock();
3491 intel_snb_check_microcode(); 3490 intel_snb_check_microcode();
3491 cpus_read_unlock();
3492} 3492}
3493 3493
3494static const struct { int id; char *name; } intel_arch_events_map[] __initconst = { 3494static const struct { int id; char *name; } intel_arch_events_map[] __initconst = {
@@ -4112,13 +4112,12 @@ static __init int fixup_ht_bug(void)
4112 4112
4113 lockup_detector_resume(); 4113 lockup_detector_resume();
4114 4114
4115 get_online_cpus(); 4115 cpus_read_lock();
4116 4116
4117 for_each_online_cpu(c) { 4117 for_each_online_cpu(c)
4118 free_excl_cntrs(c); 4118 free_excl_cntrs(c);
4119 }
4120 4119
4121 put_online_cpus(); 4120 cpus_read_unlock();
4122 pr_info("PMU erratum BJ122, BV98, HSD29 workaround disabled, HT off\n"); 4121 pr_info("PMU erratum BJ122, BV98, HSD29 workaround disabled, HT off\n");
4123 return 0; 4122 return 0;
4124} 4123}