public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: X86-ML <x86@kernel.org>, EDAC devel <linux-edac@vger.kernel.org>,
	Borislav Petkov <borislav.petkov@amd.com>
Subject: [PATCH 6/9] x86, MCE, AMD: Cleanup reading of error_count
Date: Thu, 10 May 2012 16:30:26 +0200	[thread overview]
Message-ID: <1336660229-32644-7-git-send-email-bp@amd64.org> (raw)
In-Reply-To: <1336660229-32644-1-git-send-email-bp@amd64.org>

From: Borislav Petkov <borislav.petkov@amd.com>

We have rdmsr_on_cpu() now so remove locally defined solution in favor
of the generic one.

No functionality change.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 arch/x86/kernel/cpu/mcheck/mce_amd.c |   23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 0b1bb0e15881..a7204ef37223 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -359,27 +359,14 @@ store_threshold_limit(struct threshold_block *b, const char *buf, size_t size)
 	return size;
 }
 
-struct threshold_block_cross_cpu {
-	struct threshold_block	*tb;
-	long			retval;
-};
-
-static void local_error_count_handler(void *_tbcc)
-{
-	struct threshold_block_cross_cpu *tbcc = _tbcc;
-	struct threshold_block *b = tbcc->tb;
-	u32 low, high;
-
-	rdmsr(b->address, low, high);
-	tbcc->retval = (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit);
-}
-
 static ssize_t show_error_count(struct threshold_block *b, char *buf)
 {
-	struct threshold_block_cross_cpu tbcc = { .tb = b, };
+	u32 lo, hi;
+
+	rdmsr_on_cpu(b->cpu, b->address, &lo, &hi);
 
-	smp_call_function_single(b->cpu, local_error_count_handler, &tbcc, 1);
-	return sprintf(buf, "%lu\n", tbcc.retval);
+	return sprintf(buf, "%u\n", ((hi & THRESHOLD_MAX) -
+				     (THRESHOLD_MAX - b->threshold_limit)));
 }
 
 static ssize_t store_error_count(struct threshold_block *b,
-- 
1.7.9.3.362.g71319


  parent reply	other threads:[~2012-05-10 14:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 14:30 [PATCH 0/9] x86, AMD, MCE: Thresholding cleanups Borislav Petkov
2012-05-10 14:30 ` [PATCH 1/9] x86, amd_nb: Export model 0x10 and later PCI id Borislav Petkov
2012-05-11  7:04   ` Clemens Ladisch
2012-05-10 14:30 ` [PATCH 2/9] x86, MCE, AMD: Remove shared banks sysfs linking Borislav Petkov
2012-05-10 14:30 ` [PATCH 3/9] x86, MCE, AMD: Remove local_allocate_... wrapper Borislav Petkov
2012-05-10 14:30 ` [PATCH 4/9] x86, MCE, AMD: Move shared bank to node descriptor Borislav Petkov
2012-05-10 14:30 ` [PATCH 5/9] x86, MCE, AMD: Print decimal thresholding values Borislav Petkov
2012-05-10 14:30 ` Borislav Petkov [this message]
2012-05-10 14:30 ` [PATCH 7/9] x86, MCE, AMD: Make error_count read only Borislav Petkov
2012-05-10 14:30 ` [PATCH 8/9] x86, MCE, AMD: Give proper names to the thresholding banks Borislav Petkov
2012-05-10 14:30 ` [PATCH 9/9] x86, MCE, AMD: Update copyrights and boilerplate 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=1336660229-32644-7-git-send-email-bp@amd64.org \
    --to=bp@amd64.org \
    --cc=borislav.petkov@amd.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox