From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S945002AbdDTLaL (ORCPT ); Thu, 20 Apr 2017 07:30:11 -0400 Received: from terminus.zytor.com ([65.50.211.136]:49599 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S944421AbdDTLaI (ORCPT ); Thu, 20 Apr 2017 07:30:08 -0400 Date: Thu, 20 Apr 2017 04:26:29 -0700 From: tip-bot for Sebastian Andrzej Siewior Message-ID: Cc: bp@suse.de, tglx@linutronix.de, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, bp@alien8.de, rostedt@goodmis.org Reply-To: bp@suse.de, peterz@infradead.org, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org, rostedt@goodmis.org, bp@alien8.de, tglx@linutronix.de, bigeasy@linutronix.de In-Reply-To: <20170418170553.713742599@linutronix.de> References: <20170418170553.713742599@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] perf/x86/intel: Drop get_online_cpus() in intel_snb_check_microcode() Git-Commit-ID: 494d8679788930b29e1262d92db4c1912bdf9119 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 494d8679788930b29e1262d92db4c1912bdf9119 Gitweb: http://git.kernel.org/tip/494d8679788930b29e1262d92db4c1912bdf9119 Author: Sebastian Andrzej Siewior AuthorDate: Tue, 18 Apr 2017 19:04:58 +0200 Committer: Thomas Gleixner CommitDate: Thu, 20 Apr 2017 13:08:55 +0200 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. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Acked-by: Borislav Petkov Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Borislav Petkov Link: http://lkml.kernel.org/r/20170418170553.713742599@linutronix.de --- arch/x86/events/intel/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index eb1484c..152b7e4 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3389,12 +3389,10 @@ static void intel_snb_check_microcode(void) int pebs_broken = 0; int cpu; - get_online_cpus(); for_each_online_cpu(cpu) { if ((pebs_broken = intel_snb_pebs_broken(cpu))) break; } - put_online_cpus(); if (pebs_broken == x86_pmu.pebs_broken) return; @@ -3467,7 +3465,9 @@ static bool check_msr(unsigned long msr, u64 mask) static __init void intel_sandybridge_quirk(void) { x86_pmu.check_microcode = intel_snb_check_microcode; + get_online_cpus(); intel_snb_check_microcode(); + put_online_cpus(); } static const struct { int id; char *name; } intel_arch_events_map[] __initconst = {