Commit 13bba6fd authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-fixes-for-linus' of...

Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: Fix performance regression caused by paravirt_ops on native kernels
  xen: use header for EXPORT_SYMBOL_GPL
  x86, 32-bit: fix kernel_trap_sp()
  x86: fix percpu_{to,from}_op()
  x86: mtrr: Fix high_width computation when phys-addr is >= 44bit
  x86: Fix false positive section mismatch warnings in the apic code
parents 0130b2d7 b4ecc126
...@@ -498,6 +498,19 @@ config PARAVIRT ...@@ -498,6 +498,19 @@ config PARAVIRT
over full virtualization. However, when run without a hypervisor over full virtualization. However, when run without a hypervisor
the kernel is theoretically slower and slightly larger. the kernel is theoretically slower and slightly larger.
config PARAVIRT_SPINLOCKS
bool "Paravirtualization layer for spinlocks"
depends on PARAVIRT && SMP && EXPERIMENTAL
---help---
Paravirtualized spinlocks allow a pvops backend to replace the
spinlock implementation with something virtualization-friendly
(for example, block the virtual CPU rather than spinning).
Unfortunately the downside is an up to 5% performance hit on
native kernels, with various workloads.
If you are unsure how to answer this question, answer N.
config PARAVIRT_CLOCK config PARAVIRT_CLOCK
bool bool
default n default n
......
...@@ -1443,7 +1443,7 @@ u64 _paravirt_ident_64(u64); ...@@ -1443,7 +1443,7 @@ u64 _paravirt_ident_64(u64);
#define paravirt_nop ((void *)_paravirt_nop) #define paravirt_nop ((void *)_paravirt_nop)
#ifdef CONFIG_SMP #if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT_SPINLOCKS)
static inline int __raw_spin_is_locked(struct raw_spinlock *lock) static inline int __raw_spin_is_locked(struct raw_spinlock *lock)
{ {
......
...@@ -82,22 +82,22 @@ do { \ ...@@ -82,22 +82,22 @@ do { \
case 1: \ case 1: \
asm(op "b %1,"__percpu_arg(0) \ asm(op "b %1,"__percpu_arg(0) \
: "+m" (var) \ : "+m" (var) \
: "ri" ((T__)val)); \ : "qi" ((T__)(val))); \
break; \ break; \
case 2: \ case 2: \
asm(op "w %1,"__percpu_arg(0) \ asm(op "w %1,"__percpu_arg(0) \
: "+m" (var) \ : "+m" (var) \
: "ri" ((T__)val)); \ : "ri" ((T__)(val))); \
break; \ break; \
case 4: \ case 4: \
asm(op "l %1,"__percpu_arg(0) \ asm(op "l %1,"__percpu_arg(0) \
: "+m" (var) \ : "+m" (var) \
: "ri" ((T__)val)); \ : "ri" ((T__)(val))); \
break; \ break; \
case 8: \ case 8: \
asm(op "q %1,"__percpu_arg(0) \ asm(op "q %1,"__percpu_arg(0) \
: "+m" (var) \ : "+m" (var) \
: "re" ((T__)val)); \ : "re" ((T__)(val))); \
break; \ break; \
default: __bad_percpu_size(); \ default: __bad_percpu_size(); \
} \ } \
...@@ -109,7 +109,7 @@ do { \ ...@@ -109,7 +109,7 @@ do { \
switch (sizeof(var)) { \ switch (sizeof(var)) { \
case 1: \ case 1: \
asm(op "b "__percpu_arg(1)",%0" \ asm(op "b "__percpu_arg(1)",%0" \
: "=r" (ret__) \ : "=q" (ret__) \
: "m" (var)); \ : "m" (var)); \
break; \ break; \
case 2: \ case 2: \
......
...@@ -187,14 +187,15 @@ static inline int v8086_mode(struct pt_regs *regs) ...@@ -187,14 +187,15 @@ static inline int v8086_mode(struct pt_regs *regs)
/* /*
* X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
* when it traps. So regs will be the current sp. * when it traps. The previous stack will be directly underneath the saved
* registers, and 'sp/ss' won't even have been saved. Thus the '&regs->sp'.
* *
* This is valid only for kernel mode traps. * This is valid only for kernel mode traps.
*/ */
static inline unsigned long kernel_trap_sp(struct pt_regs *regs) static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
{ {
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
return (unsigned long)regs; return (unsigned long)(&regs->sp);
#else #else
return regs->sp; return regs->sp;
#endif #endif
......
...@@ -172,7 +172,7 @@ static inline int __ticket_spin_is_contended(raw_spinlock_t *lock) ...@@ -172,7 +172,7 @@ static inline int __ticket_spin_is_contended(raw_spinlock_t *lock)
return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1; return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1;
} }
#ifndef CONFIG_PARAVIRT #ifndef CONFIG_PARAVIRT_SPINLOCKS
static inline int __raw_spin_is_locked(raw_spinlock_t *lock) static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
{ {
...@@ -206,7 +206,7 @@ static __always_inline void __raw_spin_lock_flags(raw_spinlock_t *lock, ...@@ -206,7 +206,7 @@ static __always_inline void __raw_spin_lock_flags(raw_spinlock_t *lock,
__raw_spin_lock(lock); __raw_spin_lock(lock);
} }
#endif #endif /* CONFIG_PARAVIRT_SPINLOCKS */
static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)
{ {
......
...@@ -89,7 +89,8 @@ obj-$(CONFIG_DEBUG_NX_TEST) += test_nx.o ...@@ -89,7 +89,8 @@ obj-$(CONFIG_DEBUG_NX_TEST) += test_nx.o
obj-$(CONFIG_VMI) += vmi_32.o vmiclock_32.o obj-$(CONFIG_VMI) += vmi_32.o vmiclock_32.o
obj-$(CONFIG_KVM_GUEST) += kvm.o obj-$(CONFIG_KVM_GUEST) += kvm.o
obj-$(CONFIG_KVM_CLOCK) += kvmclock.o obj-$(CONFIG_KVM_CLOCK) += kvmclock.o
obj-$(CONFIG_PARAVIRT) += paravirt.o paravirt_patch_$(BITS).o paravirt-spinlocks.o obj-$(CONFIG_PARAVIRT) += paravirt.o paravirt_patch_$(BITS).o
obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= paravirt-spinlocks.o
obj-$(CONFIG_PARAVIRT_CLOCK) += pvclock.o obj-$(CONFIG_PARAVIRT_CLOCK) += pvclock.o
obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o
......
...@@ -254,7 +254,7 @@ static int parse_unisys_oem(char *oemptr) ...@@ -254,7 +254,7 @@ static int parse_unisys_oem(char *oemptr)
} }
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
static int find_unisys_acpi_oem_table(unsigned long *oem_addr) static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
{ {
struct acpi_table_header *header = NULL; struct acpi_table_header *header = NULL;
struct es7000_oem_table *table; struct es7000_oem_table *table;
...@@ -285,7 +285,7 @@ static int find_unisys_acpi_oem_table(unsigned long *oem_addr) ...@@ -285,7 +285,7 @@ static int find_unisys_acpi_oem_table(unsigned long *oem_addr)
return 0; return 0;
} }
static void unmap_unisys_acpi_oem_table(unsigned long oem_addr) static void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
{ {
if (!oem_addr) if (!oem_addr)
return; return;
...@@ -306,7 +306,7 @@ static int es7000_check_dsdt(void) ...@@ -306,7 +306,7 @@ static int es7000_check_dsdt(void)
static int es7000_acpi_ret; static int es7000_acpi_ret;
/* Hook from generic ACPI tables.c */ /* Hook from generic ACPI tables.c */
static int es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
{ {
unsigned long oem_addr = 0; unsigned long oem_addr = 0;
int check_dsdt; int check_dsdt;
...@@ -717,7 +717,7 @@ struct apic apic_es7000_cluster = { ...@@ -717,7 +717,7 @@ struct apic apic_es7000_cluster = {
.safe_wait_icr_idle = native_safe_apic_wait_icr_idle, .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
}; };
struct apic apic_es7000 = { struct apic __refdata apic_es7000 = {
.name = "es7000", .name = "es7000",
.probe = probe_es7000, .probe = probe_es7000,
......
...@@ -275,7 +275,11 @@ static void __init print_mtrr_state(void) ...@@ -275,7 +275,11 @@ static void __init print_mtrr_state(void)
} }
printk(KERN_DEBUG "MTRR variable ranges %sabled:\n", printk(KERN_DEBUG "MTRR variable ranges %sabled:\n",
mtrr_state.enabled & 2 ? "en" : "dis"); mtrr_state.enabled & 2 ? "en" : "dis");
high_width = ((size_or_mask ? ffs(size_or_mask) - 1 : 32) - (32 - PAGE_SHIFT) + 3) / 4; if (size_or_mask & 0xffffffffUL)
high_width = ffs(size_or_mask & 0xffffffffUL) - 1;
else
high_width = ffs(size_or_mask>>32) + 32 - 1;
high_width = (high_width - (32 - PAGE_SHIFT) + 3) / 4;
for (i = 0; i < num_var_ranges; ++i) { for (i = 0; i < num_var_ranges; ++i) {
if (mtrr_state.var_ranges[i].mask_lo & (1 << 11)) if (mtrr_state.var_ranges[i].mask_lo & (1 << 11))
printk(KERN_DEBUG " %u base %0*X%05X000 mask %0*X%05X000 %s\n", printk(KERN_DEBUG " %u base %0*X%05X000 mask %0*X%05X000 %s\n",
......
...@@ -134,7 +134,9 @@ static void *get_call_destination(u8 type) ...@@ -134,7 +134,9 @@ static void *get_call_destination(u8 type)
.pv_irq_ops = pv_irq_ops, .pv_irq_ops = pv_irq_ops,
.pv_apic_ops = pv_apic_ops, .pv_apic_ops = pv_apic_ops,
.pv_mmu_ops = pv_mmu_ops, .pv_mmu_ops = pv_mmu_ops,
#ifdef CONFIG_PARAVIRT_SPINLOCKS
.pv_lock_ops = pv_lock_ops, .pv_lock_ops = pv_lock_ops,
#endif
}; };
return *((void **)&tmpl + type); return *((void **)&tmpl + type);
} }
......
...@@ -76,9 +76,9 @@ void ...@@ -76,9 +76,9 @@ void
x86_backtrace(struct pt_regs * const regs, unsigned int depth) x86_backtrace(struct pt_regs * const regs, unsigned int depth)
{ {
struct frame_head *head = (struct frame_head *)frame_pointer(regs); struct frame_head *head = (struct frame_head *)frame_pointer(regs);
unsigned long stack = kernel_trap_sp(regs);
if (!user_mode_vm(regs)) { if (!user_mode_vm(regs)) {
unsigned long stack = kernel_stack_pointer(regs);
if (depth) if (depth)
dump_trace(NULL, regs, (unsigned long *)stack, 0, dump_trace(NULL, regs, (unsigned long *)stack, 0,
&backtrace_ops, &depth); &backtrace_ops, &depth);
......
...@@ -9,5 +9,6 @@ obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ ...@@ -9,5 +9,6 @@ obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \
time.o xen-asm.o xen-asm_$(BITS).o \ time.o xen-asm.o xen-asm_$(BITS).o \
grant-table.o suspend.o grant-table.o suspend.o
obj-$(CONFIG_SMP) += smp.o spinlock.o obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
\ No newline at end of file obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/module.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
......
...@@ -62,15 +62,26 @@ void xen_setup_vcpu_info_placement(void); ...@@ -62,15 +62,26 @@ void xen_setup_vcpu_info_placement(void);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
void xen_smp_init(void); void xen_smp_init(void);
void __init xen_init_spinlocks(void);
__cpuinit void xen_init_lock_cpu(int cpu);
void xen_uninit_lock_cpu(int cpu);
extern cpumask_var_t xen_cpu_initialized_map; extern cpumask_var_t xen_cpu_initialized_map;
#else #else
static inline void xen_smp_init(void) {} static inline void xen_smp_init(void) {}
#endif #endif
#ifdef CONFIG_PARAVIRT_SPINLOCKS
void __init xen_init_spinlocks(void);
__cpuinit void xen_init_lock_cpu(int cpu);
void xen_uninit_lock_cpu(int cpu);
#else
static inline void xen_init_spinlocks(void)
{
}
static inline void xen_init_lock_cpu(int cpu)
{
}
static inline void xen_uninit_lock_cpu(int cpu)
{
}
#endif
/* Declare an asm function, along with symbols needed to make it /* Declare an asm function, along with symbols needed to make it
inlineable */ inlineable */
......
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