From: Borislav Petkov <bp@alien8.de>
To: linux-edac <linux-edac@vger.kernel.org>
Cc: Tony Luck <tony.luck@intel.com>, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH -v3 1/4] x86, MCE: Make the mce_ring explicit
Date: Tue, 1 Jul 2014 21:23:40 +0200 [thread overview]
Message-ID: <1404242623-10094-2-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1404242623-10094-1-git-send-email-bp@alien8.de>
From: Borislav Petkov <bp@suse.de>
We would want to hand down a ring on which to operate so make it an
argument.
Use the obvious mce_ring_empty() in mce_ring_get() for better
readability.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/cpu/mcheck/mce.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 4fc57975acc1..4c0167070e2e 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -476,23 +476,21 @@ struct mce_ring {
static DEFINE_PER_CPU(struct mce_ring, mce_ring);
/* Runs with CPU affinity in workqueue */
-static int mce_ring_empty(void)
+static inline int mce_ring_empty(struct mce_ring *r)
{
- struct mce_ring *r = &__get_cpu_var(mce_ring);
-
return r->start == r->end;
}
-static int mce_ring_get(unsigned long *pfn)
+static int mce_ring_get(struct mce_ring *r, unsigned long *pfn)
{
- struct mce_ring *r;
int ret = 0;
*pfn = 0;
get_cpu();
- r = &__get_cpu_var(mce_ring);
- if (r->start == r->end)
+
+ if (mce_ring_empty(r))
goto out;
+
*pfn = r->ring[r->start];
r->start = (r->start + 1) % MCE_RING_SIZE;
ret = 1;
@@ -502,9 +500,8 @@ out:
}
/* Always runs in MCE context with preempt off */
-static int mce_ring_add(unsigned long pfn)
+static int mce_ring_add(struct mce_ring *r, unsigned long pfn)
{
- struct mce_ring *r = &__get_cpu_var(mce_ring);
unsigned next;
next = (r->end + 1) % MCE_RING_SIZE;
@@ -525,7 +522,7 @@ int mce_available(struct cpuinfo_x86 *c)
static void mce_schedule_work(void)
{
- if (!mce_ring_empty())
+ if (!mce_ring_empty(&__get_cpu_var(mce_ring)))
schedule_work(&__get_cpu_var(mce_work));
}
@@ -1122,7 +1119,8 @@ void do_machine_check(struct pt_regs *regs, long error_code)
* RED-PEN don't ignore overflow for mca_cfg.tolerant == 0
*/
if (severity == MCE_AO_SEVERITY && mce_usable_address(&m))
- mce_ring_add(m.addr >> PAGE_SHIFT);
+ mce_ring_add(&__get_cpu_var(mce_ring),
+ m.addr >> PAGE_SHIFT);
mce_log(&m);
@@ -1229,7 +1227,7 @@ static void mce_process_work(struct work_struct *dummy)
{
unsigned long pfn;
- while (mce_ring_get(&pfn))
+ while (mce_ring_get(&__get_cpu_var(mce_ring), &pfn))
memory_failure(pfn, MCE_VECTOR, 0);
}
--
2.0.0
next prev parent reply other threads:[~2014-07-01 19:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 19:23 [PATCH -v3 0/4] RAS: Correctable Errors Collector thing Borislav Petkov
2014-07-01 19:23 ` Borislav Petkov [this message]
2014-07-01 19:23 ` [PATCH -v3 2/4] RAS: Add a Corrected Errors Collector Borislav Petkov
2014-07-05 10:54 ` Borislav Petkov
2014-07-01 19:23 ` [PATCH -v3 3/4] MCE, CE: Wire in the CE collector Borislav Petkov
2014-07-07 17:00 ` Max Asbock
2014-07-07 22:09 ` Borislav Petkov
2014-07-01 19:23 ` [PATCH -v3 4/4] MCE, CE: Add debugging glue Borislav Petkov
[not found] ` <CAMY-HrCRS0RcBO0sMtwOKwYmS_+q89Kpr5Y0WyhpfQdapaQzLA@mail.gmail.com>
2014-12-17 2:26 ` [PATCH -v3 0/4] RAS: Correctable Errors Collector thing Calvin Owens
2014-12-17 21:17 ` 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=1404242623-10094-2-git-send-email-bp@alien8.de \
--to=bp@alien8.de \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/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