Commit d88203d1 authored by Thomas Gleixner's avatar Thomas Gleixner

x86: whitespace cleanup of mce_64.c

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 01e11182
...@@ -111,8 +111,7 @@ static void print_mce(struct mce *m) ...@@ -111,8 +111,7 @@ static void print_mce(struct mce *m)
"CPU %d: Machine Check Exception: %16Lx Bank %d: %016Lx\n", "CPU %d: Machine Check Exception: %16Lx Bank %d: %016Lx\n",
m->cpu, m->mcgstatus, m->bank, m->status); m->cpu, m->mcgstatus, m->bank, m->status);
if (m->rip) { if (m->rip) {
printk(KERN_EMERG printk(KERN_EMERG "RIP%s %02x:<%016Lx> ",
"RIP%s %02x:<%016Lx> ",
!(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "", !(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "",
m->cs, m->rip); m->cs, m->rip);
if (m->cs == __KERNEL_CS) if (m->cs == __KERNEL_CS)
...@@ -126,8 +125,8 @@ static void print_mce(struct mce *m) ...@@ -126,8 +125,8 @@ static void print_mce(struct mce *m)
printk("MISC %Lx ", m->misc); printk("MISC %Lx ", m->misc);
printk("\n"); printk("\n");
printk(KERN_EMERG "This is not a software problem!\n"); printk(KERN_EMERG "This is not a software problem!\n");
printk(KERN_EMERG printk(KERN_EMERG "Run through mcelog --ascii to decode "
"Run through mcelog --ascii to decode and contact your hardware vendor\n"); "and contact your hardware vendor\n");
} }
static void mce_panic(char *msg, struct mce *backup, unsigned long start) static void mce_panic(char *msg, struct mce *backup, unsigned long start)
...@@ -137,6 +136,7 @@ static void mce_panic(char *msg, struct mce *backup, unsigned long start) ...@@ -137,6 +136,7 @@ static void mce_panic(char *msg, struct mce *backup, unsigned long start)
oops_begin(); oops_begin();
for (i = 0; i < MCE_LOG_LEN; i++) { for (i = 0; i < MCE_LOG_LEN; i++) {
unsigned long tsc = mcelog.entry[i].tsc; unsigned long tsc = mcelog.entry[i].tsc;
if (time_before(tsc, start)) if (time_before(tsc, start))
continue; continue;
print_mce(&mcelog.entry[i]); print_mce(&mcelog.entry[i]);
...@@ -173,7 +173,6 @@ static inline void mce_get_rip(struct mce *m, struct pt_regs *regs) ...@@ -173,7 +173,6 @@ static inline void mce_get_rip(struct mce *m, struct pt_regs *regs)
/* /*
* The actual machine check handler * The actual machine check handler
*/ */
void do_machine_check(struct pt_regs * regs, long error_code) void do_machine_check(struct pt_regs * regs, long error_code)
{ {
struct mce m, panicm; struct mce m, panicm;
...@@ -194,7 +193,8 @@ void do_machine_check(struct pt_regs * regs, long error_code) ...@@ -194,7 +193,8 @@ void do_machine_check(struct pt_regs * regs, long error_code)
atomic_inc(&mce_entry); atomic_inc(&mce_entry);
if (regs) if (regs)
notify_die(DIE_NMI, "machine check", regs, error_code, 18, SIGKILL); notify_die(DIE_NMI, "machine check", regs, error_code, 18,
SIGKILL);
if (!banks) if (!banks)
goto out2; goto out2;
...@@ -372,7 +372,7 @@ static void mcheck_timer(struct work_struct *work) ...@@ -372,7 +372,7 @@ static void mcheck_timer(struct work_struct *work)
if (mce_notify_user()) { if (mce_notify_user()) {
next_interval = max(next_interval/2, HZ/100); next_interval = max(next_interval/2, HZ/100);
} else { } else {
next_interval = min(next_interval*2, next_interval = min(next_interval * 2,
(int)round_jiffies_relative(check_interval*HZ)); (int)round_jiffies_relative(check_interval*HZ));
} }
...@@ -556,10 +556,12 @@ static int mce_release(struct inode *inode, struct file *file) ...@@ -556,10 +556,12 @@ static int mce_release(struct inode *inode, struct file *file)
static void collect_tscs(void *data) static void collect_tscs(void *data)
{ {
unsigned long *cpu_tsc = (unsigned long *)data; unsigned long *cpu_tsc = (unsigned long *)data;
rdtscll(cpu_tsc[smp_processor_id()]); rdtscll(cpu_tsc[smp_processor_id()]);
} }
static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff_t *off) static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize,
loff_t *off)
{ {
unsigned long *cpu_tsc; unsigned long *cpu_tsc;
static DECLARE_MUTEX(mce_read_sem); static DECLARE_MUTEX(mce_read_sem);
...@@ -584,6 +586,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff ...@@ -584,6 +586,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff
err = 0; err = 0;
for (i = 0; i < next; i++) { for (i = 0; i < next; i++) {
unsigned long start = jiffies; unsigned long start = jiffies;
while (!mcelog.entry[i].finished) { while (!mcelog.entry[i].finished) {
if (time_after_eq(jiffies, start + 2)) { if (time_after_eq(jiffies, start + 2)) {
memset(mcelog.entry + i,0, sizeof(struct mce)); memset(mcelog.entry + i,0, sizeof(struct mce));
...@@ -603,13 +606,16 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff ...@@ -603,13 +606,16 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff
synchronize_sched(); synchronize_sched();
/* Collect entries that were still getting written before the synchronize. */ /*
* Collect entries that were still getting written before the
* synchronize.
*/
on_each_cpu(collect_tscs, cpu_tsc, 1, 1); on_each_cpu(collect_tscs, cpu_tsc, 1, 1);
for (i = next; i < MCE_LOG_LEN; i++) { for (i = next; i < MCE_LOG_LEN; i++) {
if (mcelog.entry[i].finished && if (mcelog.entry[i].finished &&
mcelog.entry[i].tsc < cpu_tsc[mcelog.entry[i].cpu]) { mcelog.entry[i].tsc < cpu_tsc[mcelog.entry[i].cpu]) {
err |= copy_to_user(buf, mcelog.entry+i, sizeof(struct mce)); err |= copy_to_user(buf, mcelog.entry+i,
sizeof(struct mce));
smp_rmb(); smp_rmb();
buf += sizeof(struct mce); buf += sizeof(struct mce);
memset(&mcelog.entry[i], 0, sizeof(struct mce)); memset(&mcelog.entry[i], 0, sizeof(struct mce));
...@@ -628,9 +634,11 @@ static unsigned int mce_poll(struct file *file, poll_table *wait) ...@@ -628,9 +634,11 @@ static unsigned int mce_poll(struct file *file, poll_table *wait)
return 0; return 0;
} }
static int mce_ioctl(struct inode *i, struct file *f,unsigned int cmd, unsigned long arg) static int mce_ioctl(struct inode *i, struct file *f,unsigned int cmd,
unsigned long arg)
{ {
int __user *p = (int __user *)arg; int __user *p = (int __user *)arg;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
switch (cmd) { switch (cmd) {
...@@ -640,6 +648,7 @@ static int mce_ioctl(struct inode *i, struct file *f,unsigned int cmd, unsigned ...@@ -640,6 +648,7 @@ static int mce_ioctl(struct inode *i, struct file *f,unsigned int cmd, unsigned
return put_user(MCE_LOG_LEN, p); return put_user(MCE_LOG_LEN, p);
case MCE_GETCLEAR_FLAGS: { case MCE_GETCLEAR_FLAGS: {
unsigned flags; unsigned flags;
do { do {
flags = mcelog.flags; flags = mcelog.flags;
} while (cmpxchg(&mcelog.flags, flags, 0) != flags); } while (cmpxchg(&mcelog.flags, flags, 0) != flags);
...@@ -681,7 +690,6 @@ void __init restart_mce(void) ...@@ -681,7 +690,6 @@ void __init restart_mce(void)
/* /*
* Old style boot options parsing. Only for compatibility. * Old style boot options parsing. Only for compatibility.
*/ */
static int __init mcheck_disable(char *str) static int __init mcheck_disable(char *str)
{ {
mce_dont_init = 1; mce_dont_init = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment