x86/debug changes for v3.6
Subsystems (6)
Linus,
Please pull the latest x86-debug-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-debug-for-linus
HEAD: 0fa0e2f02e8edfbdb5f86d1cab0fa6dc0517489f x86: Move call to print_modules() out of show_regs()
Thanks,
Ingo
------------------>
Jan Beulich (3):
x86/microcode: Mark microcode_id[] as __initconst x86/mm: Mark free_initrd_mem() as __init
x86: Move call to print_modules() out of show_regs()
Joe Perches (1):
x86/debug: Add KERN_<LEVEL> to bare printks, convert printks to pr_<level>
Li Zhong (1):
x86/nmi: Clean up register_nmi_handler() usage
Steven Rostedt (3):
x86: Save cr2 in NMI in case NMIs take a page fault
x86: Remove cmpxchg from i386 NMI nesting code
x86: Save cr2 in NMI in case NMIs take a page fault (for i386)
arch/x86/include/asm/floppy.h | 2 +- arch/x86/include/asm/nmi.h | 20 +------ arch/x86/include/asm/pci_x86.h | 8 ++- arch/x86/include/asm/pgtable-2level.h | 4 +- arch/x86/include/asm/pgtable-3level.h | 6 +- arch/x86/include/asm/pgtable_64.h | 8 +-- arch/x86/kernel/alternative.c | 17 ++++-- arch/x86/kernel/amd_nb.c | 10 ++-- arch/x86/kernel/apic/io_apic.c | 38 ++++++------- arch/x86/kernel/apic/summit_32.c | 22 +++++--- arch/x86/kernel/apm_32.c | 29 +++++----- arch/x86/kernel/cpu/bugs.c | 20 +++---- arch/x86/kernel/cpu/mcheck/mce.c | 22 ++++---- arch/x86/kernel/cpu/perf_event_intel.c | 14 +++-- arch/x86/kernel/dumpstack.c | 5 +- arch/x86/kernel/dumpstack_32.c | 25 ++++---- arch/x86/kernel/dumpstack_64.c | 21 ++++--- arch/x86/kernel/entry_64.S | 20 +++++++ arch/x86/kernel/irq.c | 4 +- arch/x86/kernel/microcode_core.c | 2 +- arch/x86/kernel/module.c | 32 +++++++---- arch/x86/kernel/nmi.c | 47 +++++++++++----- arch/x86/kernel/nmi_selftest.c | 7 ++- arch/x86/kernel/pci-calgary_64.c | 34 ++++++----- arch/x86/kernel/process.c | 34 ++++++----- arch/x86/kernel/process_64.c | 8 +-- arch/x86/kernel/reboot.c | 14 +++-- arch/x86/kernel/signal.c | 5 +- arch/x86/kernel/smpboot.c | 97 +++++++++++++++----------------- arch/x86/kernel/traps.c | 19 ++++--- arch/x86/kernel/tsc.c | 50 ++++++++-------- arch/x86/kernel/vm86_32.c | 6 +- arch/x86/kernel/vsyscall_64.c | 17 +++--- arch/x86/kernel/xsave.c | 12 ++-- arch/x86/mm/init.c | 2 +- 35 files changed, 364 insertions(+), 317 deletions(-)
arch/x86/include/asm/floppy.h +1 -1
@@ -99,7 +99,7 @@ static irqreturn_t floppy_hardint(int irq, void *dev_id) virtual_dma_residue += virtual_dma_count; virtual_dma_count =0 ;#ifdef TRACE_FLPY_INT -printk ("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n" , +printk (KERN_DEBUG "count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n" , virtual_dma_count, virtual_dma_residue, calls, bytes, dma_wait); calls =0 ;
arch/x86/include/asm/nmi.h +3 -17
@@ -44,28 +44,14 @@ struct nmiaction {const char *name; }; -#define register_nmi_handler (t, fn, fg, n) \ +#define register_nmi_handler(t, fn, fg, n, init...) \ ({ \ - static struct nmiaction fn##_na = { \ + static struct nmiaction init fn##_na = { \ .handler = (fn), \ .name = (n), \ .flags = (fg), \ }; \ - __register_nmi_handler((t), &fn##_na); \ -}) - -/* -* For special handlers that register/unregister in the -* init section only. This should be considered rare. -*/ -#define register_nmi_handler_initonly (t, fn, fg, n) \ -({ \ - static struct nmiaction fn##_na __initdata = { \ - .handler = (fn), \ - .name = (n), \ - .flags = (fg), \ - }; \ - __register_nmi_handler((t), &fn##_na); \ + __register_nmi_handler((t), &fn##_na); \ })int __register_nmi_handler (unsigned int ,struct nmiaction *);
arch/x86/include/asm/pci_x86.h +6 -2
@@ -7,9 +7,13 @@#undef DEBUG#ifdef DEBUG -#define DBG(x...) printk(x) +#define DBG (fmt, ...) printk(fmt, ##__VA_ARGS__)#else -#define DBG(x...) +#define DBG (fmt, ...) \ +do { \ + if (0) \ + printk(fmt, ##__VA_ARGS__); \ +} while (0)#endif #define PCI_PROBE_BIOS 0x0001
arch/x86/include/asm/pgtable-2level.h +2 -2
@@ -2,9 +2,9 @@#define _ASM_X86_PGTABLE_2LEVEL_H#define pte_ERROR (e) \ - printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low) + pr_err("%s:%d: bad pte %08lx\n", __FILE__, __LINE__, (e).pte_low)#define pgd_ERROR (e) \ - printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) + pr_err("%s:%d: bad pgd %08lx\n", __FILE__, __LINE__, pgd_val(e))/* * Certain architectures need to do special things when PTEs
arch/x86/include/asm/pgtable-3level.h +3 -3
@@ -9,13 +9,13 @@*/ #define pte_ERROR (e) \ - printk("%s:%d: bad pte %p(%08lx%08lx).\n", \ + pr_err("%s:%d: bad pte %p(%08lx%08lx)\n", \ __FILE__, __LINE__, &(e), (e).pte_high, (e).pte_low)#define pmd_ERROR (e) \ - printk("%s:%d: bad pmd %p(%016Lx).\n", \ + pr_err("%s:%d: bad pmd %p(%016Lx)\n", \ __FILE__, __LINE__, &(e), pmd_val(e))#define pgd_ERROR (e) \ - printk("%s:%d: bad pgd %p(%016Lx).\n", \ + pr_err("%s:%d: bad pgd %p(%016Lx)\n", \ __FILE__, __LINE__, &(e), pgd_val(e))/* Rules for using set_pte: the pte being assigned *must* be
arch/x86/include/asm/pgtable_64.h +4 -4
@@ -26,16 +26,16 @@ extern pgd_t init_level4_pgt[];extern void paging_init (void );#define pte_ERROR (e) \ - printk("%s:%d: bad pte %p(%016lx).\n", \ + pr_err("%s:%d: bad pte %p(%016lx)\n", \ __FILE__, __LINE__, &(e), pte_val(e))#define pmd_ERROR (e) \ - printk("%s:%d: bad pmd %p(%016lx).\n", \ + pr_err("%s:%d: bad pmd %p(%016lx)\n", \ __FILE__, __LINE__, &(e), pmd_val(e))#define pud_ERROR (e) \ - printk("%s:%d: bad pud %p(%016lx).\n", \ + pr_err("%s:%d: bad pud %p(%016lx)\n", \ __FILE__, __LINE__, &(e), pud_val(e))#define pgd_ERROR (e) \ - printk("%s:%d: bad pgd %p(%016lx).\n", \ + pr_err("%s:%d: bad pgd %p(%016lx)\n", \ __FILE__, __LINE__, &(e), pgd_val(e))struct mm_struct ;
arch/x86/kernel/alternative.c +11 -6
@@ -1,3 +1,5 @@ +#define pr_fmt (fmt) "SMP alternatives: " fmt +#include <linux/module.h> #include <linux/sched.h> #include <linux/mutex.h>
@@ -63,8 +65,11 @@ static int __init setup_noreplace_paravirt(char *str)__setup ("noreplace-paravirt" , setup_noreplace_paravirt);#endif -#define DPRINTK(fmt, args...) if (debug_alternative) \ - printk(KERN_DEBUG fmt, args) +#define DPRINTK (fmt, ...) \ +do { \ + if (debug_alternative) \ + printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ +} while (0)/* * Each GENERIC_NOPX is of X bytes, and defined as an array of bytes
@@ -428,7 +433,7 @@ void alternatives_smp_switch(int smp)* If this still occurs then you should see a hang * or crash shortly after this line: */ -printk ("lockdep: fixing up alternatives.\n" ); +pr_info ("lockdep: fixing up alternatives\n" );#endif if (noreplace_smp || smp_alt_once || skip_smp_alternatives)
@@ -444,14 +449,14 @@ void alternatives_smp_switch(int smp)if (smp == smp_mode) {/* nothing */ }else if (smp) { -printk (KERN_INFO "SMP alternatives: switching to SMP code\n" ); +pr_info ("switching to SMP code\n" );clear_cpu_cap (&boot_cpu_data,X86_FEATURE_UP );clear_cpu_cap (&cpu_data (0 ),X86_FEATURE_UP );list_for_each_entry (mod, &smp_alt_modules, next)alternatives_smp_lock (mod->locks, mod->locks_end, mod->text, mod->text_end); }else { -printk (KERN_INFO "SMP alternatives: switching to UP code\n" ); +pr_info ("switching to UP code\n" );set_cpu_cap (&boot_cpu_data,X86_FEATURE_UP );set_cpu_cap (&cpu_data (0 ),X86_FEATURE_UP );list_for_each_entry (mod, &smp_alt_modules, next)
@@ -546,7 +551,7 @@ void __init alternative_instructions(void)#ifdef CONFIG_SMP if (smp_alt_once) {if (1 ==num_possible_cpus ()) { -printk (KERN_INFO "SMP alternatives: switching to UP code\n" ); +pr_info ("switching to UP code\n" );set_cpu_cap (&boot_cpu_data,X86_FEATURE_UP );set_cpu_cap (&cpu_data (0 ),X86_FEATURE_UP );
arch/x86/kernel/amd_nb.c +6 -4
@@ -2,6 +2,9 @@* Shared support code for AMD K8 northbridges and derivates. * Copyright 2006 Andi Kleen, SUSE Labs. Subject to GPLv2. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/types.h> #include <linux/slab.h> #include <linux/init.h>
@@ -258,7 +261,7 @@ void amd_flush_garts(void) }spin_unlock_irqrestore (&gart_lock, flags);if (!flushed) -printk ("nothing to flush?\n" ); +pr_notice ("nothing to flush?\n" ); }EXPORT_SYMBOL_GPL (amd_flush_garts);
@@ -269,11 +272,10 @@ static __init int init_amd_nbs(void) err =amd_cache_northbridges ();if (err <0 ) -printk (KERN_NOTICE "AMD NB: Cannot enumerate AMD northbridges.\n" ); +pr_notice ("Cannot enumerate AMD northbridges\n" );if (amd_cache_gart () <0 ) -printk (KERN_NOTICE "AMD NB: Cannot initialize GART flush words, " -"GART support disabled.\n" ); +pr_notice ("Cannot initialize GART flush words, GART support disabled\n" );return err; }
arch/x86/kernel/apic/io_apic.c +19 -19
@@ -448,8 +448,8 @@ static int __add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pi entry =alloc_irq_pin_list (node);if (!entry) { -printk (KERN_ERR "can not alloc irq_pin_list (%d,%d,%d)\n" , - node, apic, pin); +pr_err ("can not alloc irq_pin_list (%d,%d,%d)\n" , + node, apic, pin);return -ENOMEM ; } entry->apic = apic;
@@ -661,7 +661,7 @@ static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)ioapic_mask_entry (apic, pin); entry =ioapic_read_entry (apic, pin);if (entry.irr) -printk (KERN_ERR "Unable to reset IRR for apic: %d, pin :%d\n" , +pr_err ("Unable to reset IRR for apic: %d, pin :%d\n" ,mpc_ioapic_id (apic), pin); }
@@ -895,7 +895,7 @@ static int irq_polarity(int idx) }case 2 :/* reserved */ { -printk (KERN_WARNING "broken BIOS!!\n" ); +pr_warn ("broken BIOS!!\n" ); polarity =1 ;break ; }
@@ -906,7 +906,7 @@ static int irq_polarity(int idx) }default :/* invalid */ { -printk (KERN_WARNING "broken BIOS!!\n" ); +pr_warn ("broken BIOS!!\n" ); polarity =1 ;break ; }
@@ -948,7 +948,7 @@ static int irq_trigger(int idx) }default : { -printk (KERN_WARNING "broken BIOS!!\n" ); +pr_warn ("broken BIOS!!\n" ); trigger =1 ;break ; }
@@ -962,7 +962,7 @@ static int irq_trigger(int idx) }case 2 :/* reserved */ { -printk (KERN_WARNING "broken BIOS!!\n" ); +pr_warn ("broken BIOS!!\n" ); trigger =1 ;break ; }
@@ -973,7 +973,7 @@ static int irq_trigger(int idx) }default :/* invalid */ { -printk (KERN_WARNING "broken BIOS!!\n" ); +pr_warn ("broken BIOS!!\n" ); trigger =0 ;break ; }
@@ -991,7 +991,7 @@ static int pin_2_irq(int idx, int apic, int pin)* Debugging check, we are in big trouble if this message pops up! */ if (mp_irqs[idx].dstirq != pin) -printk (KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n" ); +pr_err ("broken BIOS or MPTABLE parser, ayiee!!\n" );if (test_bit (bus, mp_bus_not_pci)) { irq = mp_irqs[idx].srcbusirq;
@@ -1521,7 +1521,6 @@ __apicdebuginit(void) print_IO_APIC(int ioapic_idx) reg_03.raw =io_apic_read (ioapic_idx,3 );raw_spin_unlock_irqrestore (&ioapic_lock, flags); -printk ("\n" );printk (KERN_DEBUG "IO APIC #%d......\n" ,mpc_ioapic_id (ioapic_idx));printk (KERN_DEBUG ".... register #00: %08X\n" , reg_00.raw);printk (KERN_DEBUG "....... : physical APIC id: %02X\n" , reg_00.bits.ID);
@@ -1578,7 +1577,7 @@ __apicdebuginit(void) print_IO_APIC(int ioapic_idx) i, ir_entry->index ); - printk("%1d %1d %1d %1d %1d " + pr_cont("%1d %1d %1d %1d %1d " "%1d %1d %X %02X\n", ir_entry->format, ir_entry->mask,
@@ -1598,7 +1597,7 @@ __apicdebuginit(void) print_IO_APIC(int ioapic_idx) i, entry.dest ); - printk("%1d %1d %1d %1d %1d " + pr_cont("%1d %1d %1d %1d %1d " "%1d %1d %02X\n", entry.mask, entry.trigger,
@@ -1651,8 +1650,8 @@ __apicdebuginit(void) print_IO_APICs(void)continue ;printk (KERN_DEBUG "IRQ%d " , irq);for_each_irq_pin (entry, cfg->irq_2_pin) -printk ("-> %d:%d" , entry->apic, entry->pin); -printk ("\n" ); +pr_cont ("-> %d:%d" , entry->apic, entry->pin); +pr_cont ("\n" ); }printk (KERN_INFO ".................................... done.\n" );
@@ -1665,9 +1664,9 @@ __apicdebuginit(void) print_APIC_field(int base)printk (KERN_DEBUG );for (i =0 ; i <8 ; i++) -printk (KERN_CONT "%08x" ,apic_read (base + i*0x10 )); +pr_cont ("%08x" ,apic_read (base + i*0x10 )); -printk (KERN_CONT "\n" ); +pr_cont ("\n" ); }__apicdebuginit (void )print_local_APIC (void *dummy)
@@ -1769,7 +1768,7 @@ __apicdebuginit(void) print_local_APIC(void *dummy)printk (KERN_DEBUG "... APIC EILVT%d: %08x\n" , i, v); } } -printk ("\n" ); +pr_cont ("\n" ); }__apicdebuginit (void )print_local_APICs (int maxcpu)
@@ -2065,7 +2064,7 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void) reg_00.raw =io_apic_read (ioapic_idx,0 );raw_spin_unlock_irqrestore (&ioapic_lock, flags);if (reg_00.bits.ID !=mpc_ioapic_id (ioapic_idx)) -printk ("could not set ID!\n" ); +pr_cont ("could not set ID!\n" );else apic_printk (APIC_VERBOSE ," ok.\n" ); }
@@ -3563,7 +3562,8 @@ static int __init io_apic_get_unique_id(int ioapic, int apic_id)/* Sanity check */ if (reg_00.bits.ID != apic_id) { -printk ("IOAPIC[%d]: Unable to change apic_id!\n" , ioapic); +pr_err ("IOAPIC[%d]: Unable to change apic_id!\n" , + ioapic);return -1 ; } }
arch/x86/kernel/apic/summit_32.c +13 -9
@@ -26,6 +26,8 @@* */ +#define pr_fmt (fmt) "summit: %s: " fmt, __func__ +#include <linux/mm.h> #include <linux/init.h> #include <asm/io.h>
@@ -235,8 +237,8 @@ static int summit_apic_id_registered(void)static void summit_setup_apic_routing (void ) { -printk ("Enabling APIC mode: Summit. Using %d I/O APICs\n" , - nr_ioapics); +pr_info ("Enabling APIC mode: Summit. Using %d I/O APICs\n" , + nr_ioapics); }static int summit_cpu_present_to_apicid (int mps_cpu)
@@ -275,7 +277,7 @@ static unsigned int summit_cpu_mask_to_apicid(const struct cpumask *cpumask)int new_apicid =early_per_cpu (x86_cpu_to_logical_apicid, cpu);if (round &&APIC_CLUSTER (apicid) !=APIC_CLUSTER (new_apicid)) { -printk ("%s: Not a valid mask!\n" , __func__); +pr_err ("Not a valid mask!\n" );return BAD_APICID ; } apicid |= new_apicid;
@@ -355,7 +357,7 @@ static int setup_pci_node_map_for_wpeg(int wpeg_num, int last_bus) } }if (i == rio_table_hdr->num_rio_dev) { -printk (KERN_ERR "%s: Couldn't find owner Cyclone for Winnipeg!\n" , __func__); +pr_err ("Couldn't find owner Cyclone for Winnipeg!\n" );return last_bus; }
@@ -366,7 +368,7 @@ static int setup_pci_node_map_for_wpeg(int wpeg_num, int last_bus) } }if (i == rio_table_hdr->num_scal_dev) { -printk (KERN_ERR "%s: Couldn't find owner Twister for Cyclone!\n" , __func__); +pr_err ("Couldn't find owner Twister for Cyclone!\n" );return last_bus; }
@@ -396,7 +398,7 @@ static int setup_pci_node_map_for_wpeg(int wpeg_num, int last_bus) num_buses =9 ;break ;default : -printk (KERN_INFO "%s: Unsupported Winnipeg type!\n" , __func__); +pr_info ("Unsupported Winnipeg type!\n" );return last_bus; }
@@ -411,13 +413,15 @@ static int build_detail_arrays(void)int i, scal_detail_size, rio_detail_size;if (rio_table_hdr->num_scal_dev >MAX_NUMNODES ) { -printk (KERN_WARNING "%s: MAX_NUMNODES too low! Defined as %d, but system has %d nodes.\n" , __func__,MAX_NUMNODES , rio_table_hdr->num_scal_dev); +pr_warn ("MAX_NUMNODES too low! Defined as %d, but system has %d nodes\n" , +MAX_NUMNODES , rio_table_hdr->num_scal_dev);return 0 ; }switch (rio_table_hdr->version) {default : -printk (KERN_WARNING "%s: Invalid Rio Grande Table Version: %d\n" , __func__, rio_table_hdr->version); +pr_warn ("Invalid Rio Grande Table Version: %d\n" , + rio_table_hdr->version);return 0 ;case 2 : scal_detail_size =11 ;
@@ -462,7 +466,7 @@ void setup_summit(void) offset = *((unsigned short *)(ptr + offset)); }if (!rio_table_hdr) { -printk (KERN_ERR "%s: Unable to locate Rio Grande Table in EBDA - bailing!\n" , __func__); +pr_err ("Unable to locate Rio Grande Table in EBDA - bailing!\n" );return ; }
arch/x86/kernel/apm_32.c +14 -15
@@ -201,6 +201,8 @@* http://www.microsoft.com/whdc/archive/amp_12.mspx] */ +#define pr_fmt (fmt) "apm: " fmt +#include <linux/module.h> #include <linux/poll.h>
@@ -485,11 +487,11 @@ static void apm_error(char *str, int err)if (error_table[i].key == err)break ;if (i <ERROR_COUNT ) -printk (KERN_NOTICE "apm: %s: %s\n" , str, error_table[i].msg); +pr_notice ("%s: %s\n" , str, error_table[i].msg);else if (err <0 ) -printk (KERN_NOTICE "apm: %s: linux error code %i\n" , str, err); +pr_notice ("%s: linux error code %i\n" , str, err);else -printk (KERN_NOTICE "apm: %s: unknown error code %#2.2x\n" , +pr_notice ("%s: unknown error code %#2.2x\n" , str, err); }
@@ -1184,7 +1186,7 @@ static void queue_event(apm_event_t event, struct apm_user *sender)static int notified;if (notified++ ==0 ) -printk (KERN_ERR "apm: an event queue overflowed\n" ); +pr_err ("an event queue overflowed\n" );if (++as->event_tail >=APM_MAX_EVENTS ) as->event_tail =0 ; }
@@ -1447,7 +1449,7 @@ static void apm_mainloop(void)static int check_apm_user (struct apm_user *as,const char *func) {if (as ==NULL || as->magic !=APM_BIOS_MAGIC ) { -printk (KERN_ERR "apm: %s passed bad filp\n" , func); +pr_err ("%s passed bad filp\n" , func);return 1 ; }return 0 ;
@@ -1586,7 +1588,7 @@ static int do_release(struct inode *inode, struct file *filp) as1 = as1->next) ;if (as1 ==NULL ) -printk (KERN_ERR "apm: filp not in user list\n" ); +pr_err ("filp not in user list\n" );else as1->next = as->next; }
@@ -1600,11 +1602,9 @@ static int do_open(struct inode *inode, struct file *filp)struct apm_user *as; as =kmalloc (sizeof (*as),GFP_KERNEL ); -if (as ==NULL ) { -printk (KERN_ERR "apm: cannot allocate struct of size %d bytes\n" , -sizeof (*as)); +if (as ==NULL )return -ENOMEM ; - } + as->magic =APM_BIOS_MAGIC ; as->event_tail = as->event_head =0 ; as->suspends_pending = as->standbys_pending =0 ;
@@ -2313,16 +2313,16 @@ static int __init apm_init(void) }if (apm_info.disabled) { -printk (KERN_NOTICE "apm: disabled on user request.\n" ); +pr_notice ("disabled on user request.\n" );return -ENODEV ; }if ((num_online_cpus () >1 ) && !power_off && !smp) { -printk (KERN_NOTICE "apm: disabled - APM is not SMP safe.\n" ); +pr_notice ("disabled - APM is not SMP safe.\n" ); apm_info.disabled =1 ;return -ENODEV ; }if (!acpi_disabled) { -printk (KERN_NOTICE "apm: overridden by ACPI.\n" ); +pr_notice ("overridden by ACPI.\n" ); apm_info.disabled =1 ;return -ENODEV ; }
@@ -2356,8 +2356,7 @@ static int __init apm_init(void) kapmd_task =kthread_create (apm,NULL ,"kapmd" );if (IS_ERR (kapmd_task)) { -printk (KERN_ERR "apm: disabled - Unable to start kernel " -"thread.\n" ); +pr_err ("disabled - Unable to start kernel thread\n" ); err =PTR_ERR (kapmd_task); kapmd_task =NULL ;remove_proc_entry ("apm" ,NULL );
arch/x86/kernel/cpu/bugs.c +10 -10
@@ -55,8 +55,8 @@ static void __init check_fpu(void)if (!boot_cpu_data.hard_math) {#ifndef CONFIG_MATH_EMULATION -printk (KERN_EMERG "No coprocessor found and no math emulation present.\n" ); -printk (KERN_EMERG "Giving up.\n" ); +pr_emerg ("No coprocessor found and no math emulation present\n" ); +pr_emerg ("Giving up\n" );for (;;) ;#endif return ;
@@ -86,7 +86,7 @@ static void __init check_fpu(void) boot_cpu_data.fdiv_bug = fdiv_bug;if (boot_cpu_data.fdiv_bug) -printk (KERN_WARNING "Hmm, FPU with FDIV bug.\n" ); +pr_warn ("Hmm, FPU with FDIV bug\n" ); }static void __init check_hlt (void )
@@ -94,16 +94,16 @@ static void __init check_hlt(void)if (boot_cpu_data.x86 >=5 ||paravirt_enabled ())return ; -printk (KERN_INFO "Checking 'hlt' instruction... " ); +pr_info ("Checking 'hlt' instruction... " );if (!boot_cpu_data.hlt_works_ok) { -printk ("disabled\n" ); +pr_cont ("disabled\n" );return ; }halt ();halt ();halt ();halt (); -printk (KERN_CONT "OK.\n" ); +pr_cont ("OK\n" ); }/*
@@ -116,7 +116,7 @@ static void __init check_popad(void)#ifndef CONFIG_X86_POPAD_OK int res, inp = (int ) &res; -printk (KERN_INFO "Checking for popad bug... " ); +pr_info ("Checking for popad bug... " ); __asm__ __volatile__("movl $12345678,%%eax; movl $0,%%edi; pusha; popa; movl (%%edx,%%edi),%%ecx " : "=&a" (res)
@@ -127,9 +127,9 @@ static void __init check_popad(void)* CPU hard. Too bad. */ if (res !=12345678 ) -printk (KERN_CONT "Buggy.\n" ); +pr_cont ("Buggy\n" );else -printk (KERN_CONT "OK.\n" ); +pr_cont ("OK\n" );#endif }
@@ -161,7 +161,7 @@ void __init check_bugs(void) {identify_boot_cpu ();#ifndef CONFIG_SMP -printk (KERN_INFO "CPU: " ); +pr_info ("CPU: " );print_cpu_info (&boot_cpu_data);#endif check_config ();
arch/x86/kernel/cpu/mcheck/mce.c +12 -10
@@ -7,6 +7,9 @@* Copyright 2008 Intel Corporation * Author: Andi Kleen */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/thread_info.h> #include <linux/capability.h> #include <linux/miscdevice.h>
@@ -210,7 +213,7 @@ static void drain_mcelog_buffer(void)cpu_relax ();if (!m->finished && retries >=4 ) { -pr_err ("MCE: skipping error being logged currently!\n" ); +pr_err ("skipping error being logged currently!\n" );break ; } }
@@ -1167,8 +1170,9 @@ int memory_failure(unsigned long pfn, int vector, int flags) {/* mce_severity() should not hand us an ACTION_REQUIRED error */ BUG_ON (flags &MF_ACTION_REQUIRED ); -printk (KERN_ERR "Uncorrected memory error in page 0x%lx ignored\n" -"Rebuild kernel with CONFIG_MEMORY_FAILURE=y for smarter handling\n" , pfn); +pr_err ("Uncorrected memory error in page 0x%lx ignored\n" +"Rebuild kernel with CONFIG_MEMORY_FAILURE=y for smarter handling\n" , + pfn);return 0 ; }
@@ -1358,11 +1362,10 @@ static int __cpuinit __mcheck_cpu_cap_init(void) b = cap &MCG_BANKCNT_MASK ;if (!banks) -printk (KERN_INFO "mce: CPU supports %d MCE banks\n" , b); +pr_info ("CPU supports %d MCE banks\n" , b);if (b >MAX_NR_BANKS ) { -printk (KERN_WARNING -"MCE: Using only %u machine check banks out of %u\n" , +pr_warn ("Using only %u machine check banks out of %u\n" ,MAX_NR_BANKS , b); b =MAX_NR_BANKS ; }
@@ -1419,7 +1422,7 @@ static void __mcheck_cpu_init_generic(void)static int __cpuinit __mcheck_cpu_apply_quirks (struct cpuinfo_x86 *c) {if (c->x86_vendor ==X86_VENDOR_UNKNOWN ) { -pr_info ("MCE: unknown CPU type - not enabling MCE support.\n" ); +pr_info ("unknown CPU type - not enabling MCE support\n" );return -EOPNOTSUPP ; }
@@ -1574,7 +1577,7 @@ static void __mcheck_cpu_init_timer(void)/* Handle unconfigured int18 (should never happen) */ static void unexpected_machine_check (struct pt_regs *regs,long error_code) { -printk (KERN_ERR "CPU#%d: Unexpected int18 (Machine Check).\n" , +pr_err ("CPU#%d: Unexpected int18 (Machine Check)\n" ,smp_processor_id ()); }
@@ -1893,8 +1896,7 @@ static int __init mcheck_enable(char *str)get_option (&str, &monarch_timeout); } }else { -printk (KERN_INFO "mce argument %s ignored. Please use /sys\n" , - str); +pr_info ("mce argument %s ignored. Please use /sys\n" , str);return 0 ; }return 1 ;
arch/x86/kernel/cpu/perf_event_intel.c +8 -6
@@ -5,6 +5,8 @@* among events on a single PMU. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/stddef.h> #include <linux/types.h> #include <linux/init.h>
@@ -1000,7 +1002,7 @@ static void intel_pmu_reset(void)local_irq_save (flags); -printk ("clearing PMU state on CPU#%d\n" ,smp_processor_id ()); +pr_info ("clearing PMU state on CPU#%d\n" ,smp_processor_id ());for (idx =0 ; idx < x86_pmu.num_counters; idx++) {checking_wrmsrl (x86_pmu_config_addr (idx),0ull );
@@ -1707,14 +1709,14 @@ static __init void intel_clovertown_quirk(void)* But taken together it might just make sense to not enable PEBS on * these chips. */ -printk (KERN_WARNING "PEBS disabled due to CPU errata.\n" ); +pr_warn ("PEBS disabled due to CPU errata\n" ); x86_pmu.pebs =0 ; x86_pmu.pebs_constraints =NULL ; }static __init void intel_sandybridge_quirk (void ) { -printk (KERN_WARNING "PEBS disabled due to CPU errata.\n" ); +pr_warn ("PEBS disabled due to CPU errata\n" ); x86_pmu.pebs =0 ; x86_pmu.pebs_constraints =NULL ; }
@@ -1736,8 +1738,8 @@ static __init void intel_arch_events_quirk(void)/* disable event that reported as not presend by cpuid */ for_each_set_bit (bit, x86_pmu.events_mask,ARRAY_SIZE (intel_arch_events_map)) { intel_perfmon_event_map[intel_arch_events_map[bit].id] =0 ; -printk (KERN_WARNING "CPUID marked event: \'%s\' unavailable\n" , - intel_arch_events_map[bit].name); +pr_warn ("CPUID marked event: \'%s\' unavailable\n" , + intel_arch_events_map[bit].name); } }
@@ -1756,7 +1758,7 @@ static __init void intel_nehalem_quirk(void) intel_perfmon_event_map[PERF_COUNT_HW_BRANCH_MISSES ] =0x7f89 ; ebx.split.no_branch_misses_retired =0 ; x86_pmu.events_maskl = ebx.full; -printk (KERN_INFO "CPU erratum AAJ80 worked around\n" ); +pr_info ("CPU erratum AAJ80 worked around\n" ); } }
arch/x86/kernel/dumpstack.c +3 -2
@@ -27,8 +27,8 @@ static int die_counter;void printk_address (unsigned long address,int reliable) { -printk (" [<%p>] %s%pB\n" , (void *) address, - reliable ?"" :"? " , (void *) address); +pr_cont (" [<%p>] %s%pB\n" , + (void *)address, reliable ?"" :"? " , (void *)address); }#ifdef CONFIG_FUNCTION_GRAPH_TRACER
@@ -271,6 +271,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err) current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP)return 1 ; +print_modules ();show_regs (regs);#ifdef CONFIG_X86_32 if (user_mode_vm (regs)) {
arch/x86/kernel/dumpstack_32.c +12 -13
@@ -73,11 +73,11 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,if (kstack_end (stack))break ;if (i && ((i %STACKSLOTS_PER_LINE ) ==0 )) -printk (KERN_CONT "\n" ); -printk (KERN_CONT " %08lx" , *stack++); +pr_cont ("\n" ); +pr_cont (" %08lx" , *stack++);touch_nmi_watchdog (); } -printk (KERN_CONT "\n" ); +pr_cont ("\n" );show_trace_log_lvl (task, regs, sp, bp, log_lvl); }
@@ -86,12 +86,11 @@ void show_regs(struct pt_regs *regs) {int i; -print_modules ();__show_regs (regs, !user_mode_vm (regs)); -printk (KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)\n" , -TASK_COMM_LEN , current->comm,task_pid_nr (current), -current_thread_info (), current,task_thread_info (current)); +pr_emerg ("Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)\n" , +TASK_COMM_LEN , current->comm,task_pid_nr (current), +current_thread_info (), current,task_thread_info (current));/* * When in-kernel, we also print out the stack and code at the * time of the fault..
@@ -102,10 +101,10 @@ void show_regs(struct pt_regs *regs)unsigned char c;u8 *ip; -printk (KERN_EMERG "Stack:\n" ); +pr_emerg ("Stack:\n" );show_stack_log_lvl (NULL , regs, ®s->sp,0 ,KERN_EMERG ); -printk (KERN_EMERG "Code: " ); +pr_emerg ("Code:" ); ip = (u8 *)regs->ip - code_prologue;if (ip < (u8 *)PAGE_OFFSET ||probe_kernel_address (ip, c)) {
@@ -116,16 +115,16 @@ void show_regs(struct pt_regs *regs)for (i =0 ; i < code_len; i++, ip++) {if (ip < (u8 *)PAGE_OFFSET ||probe_kernel_address (ip, c)) { -printk (KERN_CONT " Bad EIP value." ); +pr_cont (" Bad EIP value." );break ; }if (ip == (u8 *)regs->ip) -printk (KERN_CONT "<%02x> " , c); +pr_cont (" <%02x>" , c);else -printk (KERN_CONT "%02x " , c); +pr_cont (" %02x" , c); } } -printk (KERN_CONT "\n" ); +pr_cont ("\n" ); }int is_valid_bugaddr (unsigned long ip)
arch/x86/kernel/dumpstack_64.c +10 -11
@@ -228,20 +228,20 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,if (stack >= irq_stack && stack <= irq_stack_end) {if (stack == irq_stack_end) { stack = (unsigned long *) (irq_stack_end[-1 ]); -printk (KERN_CONT " <EOI> " ); +pr_cont (" <EOI> " ); } }else {if (((long ) stack & (THREAD_SIZE -1 )) ==0 )break ; }if (i && ((i %STACKSLOTS_PER_LINE ) ==0 )) -printk (KERN_CONT "\n" ); -printk (KERN_CONT " %016lx" , *stack++); +pr_cont ("\n" ); +pr_cont (" %016lx" , *stack++);touch_nmi_watchdog (); }preempt_enable (); -printk (KERN_CONT "\n" ); +pr_cont ("\n" );show_trace_log_lvl (task, regs, sp, bp, log_lvl); }
@@ -254,10 +254,9 @@ void show_regs(struct pt_regs *regs) sp = regs->sp;printk ("CPU %d " , cpu); -print_modules ();__show_regs (regs,1 ); -printk ("Process %s (pid: %d, threadinfo %p, task %p)\n" , - cur->comm, cur->pid,task_thread_info (cur), cur); +printk (KERN_DEFAULT "Process %s (pid: %d, threadinfo %p, task %p)\n" , + cur->comm, cur->pid,task_thread_info (cur), cur);/* * When in-kernel, we also print out the stack and code at the
@@ -284,16 +283,16 @@ void show_regs(struct pt_regs *regs)for (i =0 ; i < code_len; i++, ip++) {if (ip < (u8 *)PAGE_OFFSET ||probe_kernel_address (ip, c)) { -printk (KERN_CONT " Bad RIP value." ); +pr_cont (" Bad RIP value." );break ; }if (ip == (u8 *)regs->ip) -printk (KERN_CONT "<%02x> " , c); +pr_cont ("<%02x> " , c);else -printk (KERN_CONT "%02x " , c); +pr_cont ("%02x " , c); } } -printk (KERN_CONT "\n" ); +pr_cont ("\n" ); }int is_valid_bugaddr (unsigned long ip)
arch/x86/kernel/entry_64.S +20 -0
@@ -1758,10 +1758,30 @@ end_repeat_nmi: */ call save_paranoid DEFAULT_FRAME 0 + + /* + * Save off the CR2 register. If we take a page fault in the NMI then + * it could corrupt the CR2 value. If the NMI preempts a page fault + * handler before it was able to read the CR2 register, and then the + * NMI itself takes a page fault, the page fault that was preempted + * will read the information from the NMI page fault and not the + * origin fault. Save it off and restore it if it changes. + * Use the r12 callee-saved register. + */ + movq %cr2, %r12 + /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */ movq %rsp,%rdi movq $-1,%rsi call do_nmi + + /* Did the NMI take a page fault? Restore cr2 if it did */ + movq %cr2, %rcx + cmpq %rcx, %r12 + je 1f + movq %r12, %cr2 +1: + testl %ebx,%ebx /* swapgs needed? */ jnz nmi_restore nmi_swapgs:
arch/x86/kernel/irq.c +2 -2
@@ -294,9 +294,9 @@ void fixup_irqs(void)raw_spin_unlock (&desc->lock);if (break_affinity && set_affinity) -printk ("Broke affinity for irq %i\n" , irq); +pr_notice ("Broke affinity for irq %i\n" , irq);else if (!set_affinity) -printk ("Cannot set affinity for irq %i\n" , irq); +pr_notice ("Cannot set affinity for irq %i\n" , irq); }/*
arch/x86/kernel/microcode_core.c +1 -1
@@ -504,7 +504,7 @@ static struct notifier_block __refdata mc_cpu_notifier = { #ifdef MODULE /* Autoload on Intel and AMD systems */ -static const struct x86_cpu_id microcode_id[] = { +static const struct x86_cpu_id __initconst microcode_id[] = { #ifdef CONFIG_MICROCODE_INTEL { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, }, #endif
arch/x86/kernel/module.c +20 -12
@@ -15,6 +15,9 @@along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/moduleloader.h> #include <linux/elf.h> #include <linux/vmalloc.h>
@@ -30,9 +33,14 @@#include <asm/pgtable.h> #if 0 -#define DEBUGP printk +#define DEBUGP (fmt, ...) \ + printk(KERN_DEBUG fmt, ##__VA_ARGS__)#else -#define DEBUGP(fmt...) +#define DEBUGP (fmt, ...) \ +do { \ + if (0) \ + printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ +} while (0)#endif void *module_alloc (unsigned long size)
@@ -56,8 +64,8 @@ int apply_relocate(Elf32_Shdr *sechdrs,Elf32_Sym *sym;uint32_t *location; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, - sechdrs[relsec].sh_info); +DEBUGP ("Applying relocate section %u to %u\n" , + relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */ location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
@@ -77,7 +85,7 @@ int apply_relocate(Elf32_Shdr *sechdrs, *location += sym->st_value - (uint32_t )location;break ;default : -printk (KERN_ERR "module %s: Unknown relocation: %u\n" , +pr_err ("%s: Unknown relocation: %u\n" , me->name,ELF32_R_TYPE (rel[i].r_info));return -ENOEXEC ; }
@@ -97,8 +105,8 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,void *loc;u64 val; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, - sechdrs[relsec].sh_info); +DEBUGP ("Applying relocate section %u to %u\n" , + relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */ loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
@@ -110,8 +118,8 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, +ELF64_R_SYM (rel[i].r_info);DEBUGP ("type %d st_value %Lx r_addend %Lx loc %Lx\n" , - (int )ELF64_R_TYPE (rel[i].r_info), - sym->st_value, rel[i].r_addend, (u64 )loc); + (int )ELF64_R_TYPE (rel[i].r_info), + sym->st_value, rel[i].r_addend, (u64 )loc); val = sym->st_value + rel[i].r_addend;
@@ -140,7 +148,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,#endif break ;default : -printk (KERN_ERR "module %s: Unknown rela relocation: %llu\n" , +pr_err ("%s: Unknown rela relocation: %llu\n" , me->name,ELF64_R_TYPE (rel[i].r_info));return -ENOEXEC ; }
@@ -148,9 +156,9 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,return 0 ; overflow: -printk (KERN_ERR "overflow in relocation type %d val %Lx\n" , +pr_err ("overflow in relocation type %d val %Lx\n" , (int )ELF64_R_TYPE (rel[i].r_info), val); -printk (KERN_ERR "`%s' likely not compiled with -mcmodel=kernel\n" , +pr_err ("`%s' likely not compiled with -mcmodel=kernel\n" , me->name);return -ENOEXEC ; }
arch/x86/kernel/nmi.c +33 -14
73 lines not on this page · raw message
arch/x86/kernel/nmi_selftest.c +4 -3
@@ -42,7 +42,8 @@ static int __init nmi_unk_cb(unsigned int val, struct pt_regs *regs)static void __init init_nmi_testsuite (void ) {/* trap all the unknown NMIs we may generate */ -register_nmi_handler_initonly (NMI_UNKNOWN , nmi_unk_cb,0 ,"nmi_selftest_unk" ); + register_nmi_handler(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk", +__initdata ); }static void __init cleanup_nmi_testsuite (void )
@@ -64,8 +65,8 @@ static void __init test_nmi_ipi(struct cpumask *mask) {unsigned long timeout; -if (register_nmi_handler_initonly (NMI_LOCAL , test_nmi_ipi_callback, -NMI_FLAG_FIRST ,"nmi_selftest" )) { +if (register_nmi_handler (NMI_LOCAL , test_nmi_ipi_callback, + NMI_FLAG_FIRST, "nmi_selftest", __initdata)) { nmi_fail =FAILURE ;return ; }
arch/x86/kernel/pci-calgary_64.c +16 -18
@@ -22,6 +22,8 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define pr_fmt (fmt) "Calgary: " fmt +#include <linux/kernel.h> #include <linux/init.h> #include <linux/types.h>
@@ -245,7 +247,7 @@ static unsigned long iommu_range_alloc(struct device *dev, offset =iommu_area_alloc (tbl->it_map, tbl->it_size,0 , npages,0 , boundary_size,0 );if (offset == ~0UL ) { -printk (KERN_WARNING "Calgary: IOMMU full.\n" ); +pr_warn ("IOMMU full\n" );spin_unlock_irqrestore (&tbl->it_lock, flags);if (panic_on_overflow)panic ("Calgary: fix the allocator.\n" );
@@ -271,8 +273,8 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl, entry =iommu_range_alloc (dev, tbl, npages);if (unlikely (entry ==DMA_ERROR_CODE )) { -printk (KERN_WARNING "Calgary: failed to allocate %u pages in " -"iommu %p\n" , npages, tbl); +pr_warn ("failed to allocate %u pages in iommu %p\n" , + npages, tbl);return DMA_ERROR_CODE ; }
@@ -561,8 +563,7 @@ static void calgary_tce_cache_blast(struct iommu_table *tbl) i++; }while ((val &0xff ) !=0xff && i <100 );if (i ==100 ) -printk (KERN_WARNING "Calgary: PCI bus not quiesced, " -"continuing anyway\n" ); +pr_warn ("PCI bus not quiesced, continuing anyway\n" );/* invalidate TCE cache */ target =calgary_reg (bbar,tar_offset (tbl->it_busno));
@@ -604,8 +605,7 @@ begin: i++; }while ((val64 &0xff ) !=0xff && i <100 );if (i ==100 ) -printk (KERN_WARNING "CalIOC2: PCI bus not quiesced, " -"continuing anyway\n" ); +pr_warn ("CalIOC2: PCI bus not quiesced, continuing anyway\n" );/* 3. poll Page Migration DEBUG for SoftStopFault */ target =calgary_reg (bbar,phb_offset (bus) |PHB_PAGE_MIG_DEBUG );
@@ -617,8 +617,7 @@ begin:if (++count <100 ) goto begin;else { -printk (KERN_WARNING "CalIOC2: too many SoftStopFaults, " -"aborting TCE cache flush sequence!\n" ); +pr_warn ("CalIOC2: too many SoftStopFaults, aborting TCE cache flush sequence!\n" );return ;/* pray for the best */ } }
@@ -840,8 +839,8 @@ static void calgary_dump_error_regs(struct iommu_table *tbl) plssr =be32_to_cpu (readl (target));/* If no error, the agent ID in the CSR is not valid */ -printk (KERN_EMERG "Calgary: DMA error on Calgary PHB 0x%x, " -"0x%08x@CSR 0x%08x@PLSSR\n" , tbl->it_busno, csr, plssr); +pr_emerg ("DMA error on Calgary PHB 0x%x, 0x%08x@CSR 0x%08x@PLSSR\n" , + tbl->it_busno, csr, plssr); }static void calioc2_dump_error_regs (struct iommu_table *tbl)
@@ -867,22 +866,21 @@ static void calioc2_dump_error_regs(struct iommu_table *tbl) target =calgary_reg (bbar, phboff |0x800 ); mck =be32_to_cpu (readl (target)); -printk (KERN_EMERG "Calgary: DMA error on CalIOC2 PHB 0x%x\n" , - tbl->it_busno); +pr_emerg ("DMA error on CalIOC2 PHB 0x%x\n" , tbl->it_busno); -printk (KERN_EMERG "Calgary: 0x%08x@CSR 0x%08x@PLSSR 0x%08x@CSMR 0x%08x@MCK\n" , - csr, plssr, csmr, mck); +pr_emerg ("0x%08x@CSR 0x%08x@PLSSR 0x%08x@CSMR 0x%08x@MCK\n" , + csr, plssr, csmr, mck);/* dump rest of error regs */ -printk (KERN_EMERG "Calgary: " ); +pr_emerg ("" );for (i =0 ; i <ARRAY_SIZE (errregs); i++) {/* err regs are at 0x810 - 0x870 */ erroff = (0x810 + (i *0x10 )); target =calgary_reg (bbar, phboff | erroff); errregs[i] =be32_to_cpu (readl (target)); -printk ("0x%08x@0x%lx " , errregs[i], erroff); +pr_cont ("0x%08x@0x%lx " , errregs[i], erroff); } -printk ("\n" ); +pr_cont ("\n" );/* root complex status */ target =calgary_reg (bbar, phboff |PHB_ROOT_COMPLEX_STATUS );
arch/x86/kernel/process.c +16 -18
@@ -1,3 +1,5 @@ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/errno.h> #include <linux/kernel.h> #include <linux/mm.h>
@@ -145,16 +147,14 @@ void show_regs_common(void)/* Board Name is optional */ board =dmi_get_system_info (DMI_BOARD_NAME ); -printk (KERN_CONT "\n" ); -printk (KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s" , - current->pid, current->comm,print_tainted (), -init_utsname ()->release, - (int )strcspn (init_utsname ()->version," " ), -init_utsname ()->version); -printk (KERN_CONT " %s %s" , vendor, product); -if (board) -printk (KERN_CONT "/%s" , board); -printk (KERN_CONT "\n" ); +printk (KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n" , + current->pid, current->comm,print_tainted (), +init_utsname ()->release, + (int )strcspn (init_utsname ()->version," " ), +init_utsname ()->version, + vendor, product, + board ?"/" :"" , + board ? board :"" ); }void flush_thread (void )
@@ -645,7 +645,7 @@ static void amd_e400_idle(void) amd_e400_c1e_detected = true;if (!boot_cpu_has (X86_FEATURE_NONSTOP_TSC ))mark_tsc_unstable ("TSC halt in AMD C1E" ); -printk (KERN_INFO "System has AMD C1E enabled\n" ); +pr_info ("System has AMD C1E enabled\n" ); } }
@@ -659,8 +659,7 @@ static void amd_e400_idle(void)*/ clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_FORCE , &cpu); -printk (KERN_INFO "Switch to broadcast mode on CPU%d\n" , - cpu); +pr_info ("Switch to broadcast mode on CPU%d\n" , cpu); }clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &cpu);
@@ -681,8 +680,7 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) {#ifdef CONFIG_SMP if (pm_idle == poll_idle && smp_num_siblings >1 ) { -printk_once (KERN_WARNING "WARNING: polling idle and HT enabled," -" performance may degrade.\n" ); +pr_warn_once ("WARNING: polling idle and HT enabled, performance may degrade\n" ); }#endif if (pm_idle)
@@ -692,11 +690,11 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)/* * One CPU supports mwait => All CPUs supports mwait */ -printk (KERN_INFO "using mwait in idle threads.\n" ); +pr_info ("using mwait in idle threads\n" ); pm_idle = mwait_idle; }else if (cpu_has_amd_erratum (amd_erratum_400)) {/* E400: APIC timer interrupt does not wake up CPU from C1e */ -printk (KERN_INFO "using AMD E400 aware idle routine\n" ); +pr_info ("using AMD E400 aware idle routine\n" ); pm_idle = amd_e400_idle; }else pm_idle = default_idle;
@@ -715,7 +713,7 @@ static int __init idle_setup(char *str)return -EINVAL ;if (!strcmp (str,"poll" )) { -printk ("using polling idle threads.\n" ); +pr_info ("using polling idle threads\n" ); pm_idle = poll_idle; boot_option_idle_override =IDLE_POLL ; }else if (!strcmp (str,"mwait" )) {
arch/x86/kernel/process_64.c +4 -4
@@ -117,10 +117,10 @@ void release_thread(struct task_struct *dead_task) {if (dead_task->mm) {if (dead_task->mm->context.size) { -printk ("WARNING: dead process %8s still has LDT? <%p/%d>\n" , - dead_task->comm, - dead_task->mm->context.ldt, - dead_task->mm->context.size); +pr_warn ("WARNING: dead process %8s still has LDT? <%p/%d>\n" , + dead_task->comm, + dead_task->mm->context.ldt, + dead_task->mm->context.size);BUG (); } }
arch/x86/kernel/reboot.c +9 -5
@@ -1,3 +1,5 @@ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/reboot.h> #include <linux/init.h>
@@ -152,7 +154,8 @@ static int __init set_bios_reboot(const struct dmi_system_id *d) {if (reboot_type !=BOOT_BIOS ) { reboot_type =BOOT_BIOS ; -printk (KERN_INFO "%s series board detected. Selecting BIOS-method for reboots.\n" , d->ident); +pr_info ("%s series board detected. Selecting %s-method for reboots.\n" , +"BIOS" , d->ident); }return 0 ; }
@@ -207,8 +210,8 @@ static int __init set_pci_reboot(const struct dmi_system_id *d) {if (reboot_type !=BOOT_CF9 ) { reboot_type =BOOT_CF9 ; -printk (KERN_INFO "%s series board detected. " -"Selecting PCI-method for reboots.\n" , d->ident); +pr_info ("%s series board detected. Selecting %s-method for reboots.\n" , +"PCI" , d->ident); }return 0 ; }
@@ -217,7 +220,8 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d) {if (reboot_type !=BOOT_KBD ) { reboot_type =BOOT_KBD ; -printk (KERN_INFO "%s series board detected. Selecting KBD-method for reboot.\n" , d->ident); +pr_info ("%s series board detected. Selecting %s-method for reboot.\n" , +"KBD" , d->ident); }return 0 ; }
@@ -670,7 +674,7 @@ static void __machine_emergency_restart(int emergency)static void native_machine_restart (char *__unused) { -printk ("machine restart\n" ); +pr_notice ("machine restart\n" );if (!reboot_force)machine_shutdown ();
arch/x86/kernel/signal.c +4 -1
@@ -6,6 +6,9 @@* 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes * 2000-2002 x86-64 support by Andi Kleen */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/sched.h> #include <linux/mm.h> #include <linux/smp.h>
@@ -814,7 +817,7 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where) me->comm, me->pid, where, frame, regs->ip, regs->sp, regs->orig_ax);print_vma_addr (" in " , regs->ip); -printk (KERN_CONT "\n" ); +pr_cont ("\n" ); }force_sig (SIGSEGV , me);
arch/x86/kernel/smpboot.c +45 -52
294 lines not on this page · raw message
arch/x86/kernel/traps.c +10 -9
@@ -9,6 +9,9 @@/* * Handle hardware traps and faults. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/interrupt.h> #include <linux/kallsyms.h> #include <linux/spinlock.h>
@@ -143,12 +146,11 @@ trap_signal:#ifdef CONFIG_X86_64 if (show_unhandled_signals &&unhandled_signal (tsk, signr) &&printk_ratelimit ()) { -printk (KERN_INFO -"%s[%d] trap %s ip:%lx sp:%lx error:%lx" , - tsk->comm, tsk->pid, str, - regs->ip, regs->sp, error_code); +pr_info ("%s[%d] trap %s ip:%lx sp:%lx error:%lx" , + tsk->comm, tsk->pid, str, + regs->ip, regs->sp, error_code);print_vma_addr (" in " , regs->ip); -printk ("\n" ); +pr_cont ("\n" ); }#endif
@@ -269,12 +271,11 @@ do_general_protection(struct pt_regs *regs, long error_code)if (show_unhandled_signals &&unhandled_signal (tsk,SIGSEGV ) &&printk_ratelimit ()) { -printk (KERN_INFO -"%s[%d] general protection ip:%lx sp:%lx error:%lx" , +pr_info ("%s[%d] general protection ip:%lx sp:%lx error:%lx" , tsk->comm,task_pid_nr (tsk), regs->ip, regs->sp, error_code);print_vma_addr (" in " , regs->ip); -printk ("\n" ); +pr_cont ("\n" ); }force_sig (SIGSEGV , tsk);
@@ -570,7 +571,7 @@ do_spurious_interrupt_bug(struct pt_regs *regs, long error_code)conditional_sti (regs);#if 0 /* No need to warn about this any longer. */ -printk (KERN_INFO "Ignoring P6 Local APIC Spurious Interrupt Bug...\n" ); +pr_info ("Ignoring P6 Local APIC Spurious Interrupt Bug...\n" );#endif }
arch/x86/kernel/tsc.c +24 -26
130 lines not on this page · raw message
arch/x86/kernel/vm86_32.c +4 -2
@@ -28,6 +28,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/capability.h> #include <linux/errno.h> #include <linux/interrupt.h>
@@ -137,14 +139,14 @@ struct pt_regs *save_v86_state(struct kernel_vm86_regs *regs)local_irq_enable ();if (!current->thread.vm86_info) { -printk ("no vm86_info: BAD\n" ); +pr_alert ("no vm86_info: BAD\n" );do_exit (SIGSEGV ); }set_flags (regs->pt.flags,VEFLAGS ,X86_EFLAGS_VIF | current->thread.v86mask); tmp =copy_vm86_regs_to_user (¤t->thread.vm86_info->regs, regs); tmp +=put_user (current->thread.screen_bitmap, ¤t->thread.vm86_info->screen_bitmap);if (tmp) { -printk ("vm86: could not access userspace vm86_info\n" ); +pr_alert ("could not access userspace vm86_info\n" );do_exit (SIGSEGV ); }
arch/x86/kernel/vsyscall_64.c +7 -10
@@ -18,6 +18,8 @@* use the vDSO. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/time.h> #include <linux/init.h> #include <linux/kernel.h>
@@ -111,18 +113,13 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,static void warn_bad_vsyscall (const char *level,struct pt_regs *regs,const char *message) { - static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); -struct task_struct *tsk; - -if (!show_unhandled_signals || !__ratelimit (&rs)) +if (!show_unhandled_signals)return ; - tsk = current; - -printk ("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n" , - level, tsk->comm,task_pid_nr (tsk), - message, regs->ip, regs->cs, - regs->sp, regs->ax, regs->si, regs->di); +pr_notice_ratelimited ("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n" , + level, current->comm,task_pid_nr (current), + message, regs->ip, regs->cs, + regs->sp, regs->ax, regs->si, regs->di); }static int addr_to_vsyscall_nr (unsigned long addr)
arch/x86/kernel/xsave.c +7 -5
@@ -3,6 +3,9 @@* * Author: Suresh Siddha <[email protected]> */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/bootmem.h> #include <linux/compat.h> #include <asm/i387.h>
@@ -162,7 +165,7 @@ int save_i387_xstate(void __user *buf)BUG_ON (sig_xstate_size < xstate_size);if ((unsigned long )buf %64 ) -printk ("save_i387_xstate: bad fpstate %p\n" , buf); +pr_err ("%s: bad fpstate %p\n" , __func__, buf);if (!used_math ())return 0 ;
@@ -422,7 +425,7 @@ static void __init xstate_enable_boot_cpu(void) pcntxt_mask = eax + ((u64 )edx <<32 );if ((pcntxt_mask &XSTATE_FPSSE ) !=XSTATE_FPSSE ) { -printk (KERN_ERR "FP/SSE not shown under xsave features 0x%llx\n" , +pr_err ("FP/SSE not shown under xsave features 0x%llx\n" , pcntxt_mask);BUG (); }
@@ -445,9 +448,8 @@ static void __init xstate_enable_boot_cpu(void)setup_xstate_init (); -printk (KERN_INFO "xsave/xrstor: enabled xstate_bv 0x%llx, " -"cntxt size 0x%x\n" , - pcntxt_mask, xstate_size); +pr_info ("enabled xstate_bv 0x%llx, cntxt size 0x%x\n" , + pcntxt_mask, xstate_size); }/*
arch/x86/mm/init.c +1 -1
@@ -385,7 +385,7 @@ void free_initmem(void) }#ifdef CONFIG_BLK_DEV_INITRD -void free_initrd_mem (unsigned long start,unsigned long end) +void __init free_initrd_mem (unsigned long start,unsigned long end) {/* * end could be not aligned, and We can not align that,