Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965115AbbFJPeI (ORCPT ); Wed, 10 Jun 2015 11:34:08 -0400 Received: from mail.skyhub.de ([78.46.96.112]:55259 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965061AbbFJPdx (ORCPT ); Wed, 10 Jun 2015 11:33:53 -0400 From: Borislav Petkov To: Aravind Gopalakrishnan Cc: linux-edac , LKML Subject: [PATCH 2/3] EDAC, mce_amd_inj: Move bit preparations before the injection Date: Wed, 10 Jun 2015 17:33:45 +0200 Message-Id: <1433950426-10084-2-git-send-email-bp@alien8.de> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1433950426-10084-1-git-send-email-bp@alien8.de> References: <1433950426-10084-1-git-send-email-bp@alien8.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1389 Lines: 47 From: Borislav Petkov We do get_online_cpus() and then start noodling with the bits. Do that *before* we grab the hotplug lock. This accidentally fixes the other issue where we check if a CPU is online but then go ahead and find out the NBC core which might not be the same CPU as the CPU we want to inject on. Signed-off-by: Borislav Petkov --- drivers/edac/mce_amd_inj.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c index 30227f30e7c6..5001d166f54f 100644 --- a/drivers/edac/mce_amd_inj.c +++ b/drivers/edac/mce_amd_inj.c @@ -266,10 +266,6 @@ static void do_inject(void) i_mce.status &= ~MCI_STATUS_UC; } - get_online_cpus(); - if (!cpu_online(cpu)) - goto err; - /* prep MCE global settings for the injection */ mcg_status = MCG_STATUS_MCIP | MCG_STATUS_EIPV; @@ -290,6 +286,10 @@ static void do_inject(void) cpu = get_nbc_for_node(amd_get_nb_id(cpu)); } + get_online_cpus(); + if (!cpu_online(cpu)) + goto err; + toggle_hw_mce_inject(cpu, true); wrmsr_on_cpu(cpu, MSR_IA32_MCG_STATUS, -- 2.3.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/