Loading arch/x86/kernel/cpu/mcheck/mce_64.c +86 −78 Original line number Diff line number Diff line Loading @@ -111,8 +111,7 @@ static void print_mce(struct mce *m) "CPU %d: Machine Check Exception: %16Lx Bank %d: %016Lx\n", m->cpu, m->mcgstatus, m->bank, m->status); if (m->rip) { printk(KERN_EMERG "RIP%s %02x:<%016Lx> ", printk(KERN_EMERG "RIP%s %02x:<%016Lx> ", !(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "", m->cs, m->rip); if (m->cs == __KERNEL_CS) Loading @@ -126,8 +125,8 @@ static void print_mce(struct mce *m) printk("MISC %Lx ", m->misc); printk("\n"); printk(KERN_EMERG "This is not a software problem!\n"); printk(KERN_EMERG "Run through mcelog --ascii to decode and contact your hardware vendor\n"); printk(KERN_EMERG "Run through mcelog --ascii to decode " "and contact your hardware vendor\n"); } static void mce_panic(char *msg, struct mce *backup, unsigned long start) Loading @@ -137,6 +136,7 @@ static void mce_panic(char *msg, struct mce *backup, unsigned long start) oops_begin(); for (i = 0; i < MCE_LOG_LEN; i++) { unsigned long tsc = mcelog.entry[i].tsc; if (time_before(tsc, start)) continue; print_mce(&mcelog.entry[i]); Loading Loading @@ -173,7 +173,6 @@ static inline void mce_get_rip(struct mce *m, struct pt_regs *regs) /* * The actual machine check handler */ void do_machine_check(struct pt_regs * regs, long error_code) { struct mce m, panicm; Loading @@ -194,7 +193,8 @@ void do_machine_check(struct pt_regs * regs, long error_code) atomic_inc(&mce_entry); 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) goto out2; Loading Loading @@ -556,10 +556,12 @@ static int mce_release(struct inode *inode, struct file *file) static void collect_tscs(void *data) { unsigned long *cpu_tsc = (unsigned long *)data; 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; static DECLARE_MUTEX(mce_read_sem); Loading @@ -584,6 +586,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff err = 0; for (i = 0; i < next; i++) { unsigned long start = jiffies; while (!mcelog.entry[i].finished) { if (time_after_eq(jiffies, start + 2)) { memset(mcelog.entry + i,0, sizeof(struct mce)); Loading @@ -603,13 +606,16 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff 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); for (i = next; i < MCE_LOG_LEN; i++) { if (mcelog.entry[i].finished && 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(); buf += sizeof(struct mce); memset(&mcelog.entry[i], 0, sizeof(struct mce)); Loading @@ -628,9 +634,11 @@ static unsigned int mce_poll(struct file *file, poll_table *wait) 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; if (!capable(CAP_SYS_ADMIN)) return -EPERM; switch (cmd) { Loading @@ -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); case MCE_GETCLEAR_FLAGS: { unsigned flags; do { flags = mcelog.flags; } while (cmpxchg(&mcelog.flags, flags, 0) != flags); Loading Loading @@ -681,7 +690,6 @@ void __init restart_mce(void) /* * Old style boot options parsing. Only for compatibility. */ static int __init mcheck_disable(char *str) { mce_dont_init = 1; Loading Loading
arch/x86/kernel/cpu/mcheck/mce_64.c +86 −78 Original line number Diff line number Diff line Loading @@ -111,8 +111,7 @@ static void print_mce(struct mce *m) "CPU %d: Machine Check Exception: %16Lx Bank %d: %016Lx\n", m->cpu, m->mcgstatus, m->bank, m->status); if (m->rip) { printk(KERN_EMERG "RIP%s %02x:<%016Lx> ", printk(KERN_EMERG "RIP%s %02x:<%016Lx> ", !(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "", m->cs, m->rip); if (m->cs == __KERNEL_CS) Loading @@ -126,8 +125,8 @@ static void print_mce(struct mce *m) printk("MISC %Lx ", m->misc); printk("\n"); printk(KERN_EMERG "This is not a software problem!\n"); printk(KERN_EMERG "Run through mcelog --ascii to decode and contact your hardware vendor\n"); printk(KERN_EMERG "Run through mcelog --ascii to decode " "and contact your hardware vendor\n"); } static void mce_panic(char *msg, struct mce *backup, unsigned long start) Loading @@ -137,6 +136,7 @@ static void mce_panic(char *msg, struct mce *backup, unsigned long start) oops_begin(); for (i = 0; i < MCE_LOG_LEN; i++) { unsigned long tsc = mcelog.entry[i].tsc; if (time_before(tsc, start)) continue; print_mce(&mcelog.entry[i]); Loading Loading @@ -173,7 +173,6 @@ static inline void mce_get_rip(struct mce *m, struct pt_regs *regs) /* * The actual machine check handler */ void do_machine_check(struct pt_regs * regs, long error_code) { struct mce m, panicm; Loading @@ -194,7 +193,8 @@ void do_machine_check(struct pt_regs * regs, long error_code) atomic_inc(&mce_entry); 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) goto out2; Loading Loading @@ -556,10 +556,12 @@ static int mce_release(struct inode *inode, struct file *file) static void collect_tscs(void *data) { unsigned long *cpu_tsc = (unsigned long *)data; 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; static DECLARE_MUTEX(mce_read_sem); Loading @@ -584,6 +586,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff err = 0; for (i = 0; i < next; i++) { unsigned long start = jiffies; while (!mcelog.entry[i].finished) { if (time_after_eq(jiffies, start + 2)) { memset(mcelog.entry + i,0, sizeof(struct mce)); Loading @@ -603,13 +606,16 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff 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); for (i = next; i < MCE_LOG_LEN; i++) { if (mcelog.entry[i].finished && 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(); buf += sizeof(struct mce); memset(&mcelog.entry[i], 0, sizeof(struct mce)); Loading @@ -628,9 +634,11 @@ static unsigned int mce_poll(struct file *file, poll_table *wait) 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; if (!capable(CAP_SYS_ADMIN)) return -EPERM; switch (cmd) { Loading @@ -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); case MCE_GETCLEAR_FLAGS: { unsigned flags; do { flags = mcelog.flags; } while (cmpxchg(&mcelog.flags, flags, 0) != flags); Loading Loading @@ -681,7 +690,6 @@ void __init restart_mce(void) /* * Old style boot options parsing. Only for compatibility. */ static int __init mcheck_disable(char *str) { mce_dont_init = 1; Loading