Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257249
b: refs/heads/master
c: b8325c5
h: refs/heads/master
i:
  257247: 94f9a86
v: v3
  • Loading branch information
Hidetoshi Seto authored and Borislav Petkov committed Jun 16, 2011
1 parent 431e6da commit fbe876b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2b90e77eaee8809073db5cf43ac9795cc2054dc0
refs/heads/master: b8325c5b110d7ff460b79588e7e9afdcc73d5c3c
50 changes: 27 additions & 23 deletions trunk/arch/x86/kernel/cpu/mcheck/mce.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,31 @@ static void mce_wrmsrl(u32 msr, u64 v)
wrmsrl(msr, v);
}

/*
* Collect all global (w.r.t. this processor) status about this machine
* check into our "mce" struct so that we can use it later to assess
* the severity of the problem as we read per-bank specific details.
*/
static inline void mce_gather_info(struct mce *m, struct pt_regs *regs)
{
mce_setup(m);

m->mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS);
if (regs) {
/*
* Get the address of the instruction at the time of
* the machine check error.
*/
if (m->mcgstatus & (MCG_STATUS_RIPV|MCG_STATUS_EIPV)) {
m->ip = regs->ip;
m->cs = regs->cs;
}
/* Use accurate RIP reporting if available. */
if (rip_msr)
m->ip = mce_rdmsrl(rip_msr);
}
}

/*
* Simple lockless ring to communicate PFNs from the exception handler with the
* process context work function. This is vastly simplified because there's
Expand Down Expand Up @@ -439,24 +464,6 @@ static void mce_schedule_work(void)
}
}

/*
* Get the address of the instruction at the time of the machine check
* error.
*/
static inline void mce_get_rip(struct mce *m, struct pt_regs *regs)
{

if (regs && (m->mcgstatus & (MCG_STATUS_RIPV|MCG_STATUS_EIPV))) {
m->ip = regs->ip;
m->cs = regs->cs;
} else {
m->ip = 0;
m->cs = 0;
}
if (rip_msr)
m->ip = mce_rdmsrl(rip_msr);
}

DEFINE_PER_CPU(struct irq_work, mce_irq_work);

static void mce_irq_work_cb(struct irq_work *entry)
Expand Down Expand Up @@ -506,9 +513,8 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)

percpu_inc(mce_poll_count);

mce_setup(&m);
mce_gather_info(&m, NULL);

m.mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS);
for (i = 0; i < banks; i++) {
if (!mce_banks[i].ctl || !test_bit(i, *b))
continue;
Expand Down Expand Up @@ -907,9 +913,8 @@ void do_machine_check(struct pt_regs *regs, long error_code)
if (!banks)
goto out;

mce_setup(&m);
mce_gather_info(&m, regs);

m.mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS);
final = &__get_cpu_var(mces_seen);
*final = m;

Expand Down Expand Up @@ -993,7 +998,6 @@ void do_machine_check(struct pt_regs *regs, long error_code)
if (severity == MCE_AO_SEVERITY && mce_usable_address(&m))
mce_ring_add(m.addr >> PAGE_SHIFT);

mce_get_rip(&m, regs);
mce_log(&m);

if (severity > worst) {
Expand Down

0 comments on commit fbe876b

Please sign in to comment.