All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Cc: linux-edac <linux-edac@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] EDAC, mce_amd_inj: Move bit preparations before the injection
Date: Wed, 10 Jun 2015 17:33:45 +0200	[thread overview]
Message-ID: <1433950426-10084-2-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1433950426-10084-1-git-send-email-bp@alien8.de>

From: Borislav Petkov <bp@suse.de>

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 <bp@suse.de>
---
 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


  reply	other threads:[~2015-06-10 15:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 15:33 [PATCH 1/3] EDAC, mce_amd_inj: Cleanup and simplify README Borislav Petkov
2015-06-10 15:33 ` Borislav Petkov [this message]
2015-06-10 15:33 ` [PATCH 3/3] EDAC, mce_amd_inj: Set MISCV on injection Borislav Petkov
2015-06-10 16:30   ` Aravind Gopalakrishnan
2015-06-10 16:51     ` Borislav Petkov
2015-06-13 14:11       ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433950426-10084-2-git-send-email-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.