x86 fixes
Subsystems (3)
Linus,
Please pull the latest x86-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linus
Thanks,
Ingo
------------------>
Anders Kaseorg (1):
x86: fix fragile computation of vsyscall address
Huang Ying (1):
x86: mce, inject: Use real inject-msg in raise_local
Ingo Molnar (3):
x86: mce: Clean up thermal throttling state tracking code
x86: mce: Fix thermal throttling message storm
x86: mce: Use safer ways to access MCE registers
Jason Wessel (1):
x86: early_printk: Protect against using the same device twice
Jeremy Fitzhardinge (2):
xen: check EFER for NX before setting up GDT mapping
x86: split NX setup into separate file to limit unstack-protected code
Roland Dreier (2):
x86: Reduce verbosity of "TSC is reliable" message
x86: Reduce verbosity of "PAT enabled" kernel message
Rusty Russell (1):
x86: Remove redundant non-NUMA topology functions
Tim Abbott (4):
x86: convert compressed loader to use __HEAD and HEAD_TEXT macros.
x86: convert to use __HEAD and HEAD_TEXT macros.
x86: Use section .data.page_aligned for the idt_table.
x86: Cleanup linker script using new linker script macros.
arch/x86/boot/compressed/head_32.S | 3 +- arch/x86/boot/compressed/head_64.S | 3 +- arch/x86/boot/compressed/vmlinux.lds.S | 6 ++- arch/x86/include/asm/pgtable_types.h | 1 + arch/x86/include/asm/topology.h | 10 ---- arch/x86/kernel/cpu/mcheck/mce-inject.c | 7 ++- arch/x86/kernel/cpu/mcheck/mce.c | 23 ++++++++- arch/x86/kernel/cpu/mcheck/therm_throt.c | 67 ++++++++++++++++--------- arch/x86/kernel/early_printk.c | 5 ++ arch/x86/kernel/head_32.S | 2 +- arch/x86/kernel/head_64.S | 2 +- arch/x86/kernel/traps.c | 6 +-- arch/x86/kernel/tsc_sync.c | 2 +- arch/x86/kernel/vmlinux.lds.S | 79 +++++------------------------- arch/x86/mm/Makefile | 3 +- arch/x86/mm/init.c | 63 ------------------------ arch/x86/mm/pat.c | 7 ++- arch/x86/mm/setup_nx.c | 69 ++++++++++++++++++++++++++ arch/x86/xen/enlighten.c | 10 ++-- 19 files changed, 180 insertions(+), 188 deletions(-) create mode 100644 arch/x86/mm/setup_nx.c
arch/x86/boot/compressed/head_32.S +2 -1
@@ -23,13 +23,14 @@ */ .text +#include <linux/init.h> #include <linux/linkage.h> #include <asm/segment.h> #include <asm/page_types.h> #include <asm/boot.h> #include <asm/asm-offsets.h> - .section ".text.head","ax",@progbits + __HEAD ENTRY(startup_32) cld /*
arch/x86/boot/compressed/head_64.S +2 -1
@@ -24,6 +24,7 @@ .code32 .text +#include <linux/init.h> #include <linux/linkage.h> #include <asm/segment.h> #include <asm/pgtable_types.h>
@@ -33,7 +34,7 @@ #include <asm/processor-flags.h> #include <asm/asm-offsets.h> - .section ".text.head" + __HEAD .code32 ENTRY(startup_32) cld
arch/x86/boot/compressed/vmlinux.lds.S +4 -2
@@ -1,3 +1,5 @@ +#include <asm-generic/vmlinux.lds.h> + OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT) #undef i386
@@ -18,9 +20,9 @@ SECTIONS * address 0. */ . = 0; - .text.head : { + .head.text : { _head = . ; - *(.text.head) + HEAD_TEXT _ehead = . ; } .rodata.compressed : {
arch/x86/include/asm/pgtable_types.h +1 -0
@@ -277,6 +277,7 @@ static inline pteval_t pte_flags(pte_t pte)typedef struct page *pgtable_t ;extern pteval_t __supported_pte_mask; +extern void set_nx (void );extern int nx_enabled;#define pgprot_writecombine pgprot_writecombine
arch/x86/include/asm/topology.h +0 -10
@@ -165,21 +165,11 @@ static inline int numa_node_id(void) return 0; } -static inline int cpu_to_node (int cpu) -{ -return 0 ; -} -static inline int early_cpu_to_node (int cpu) {return 0 ; } -static inline const struct cpumask *cpumask_of_node (int node) -{ -return cpu_online_mask; -} -static inline void setup_node_to_cpumask_map (void ) { }#endif
arch/x86/kernel/cpu/mcheck/mce-inject.c +4 -3
@@ -98,8 +98,9 @@ static struct notifier_block mce_raise_nb = { };/* Inject mce on current CPU */ -static int raise_local (struct mce *m) +static int raise_local (void ) { +struct mce *m = &__get_cpu_var (injectm);int context =MCJ_CTX (m->inject_flags);int ret =0 ;int cpu = m->extcpu;
@@ -167,12 +168,12 @@ static void raise_mce(struct mce *m) }cpu_relax (); } -raise_local (m); +raise_local ();put_cpu ();put_online_cpus (); } else#endif -raise_local (m); +raise_local (); }/* Error injection interface */
arch/x86/kernel/cpu/mcheck/mce.c +21 -2
@@ -305,13 +305,25 @@ static int msr_to_offset(u32 msr)static u64 mce_rdmsrl (u32 msr) {u64 v; +if (__get_cpu_var (injectm).finished) {int offset =msr_to_offset (msr); +if (offset <0 )return 0 ;return *(u64 *)((char *)&__get_cpu_var (injectm) + offset); } -rdmsrl (msr, v); + +if (rdmsrl_safe (msr, &v)) { +WARN_ONCE (1 ,"mce: Unable to read msr %d!\n" , msr); +/* +* Return zero in case the access faulted. This should +* not happen normally but can happen if the CPU does +* something weird, or if the code is buggy. +*/ + v =0 ; + } +return v; }
@@ -319,6 +331,7 @@ static void mce_wrmsrl(u32 msr, u64 v) {if (__get_cpu_var (injectm).finished) {int offset =msr_to_offset (msr); +if (offset >=0 ) *(u64 *)((char *)&__get_cpu_var (injectm) + offset) = v;return ;
@@ -415,7 +428,7 @@ static inline void mce_get_rip(struct mce *m, struct pt_regs *regs) m->ip =mce_rdmsrl (rip_msr); } -#ifdef CONFIG_X86_LOCAL_APIC +#ifdef CONFIG_X86_LOCAL_APIC /* * Called after interrupts have been reenabled again * when a MCE happened during an interrupts off region
@@ -1172,6 +1185,7 @@ static int mce_banks_init(void)return -ENOMEM ;for (i =0 ; i < banks; i++) {struct mce_bank *b = &mce_banks[i]; + b->ctl =-1ULL ; b->init =1 ; }
@@ -1203,6 +1217,7 @@ static int __cpuinit mce_cap_init(void) banks = b;if (!mce_banks) {int err =mce_banks_init (); +if (err)return err; }
@@ -1237,6 +1252,7 @@ static void mce_init(void)for (i =0 ; i < banks; i++) {struct mce_bank *b = &mce_banks[i]; +if (!b->init)continue ;wrmsrl (MSR_IA32_MCx_CTL (i), b->ctl);
@@ -1626,6 +1642,7 @@ static int mce_disable(void)for (i =0 ; i < banks; i++) {struct mce_bank *b = &mce_banks[i]; +if (b->init)wrmsrl (MSR_IA32_MCx_CTL (i),0 ); }
@@ -1911,6 +1928,7 @@ static void mce_disable_cpu(void *h)cmci_clear ();for (i =0 ; i < banks; i++) {struct mce_bank *b = &mce_banks[i]; +if (b->init)wrmsrl (MSR_IA32_MCx_CTL (i),0 ); }
@@ -1928,6 +1946,7 @@ static void mce_reenable_cpu(void *h)cmci_reenable ();for (i =0 ; i < banks; i++) {struct mce_bank *b = &mce_banks[i]; +if (b->init)wrmsrl (MSR_IA32_MCx_CTL (i), b->ctl); }
arch/x86/kernel/cpu/mcheck/therm_throt.c +42 -25
120 lines not on this page · raw message
arch/x86/kernel/early_printk.c +5 -0
@@ -178,6 +178,11 @@ asmlinkage void early_printk(const char *fmt, ...)static inline void early_console_register (struct console *con,int keep_early) { +if (early_console->index !=-1 ) { +printk (KERN_CRIT "ERROR: earlyprintk= %s already used\n" , + con->name); +return ; + } early_console = con;if (keep_early) early_console->flags &= ~CON_BOOT ;
arch/x86/kernel/head_32.S +1 -1
@@ -79,7 +79,7 @@ RESERVE_BRK(pagetables, INIT_MAP_SIZE) * any particular GDT layout, because we load our own as soon as we * can. */ -.section .text.head,"ax",@progbits +__HEAD ENTRY(startup_32) /* test KEEP_SEGMENTS flag to see if the bootloader is asking us to not reload segments */
arch/x86/kernel/head_64.S +1 -1
@@ -40,7 +40,7 @@ L4_START_KERNEL = pgd_index(__START_KERNEL_map) L3_START_KERNEL = pud_index(__START_KERNEL_map) .text - .section .text.head + __HEAD .code64 .globl startup_64 startup_64:
arch/x86/kernel/traps.c +2 -4
@@ -73,11 +73,9 @@ char ignore_fpu_irq;/* * The IDT has to be page-aligned to simplify the Pentium -* F0 0F bug workaround.. We have a special link segment -* for this. +* F0 0F bug workaround. */ -gate_desc idt_table[NR_VECTORS] - __attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, }; +gate_desc idt_table[NR_VECTORS] __page_aligned_data = { { { { 0, 0 } } }, };#endif DECLARE_BITMAP (used_vectors,NR_VECTORS );
arch/x86/kernel/tsc_sync.c +1 -1
@@ -114,7 +114,7 @@ void __cpuinit check_tsc_sync_source(int cpu)return ;if (boot_cpu_has (X86_FEATURE_TSC_RELIABLE )) { -pr_info ("Skipping synchronization checks as TSC is reliable.\n" ); +printk_once (KERN_INFO "Skipping synchronization checks as TSC is reliable.\n" );return ; }
arch/x86/kernel/vmlinux.lds.S +13 -66
144 lines not on this page · raw message
arch/x86/mm/Makefile +2 -1
@@ -1,9 +1,10 @@ obj-y := init.o init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ - pat.o pgtable.o physaddr.o gup.o + pat.o pgtable.o physaddr.o gup.o setup_nx.o # Make sure __phys_addr has no stackprotector nostackp := $(call cc-option, -fno-stack-protector) CFLAGS_physaddr.o := $(nostackp) +CFLAGS_setup_nx.o := $(nostackp) obj-$(CONFIG_SMP) += tlb.o
arch/x86/mm/init.c +0 -63
69 lines not on this page · raw message
arch/x86/mm/pat.c +5 -2
@@ -81,6 +81,7 @@ enum {void pat_init (void ) {u64 pat; +bool boot_cpu = !boot_pat_state;if (!pat_enabled)return ;
@@ -122,8 +123,10 @@ void pat_init(void)rdmsrl (MSR_IA32_CR_PAT , boot_pat_state);wrmsrl (MSR_IA32_CR_PAT , pat); -printk (KERN_INFO "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n" , -smp_processor_id (), boot_pat_state, pat); + +if (boot_cpu) +printk (KERN_INFO "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n" , +smp_processor_id (), boot_pat_state, pat); }#undef PAT
arch/x86/mm/setup_nx.c new file +69 -0
69 lines not on this page · raw message
arch/x86/xen/enlighten.c +5 -5
@@ -1082,6 +1082,11 @@ asmlinkage void __init xen_start_kernel(void) __supported_pte_mask |= _PAGE_IOMAP; +#ifdef CONFIG_X86_64 +/* Work out if we support NX */ +check_efer (); +#endif +xen_setup_features ();/* Get mfn list */
@@ -1123,11 +1128,6 @@ asmlinkage void __init xen_start_kernel(void) pgd = (pgd_t *)xen_start_info->pt_base; -#ifdef CONFIG_X86_64 -/* Work out if we support NX */ -check_efer (); -#endif -/* Don't do the full vcpu_info placement stuff until we have a possible map and a non-dummy shared_info. */ per_cpu (xen_vcpu,0 ) = &HYPERVISOR_shared_info->vcpu_info[0 ];