diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-24 12:47:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-24 12:47:32 -0400 |
commit | d88f48e12821ab4b2244124d50ac094568f48db5 (patch) | |
tree | 4eb16b46898190aac33ed6125a9a0e734d5be10e | |
parent | be53f58fa0fcd97c62a84f2eb98cff528f8b2443 (diff) | |
parent | 9da77666d6975219281fd400eb9608a047337414 (diff) |
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar:
"Misc fixes:
- fix hotplug bugs
- fix irq live lock
- fix various topology handling bugs
- fix APIC ACK ordering
- fix PV iopl handling
- fix speling
- fix/tweak memcpy_mcsafe() return value
- fix fbcon bug
- remove stray prototypes"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/msr: Remove unused native_read_tscp()
x86/apic: Remove declaration of unused hw_nmi_is_cpu_stuck
x86/oprofile/nmi: Add missing hotplug FROZEN handling
x86/hpet: Use proper mask to modify hotplug action
x86/apic/uv: Fix the hotplug notifier
x86/apb/timer: Use proper mask to modify hotplug action
x86/topology: Use total_cpus not nr_cpu_ids for logical packages
x86/topology: Fix Intel HT disable
x86/topology: Fix logical package mapping
x86/irq: Cure live lock in fixup_irqs()
x86/tsc: Prevent NULL pointer deref in calibrate_delay_is_known()
x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt()
x86/iopl: Fix iopl capability check on Xen PV
x86/iopl/64: Properly context-switch IOPL on Xen PV
selftests/x86: Add an iopl test
x86/mm, x86/mce: Fix return type/value for memcpy_mcsafe()
x86/video: Don't assume all FB devices are PCI devices
arch/x86/irq: Purge useless handler declarations from hw_irq.h
x86: Fix misspellings in comments
61 files changed, 329 insertions, 126 deletions
diff --git a/arch/x86/entry/vdso/vclock_gettime.c b/arch/x86/entry/vdso/vclock_gettime.c index 1a50e09c945b..03c3eb77bfce 100644 --- a/arch/x86/entry/vdso/vclock_gettime.c +++ b/arch/x86/entry/vdso/vclock_gettime.c | |||
@@ -178,7 +178,7 @@ notrace static cycle_t vread_tsc(void) | |||
178 | 178 | ||
179 | /* | 179 | /* |
180 | * GCC likes to generate cmov here, but this branch is extremely | 180 | * GCC likes to generate cmov here, but this branch is extremely |
181 | * predictable (it's just a funciton of time and the likely is | 181 | * predictable (it's just a function of time and the likely is |
182 | * very likely) and there's a data dependence, so force GCC | 182 | * very likely) and there's a data dependence, so force GCC |
183 | * to generate a branch instead. I don't barrier() because | 183 | * to generate a branch instead. I don't barrier() because |
184 | * we don't actually need a barrier, and if this function | 184 | * we don't actually need a barrier, and if this function |
diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c index 69dd11887dd1..6c3b7c1780c9 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c | |||
@@ -649,7 +649,7 @@ int intel_pmu_setup_lbr_filter(struct perf_event *event) | |||
649 | 649 | ||
650 | /* | 650 | /* |
651 | * return the type of control flow change at address "from" | 651 | * return the type of control flow change at address "from" |
652 | * intruction is not necessarily a branch (in case of interrupt). | 652 | * instruction is not necessarily a branch (in case of interrupt). |
653 | * | 653 | * |
654 | * The branch type returned also includes the priv level of the | 654 | * The branch type returned also includes the priv level of the |
655 | * target of the control flow change (X86_BR_USER, X86_BR_KERNEL). | 655 | * target of the control flow change (X86_BR_USER, X86_BR_KERNEL). |
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 68155cafa8a1..ba6ef18528c9 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h | |||
@@ -272,7 +272,7 @@ struct cpu_hw_events { | |||
272 | * events to select for counter rescheduling. | 272 | * events to select for counter rescheduling. |
273 | * | 273 | * |
274 | * Care must be taken as the rescheduling algorithm is O(n!) which | 274 | * Care must be taken as the rescheduling algorithm is O(n!) which |
275 | * will increase scheduling cycles for an over-commited system | 275 | * will increase scheduling cycles for an over-committed system |
276 | * dramatically. The number of such EVENT_CONSTRAINT_OVERLAP() macros | 276 | * dramatically. The number of such EVENT_CONSTRAINT_OVERLAP() macros |
277 | * and its counter masks must be kept at a minimum. | 277 | * and its counter masks must be kept at a minimum. |
278 | */ | 278 | */ |
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 0899cfc8dfe8..98f25bbafac4 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -643,8 +643,8 @@ static inline void entering_irq(void) | |||
643 | 643 | ||
644 | static inline void entering_ack_irq(void) | 644 | static inline void entering_ack_irq(void) |
645 | { | 645 | { |
646 | ack_APIC_irq(); | ||
647 | entering_irq(); | 646 | entering_irq(); |
647 | ack_APIC_irq(); | ||
648 | } | 648 | } |
649 | 649 | ||
650 | static inline void ipi_entering_ack_irq(void) | 650 | static inline void ipi_entering_ack_irq(void) |
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index 21b66dbf3601..a4820d4df617 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h | |||
@@ -52,7 +52,7 @@ int ftrace_int3_handler(struct pt_regs *regs); | |||
52 | * this screws up the trace output when tracing a ia32 task. | 52 | * this screws up the trace output when tracing a ia32 task. |
53 | * Instead of reporting bogus syscalls, just do not trace them. | 53 | * Instead of reporting bogus syscalls, just do not trace them. |
54 | * | 54 | * |
55 | * If the user realy wants these, then they should use the | 55 | * If the user really wants these, then they should use the |
56 | * raw syscall tracepoints with filtering. | 56 | * raw syscall tracepoints with filtering. |
57 | */ | 57 | */ |
58 | #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1 | 58 | #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1 |
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index 1815b736269d..b90e1053049b 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h | |||
@@ -141,6 +141,7 @@ struct irq_alloc_info { | |||
141 | struct irq_cfg { | 141 | struct irq_cfg { |
142 | unsigned int dest_apicid; | 142 | unsigned int dest_apicid; |
143 | u8 vector; | 143 | u8 vector; |
144 | u8 old_vector; | ||
144 | }; | 145 | }; |
145 | 146 | ||
146 | extern struct irq_cfg *irq_cfg(unsigned int irq); | 147 | extern struct irq_cfg *irq_cfg(unsigned int irq); |
@@ -168,20 +169,6 @@ extern atomic_t irq_mis_count; | |||
168 | 169 | ||
169 | extern void elcr_set_level_irq(unsigned int irq); | 170 | extern void elcr_set_level_irq(unsigned int irq); |
170 | 171 | ||
171 | /* SMP */ | ||
172 | extern __visible void smp_apic_timer_interrupt(struct pt_regs *); | ||
173 | extern __visible void smp_spurious_interrupt(struct pt_regs *); | ||
174 | extern __visible void smp_x86_platform_ipi(struct pt_regs *); | ||
175 | extern __visible void smp_error_interrupt(struct pt_regs *); | ||
176 | #ifdef CONFIG_X86_IO_APIC | ||
177 | extern asmlinkage void smp_irq_move_cleanup_interrupt(void); | ||
178 | #endif | ||
179 | #ifdef CONFIG_SMP | ||
180 | extern __visible void smp_reschedule_interrupt(struct pt_regs *); | ||
181 | extern __visible void smp_call_function_interrupt(struct pt_regs *); | ||
182 | extern __visible void smp_call_function_single_interrupt(struct pt_regs *); | ||
183 | #endif | ||
184 | |||
185 | extern char irq_entries_start[]; | 172 | extern char irq_entries_start[]; |
186 | #ifdef CONFIG_TRACING | 173 | #ifdef CONFIG_TRACING |
187 | #define trace_irq_entries_start irq_entries_start | 174 | #define trace_irq_entries_start irq_entries_start |
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 93fb7c1cffda..7a79ee2778b3 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h | |||
@@ -42,14 +42,6 @@ struct saved_msrs { | |||
42 | struct saved_msr *array; | 42 | struct saved_msr *array; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static inline unsigned long long native_read_tscp(unsigned int *aux) | ||
46 | { | ||
47 | unsigned long low, high; | ||
48 | asm volatile(".byte 0x0f,0x01,0xf9" | ||
49 | : "=a" (low), "=d" (high), "=c" (*aux)); | ||
50 | return low | ((u64)high << 32); | ||
51 | } | ||
52 | |||
53 | /* | 45 | /* |
54 | * both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A" | 46 | * both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A" |
55 | * constraint has different meanings. For i386, "A" means exactly | 47 | * constraint has different meanings. For i386, "A" means exactly |
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h index cad82c9c2fde..ceec86eb68e9 100644 --- a/arch/x86/include/asm/rwsem.h +++ b/arch/x86/include/asm/rwsem.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * This should be totally fair - if anything is waiting, a process that wants a | 25 | * This should be totally fair - if anything is waiting, a process that wants a |
26 | * lock will go to the back of the queue. When the currently active lock is | 26 | * lock will go to the back of the queue. When the currently active lock is |
27 | * released, if there's a writer at the front of the queue, then that and only | 27 | * released, if there's a writer at the front of the queue, then that and only |
28 | * that will be woken up; if there's a bunch of consequtive readers at the | 28 | * that will be woken up; if there's a bunch of consecutive readers at the |
29 | * front, then they'll all be woken up, but no other readers will be. | 29 | * front, then they'll all be woken up, but no other readers will be. |
30 | */ | 30 | */ |
31 | 31 | ||
diff --git a/arch/x86/include/asm/string_64.h b/arch/x86/include/asm/string_64.h index ca6ba3607705..90dbbd9666d4 100644 --- a/arch/x86/include/asm/string_64.h +++ b/arch/x86/include/asm/string_64.h | |||
@@ -87,9 +87,9 @@ int strcmp(const char *cs, const char *ct); | |||
87 | * | 87 | * |
88 | * Low level memory copy function that catches machine checks | 88 | * Low level memory copy function that catches machine checks |
89 | * | 89 | * |
90 | * Return true for success, false for fail | 90 | * Return 0 for success, -EFAULT for fail |
91 | */ | 91 | */ |
92 | bool memcpy_mcsafe(void *dst, const void *src, size_t cnt); | 92 | int memcpy_mcsafe(void *dst, const void *src, size_t cnt); |
93 | 93 | ||
94 | #endif /* __KERNEL__ */ | 94 | #endif /* __KERNEL__ */ |
95 | 95 | ||
diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h index 8b2d4bea9962..39171b3646bb 100644 --- a/arch/x86/include/asm/xen/hypervisor.h +++ b/arch/x86/include/asm/xen/hypervisor.h | |||
@@ -62,4 +62,6 @@ void xen_arch_register_cpu(int num); | |||
62 | void xen_arch_unregister_cpu(int num); | 62 | void xen_arch_unregister_cpu(int num); |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | extern void xen_set_iopl_mask(unsigned mask); | ||
66 | |||
65 | #endif /* _ASM_X86_XEN_HYPERVISOR_H */ | 67 | #endif /* _ASM_X86_XEN_HYPERVISOR_H */ |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index e75907601a41..8c2f1ef6ca23 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -956,7 +956,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void) | |||
956 | 956 | ||
957 | /* | 957 | /* |
958 | * Note that the LAPIC address is obtained from the MADT (32-bit value) | 958 | * Note that the LAPIC address is obtained from the MADT (32-bit value) |
959 | * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). | 959 | * and (optionally) overridden by a LAPIC_ADDR_OVR entry (64-bit value). |
960 | */ | 960 | */ |
961 | 961 | ||
962 | count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, | 962 | count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, |
@@ -984,7 +984,7 @@ static int __init acpi_parse_madt_lapic_entries(void) | |||
984 | 984 | ||
985 | /* | 985 | /* |
986 | * Note that the LAPIC address is obtained from the MADT (32-bit value) | 986 | * Note that the LAPIC address is obtained from the MADT (32-bit value) |
987 | * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). | 987 | * and (optionally) overridden by a LAPIC_ADDR_OVR entry (64-bit value). |
988 | */ | 988 | */ |
989 | 989 | ||
990 | count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, | 990 | count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, |
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c index 222a57076039..cefacbad1531 100644 --- a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c | |||
@@ -221,7 +221,7 @@ static int apbt_cpuhp_notify(struct notifier_block *n, | |||
221 | unsigned long cpu = (unsigned long)hcpu; | 221 | unsigned long cpu = (unsigned long)hcpu; |
222 | struct apbt_dev *adev = &per_cpu(cpu_apbt_dev, cpu); | 222 | struct apbt_dev *adev = &per_cpu(cpu_apbt_dev, cpu); |
223 | 223 | ||
224 | switch (action & 0xf) { | 224 | switch (action & ~CPU_TASKS_FROZEN) { |
225 | case CPU_DEAD: | 225 | case CPU_DEAD: |
226 | dw_apb_clockevent_pause(adev->timer); | 226 | dw_apb_clockevent_pause(adev->timer); |
227 | if (system_state == SYSTEM_RUNNING) { | 227 | if (system_state == SYSTEM_RUNNING) { |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 531b9611c51d..d356987a04e9 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1611,7 +1611,7 @@ void __init enable_IR_x2apic(void) | |||
1611 | legacy_pic->mask_all(); | 1611 | legacy_pic->mask_all(); |
1612 | mask_ioapic_entries(); | 1612 | mask_ioapic_entries(); |
1613 | 1613 | ||
1614 | /* If irq_remapping_prepare() succeded, try to enable it */ | 1614 | /* If irq_remapping_prepare() succeeded, try to enable it */ |
1615 | if (ir_stat >= 0) | 1615 | if (ir_stat >= 0) |
1616 | ir_stat = try_to_enable_IR(); | 1616 | ir_stat = try_to_enable_IR(); |
1617 | /* ir_stat contains the remap mode or an error code */ | 1617 | /* ir_stat contains the remap mode or an error code */ |
diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index 3b670df4ba7b..ad59d70bcb1a 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c | |||
@@ -213,6 +213,7 @@ update: | |||
213 | */ | 213 | */ |
214 | cpumask_and(d->old_domain, d->old_domain, cpu_online_mask); | 214 | cpumask_and(d->old_domain, d->old_domain, cpu_online_mask); |
215 | d->move_in_progress = !cpumask_empty(d->old_domain); | 215 | d->move_in_progress = !cpumask_empty(d->old_domain); |
216 | d->cfg.old_vector = d->move_in_progress ? d->cfg.vector : 0; | ||
216 | d->cfg.vector = vector; | 217 | d->cfg.vector = vector; |
217 | cpumask_copy(d->domain, vector_cpumask); | 218 | cpumask_copy(d->domain, vector_cpumask); |
218 | success: | 219 | success: |
@@ -655,46 +656,97 @@ void irq_complete_move(struct irq_cfg *cfg) | |||
655 | } | 656 | } |
656 | 657 | ||
657 | /* | 658 | /* |
658 | * Called with @desc->lock held and interrupts disabled. | 659 | * Called from fixup_irqs() with @desc->lock held and interrupts disabled. |
659 | */ | 660 | */ |
660 | void irq_force_complete_move(struct irq_desc *desc) | 661 | void irq_force_complete_move(struct irq_desc *desc) |
661 | { | 662 | { |
662 | struct irq_data *irqdata = irq_desc_get_irq_data(desc); | 663 | struct irq_data *irqdata = irq_desc_get_irq_data(desc); |
663 | struct apic_chip_data *data = apic_chip_data(irqdata); | 664 | struct apic_chip_data *data = apic_chip_data(irqdata); |
664 | struct irq_cfg *cfg = data ? &data->cfg : NULL; | 665 | struct irq_cfg *cfg = data ? &data->cfg : NULL; |
666 | unsigned int cpu; | ||
665 | 667 | ||
666 | if (!cfg) | 668 | if (!cfg) |
667 | return; | 669 | return; |
668 | 670 | ||
669 | __irq_complete_move(cfg, cfg->vector); | ||
670 | |||
671 | /* | 671 | /* |
672 | * This is tricky. If the cleanup of @data->old_domain has not been | 672 | * This is tricky. If the cleanup of @data->old_domain has not been |
673 | * done yet, then the following setaffinity call will fail with | 673 | * done yet, then the following setaffinity call will fail with |
674 | * -EBUSY. This can leave the interrupt in a stale state. | 674 | * -EBUSY. This can leave the interrupt in a stale state. |
675 | * | 675 | * |
676 | * The cleanup cannot make progress because we hold @desc->lock. So in | 676 | * All CPUs are stuck in stop machine with interrupts disabled so |
677 | * case @data->old_domain is not yet cleaned up, we need to drop the | 677 | * calling __irq_complete_move() would be completely pointless. |
678 | * lock and acquire it again. @desc cannot go away, because the | ||
679 | * hotplug code holds the sparse irq lock. | ||
680 | */ | 678 | */ |
681 | raw_spin_lock(&vector_lock); | 679 | raw_spin_lock(&vector_lock); |
682 | /* Clean out all offline cpus (including ourself) first. */ | 680 | /* |
681 | * Clean out all offline cpus (including the outgoing one) from the | ||
682 | * old_domain mask. | ||
683 | */ | ||
683 | cpumask_and(data->old_domain, data->old_domain, cpu_online_mask); | 684 | cpumask_and(data->old_domain, data->old_domain, cpu_online_mask); |
684 | while (!cpumask_empty(data->old_domain)) { | 685 | |
686 | /* | ||
687 | * If move_in_progress is cleared and the old_domain mask is empty, | ||
688 | * then there is nothing to cleanup. fixup_irqs() will take care of | ||
689 | * the stale vectors on the outgoing cpu. | ||
690 | */ | ||
691 | if (!data->move_in_progress && cpumask_empty(data->old_domain)) { | ||
685 | raw_spin_unlock(&vector_lock); | 692 | raw_spin_unlock(&vector_lock); |
686 | raw_spin_unlock(&desc->lock); | 693 | return; |
687 | cpu_relax(); | 694 | } |
688 | raw_spin_lock(&desc->lock); | 695 | |
696 | /* | ||
697 | * 1) The interrupt is in move_in_progress state. That means that we | ||
698 | * have not seen an interrupt since the io_apic was reprogrammed to | ||
699 | * the new vector. | ||
700 | * | ||
701 | * 2) The interrupt has fired on the new vector, but the cleanup IPIs | ||
702 | * have not been processed yet. | ||
703 | */ | ||
704 | if (data->move_in_progress) { | ||
689 | /* | 705 | /* |
690 | * Reevaluate apic_chip_data. It might have been cleared after | 706 | * In theory there is a race: |
691 | * we dropped @desc->lock. | 707 | * |
708 | * set_ioapic(new_vector) <-- Interrupt is raised before update | ||
709 | * is effective, i.e. it's raised on | ||
710 | * the old vector. | ||
711 | * | ||
712 | * So if the target cpu cannot handle that interrupt before | ||
713 | * the old vector is cleaned up, we get a spurious interrupt | ||
714 | * and in the worst case the ioapic irq line becomes stale. | ||
715 | * | ||
716 | * But in case of cpu hotplug this should be a non issue | ||
717 | * because if the affinity update happens right before all | ||
718 | * cpus rendevouz in stop machine, there is no way that the | ||
719 | * interrupt can be blocked on the target cpu because all cpus | ||
720 | * loops first with interrupts enabled in stop machine, so the | ||
721 | * old vector is not yet cleaned up when the interrupt fires. | ||
722 | * | ||
723 | * So the only way to run into this issue is if the delivery | ||
724 | * of the interrupt on the apic/system bus would be delayed | ||
725 | * beyond the point where the target cpu disables interrupts | ||
726 | * in stop machine. I doubt that it can happen, but at least | ||
727 | * there is a theroretical chance. Virtualization might be | ||
728 | * able to expose this, but AFAICT the IOAPIC emulation is not | ||
729 | * as stupid as the real hardware. | ||
730 | * | ||
731 | * Anyway, there is nothing we can do about that at this point | ||
732 | * w/o refactoring the whole fixup_irq() business completely. | ||
733 | * We print at least the irq number and the old vector number, | ||
734 | * so we have the necessary information when a problem in that | ||
735 | * area arises. | ||
692 | */ | 736 | */ |
693 | data = apic_chip_data(irqdata); | 737 | pr_warn("IRQ fixup: irq %d move in progress, old vector %d\n", |
694 | if (!data) | 738 | irqdata->irq, cfg->old_vector); |
695 | return; | ||
696 | raw_spin_lock(&vector_lock); | ||
697 | } | 739 | } |
740 | /* | ||
741 | * If old_domain is not empty, then other cpus still have the irq | ||
742 | * descriptor set in their vector array. Clean it up. | ||
743 | */ | ||
744 | for_each_cpu(cpu, data->old_domain) | ||
745 | per_cpu(vector_irq, cpu)[cfg->old_vector] = VECTOR_UNUSED; | ||
746 | |||
747 | /* Cleanup the left overs of the (half finished) move */ | ||
748 | cpumask_clear(data->old_domain); | ||
749 | data->move_in_progress = 0; | ||
698 | raw_spin_unlock(&vector_lock); | 750 | raw_spin_unlock(&vector_lock); |
699 | } | 751 | } |
700 | #endif | 752 | #endif |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 624db00583f4..8f4942e2bcbb 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -792,7 +792,8 @@ static int uv_scir_cpu_notify(struct notifier_block *self, unsigned long action, | |||
792 | { | 792 | { |
793 | long cpu = (long)hcpu; | 793 | long cpu = (long)hcpu; |
794 | 794 | ||
795 | switch (action) { | 795 | switch (action & ~CPU_TASKS_FROZEN) { |
796 | case CPU_DOWN_FAILED: | ||
796 | case CPU_ONLINE: | 797 | case CPU_ONLINE: |
797 | uv_heartbeat_enable(cpu); | 798 | uv_heartbeat_enable(cpu); |
798 | break; | 799 | break; |
@@ -860,7 +861,7 @@ int uv_set_vga_state(struct pci_dev *pdev, bool decode, | |||
860 | */ | 861 | */ |
861 | void uv_cpu_init(void) | 862 | void uv_cpu_init(void) |
862 | { | 863 | { |
863 | /* CPU 0 initilization will be done via uv_system_init. */ | 864 | /* CPU 0 initialization will be done via uv_system_init. */ |
864 | if (!uv_blade_info) | 865 | if (!uv_blade_info) |
865 | return; | 866 | return; |
866 | 867 | ||
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 052c9c3026cc..9307f182fe30 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -1088,7 +1088,7 @@ static int apm_get_battery_status(u_short which, u_short *status, | |||
1088 | * @device: identity of device | 1088 | * @device: identity of device |
1089 | * @enable: on/off | 1089 | * @enable: on/off |
1090 | * | 1090 | * |
1091 | * Activate or deactive power management on either a specific device | 1091 | * Activate or deactivate power management on either a specific device |
1092 | * or the entire system (%APM_DEVICE_ALL). | 1092 | * or the entire system (%APM_DEVICE_ALL). |
1093 | */ | 1093 | */ |
1094 | 1094 | ||
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 5026a13356c4..e51021c9207a 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -85,7 +85,7 @@ static void init_amd_k5(struct cpuinfo_x86 *c) | |||
85 | #ifdef CONFIG_X86_32 | 85 | #ifdef CONFIG_X86_32 |
86 | /* | 86 | /* |
87 | * General Systems BIOSen alias the cpu frequency registers | 87 | * General Systems BIOSen alias the cpu frequency registers |
88 | * of the Elan at 0x000df000. Unfortuantly, one of the Linux | 88 | * of the Elan at 0x000df000. Unfortunately, one of the Linux |
89 | * drivers subsequently pokes it, and changes the CPU speed. | 89 | * drivers subsequently pokes it, and changes the CPU speed. |
90 | * Workaround : Remove the unneeded alias. | 90 | * Workaround : Remove the unneeded alias. |
91 | */ | 91 | */ |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 06ad72383b4e..9988caf42161 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -968,7 +968,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) | |||
968 | if (this_cpu->c_identify) | 968 | if (this_cpu->c_identify) |
969 | this_cpu->c_identify(c); | 969 | this_cpu->c_identify(c); |
970 | 970 | ||
971 | /* Clear/Set all flags overriden by options, after probe */ | 971 | /* Clear/Set all flags overridden by options, after probe */ |
972 | for (i = 0; i < NCAPINTS; i++) { | 972 | for (i = 0; i < NCAPINTS; i++) { |
973 | c->x86_capability[i] &= ~cpu_caps_cleared[i]; | 973 | c->x86_capability[i] &= ~cpu_caps_cleared[i]; |
974 | c->x86_capability[i] |= cpu_caps_set[i]; | 974 | c->x86_capability[i] |= cpu_caps_set[i]; |
@@ -1028,7 +1028,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) | |||
1028 | setup_pku(c); | 1028 | setup_pku(c); |
1029 | 1029 | ||
1030 | /* | 1030 | /* |
1031 | * Clear/Set all flags overriden by options, need do it | 1031 | * Clear/Set all flags overridden by options, need do it |
1032 | * before following smp all cpus cap AND. | 1032 | * before following smp all cpus cap AND. |
1033 | */ | 1033 | */ |
1034 | for (i = 0; i < NCAPINTS; i++) { | 1034 | for (i = 0; i < NCAPINTS; i++) { |
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index fcbcb2f678ca..19f57360dfd2 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -42,7 +42,7 @@ EXPORT_SYMBOL_GPL(mtrr_state); | |||
42 | * "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD | 42 | * "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD |
43 | * Opteron Processors" (26094 Rev. 3.30 February 2006), section | 43 | * Opteron Processors" (26094 Rev. 3.30 February 2006), section |
44 | * "13.2.1.2 SYSCFG Register": "The MtrrFixDramModEn bit should be set | 44 | * "13.2.1.2 SYSCFG Register": "The MtrrFixDramModEn bit should be set |
45 | * to 1 during BIOS initalization of the fixed MTRRs, then cleared to | 45 | * to 1 during BIOS initialization of the fixed MTRRs, then cleared to |
46 | * 0 for operation." | 46 | * 0 for operation." |
47 | */ | 47 | */ |
48 | static inline void k8_check_syscfg_dram_mod_en(void) | 48 | static inline void k8_check_syscfg_dram_mod_en(void) |
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c index 21bf92490a7b..8a121991e5ba 100644 --- a/arch/x86/kernel/early_printk.c +++ b/arch/x86/kernel/early_printk.c | |||
@@ -287,7 +287,7 @@ static __init void early_pci_serial_init(char *s) | |||
287 | } | 287 | } |
288 | 288 | ||
289 | /* | 289 | /* |
290 | * Lastly, initalize the hardware | 290 | * Lastly, initialize the hardware |
291 | */ | 291 | */ |
292 | if (*s) { | 292 | if (*s) { |
293 | if (strcmp(s, "nocfg") == 0) | 293 | if (strcmp(s, "nocfg") == 0) |
diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c index 0bc3490420c5..8bd1c003942a 100644 --- a/arch/x86/kernel/fpu/regset.c +++ b/arch/x86/kernel/fpu/regset.c | |||
@@ -8,7 +8,7 @@ | |||
8 | /* | 8 | /* |
9 | * The xstateregs_active() routine is the same as the regset_fpregs_active() routine, | 9 | * The xstateregs_active() routine is the same as the regset_fpregs_active() routine, |
10 | * as the "regset->n" for the xstate regset will be updated based on the feature | 10 | * as the "regset->n" for the xstate regset will be updated based on the feature |
11 | * capabilites supported by the xsave. | 11 | * capabilities supported by the xsave. |
12 | */ | 12 | */ |
13 | int regset_fpregs_active(struct task_struct *target, const struct user_regset *regset) | 13 | int regset_fpregs_active(struct task_struct *target, const struct user_regset *regset) |
14 | { | 14 | { |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index be0ebbb6d1d1..a1f0e4a5c47e 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -717,7 +717,7 @@ static int hpet_cpuhp_notify(struct notifier_block *n, | |||
717 | struct hpet_work_struct work; | 717 | struct hpet_work_struct work; |
718 | struct hpet_dev *hdev = per_cpu(cpu_hpet_dev, cpu); | 718 | struct hpet_dev *hdev = per_cpu(cpu_hpet_dev, cpu); |
719 | 719 | ||
720 | switch (action & 0xf) { | 720 | switch (action & ~CPU_TASKS_FROZEN) { |
721 | case CPU_ONLINE: | 721 | case CPU_ONLINE: |
722 | INIT_DELAYED_WORK_ONSTACK(&work.work, hpet_work); | 722 | INIT_DELAYED_WORK_ONSTACK(&work.work, hpet_work); |
723 | init_completion(&work.complete); | 723 | init_completion(&work.complete); |
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c index 37dae792dbbe..589b3193f102 100644 --- a/arch/x86/kernel/ioport.c +++ b/arch/x86/kernel/ioport.c | |||
@@ -96,9 +96,14 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) | |||
96 | SYSCALL_DEFINE1(iopl, unsigned int, level) | 96 | SYSCALL_DEFINE1(iopl, unsigned int, level) |
97 | { | 97 | { |
98 | struct pt_regs *regs = current_pt_regs(); | 98 | struct pt_regs *regs = current_pt_regs(); |
99 | unsigned int old = (regs->flags >> 12) & 3; | ||
100 | struct thread_struct *t = ¤t->thread; | 99 | struct thread_struct *t = ¤t->thread; |
101 | 100 | ||
101 | /* | ||
102 | * Careful: the IOPL bits in regs->flags are undefined under Xen PV | ||
103 | * and changing them has no effect. | ||
104 | */ | ||
105 | unsigned int old = t->iopl >> X86_EFLAGS_IOPL_BIT; | ||
106 | |||
102 | if (level > 3) | 107 | if (level > 3) |
103 | return -EINVAL; | 108 | return -EINVAL; |
104 | /* Trying to gain more privileges? */ | 109 | /* Trying to gain more privileges? */ |
@@ -106,8 +111,9 @@ SYSCALL_DEFINE1(iopl, unsigned int, level) | |||
106 | if (!capable(CAP_SYS_RAWIO)) | 111 | if (!capable(CAP_SYS_RAWIO)) |
107 | return -EPERM; | 112 | return -EPERM; |
108 | } | 113 | } |
109 | regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12); | 114 | regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | |
110 | t->iopl = level << 12; | 115 | (level << X86_EFLAGS_IOPL_BIT); |
116 | t->iopl = level << X86_EFLAGS_IOPL_BIT; | ||
111 | set_iopl_mask(t->iopl); | 117 | set_iopl_mask(t->iopl); |
112 | 118 | ||
113 | return 0; | 119 | return 0; |
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index 0f8a6bbaaa44..2af478e3fd4e 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c | |||
@@ -271,7 +271,7 @@ static int bzImage64_probe(const char *buf, unsigned long len) | |||
271 | int ret = -ENOEXEC; | 271 | int ret = -ENOEXEC; |
272 | struct setup_header *header; | 272 | struct setup_header *header; |
273 | 273 | ||
274 | /* kernel should be atleast two sectors long */ | 274 | /* kernel should be at least two sectors long */ |
275 | if (len < 2 * 512) { | 275 | if (len < 2 * 512) { |
276 | pr_err("File is too short to be a bzImage\n"); | 276 | pr_err("File is too short to be a bzImage\n"); |
277 | return ret; | 277 | return ret; |
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index ed15cd486d06..2da6ee9ae69b 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c | |||
@@ -609,9 +609,9 @@ static struct notifier_block kgdb_notifier = { | |||
609 | }; | 609 | }; |
610 | 610 | ||
611 | /** | 611 | /** |
612 | * kgdb_arch_init - Perform any architecture specific initalization. | 612 | * kgdb_arch_init - Perform any architecture specific initialization. |
613 | * | 613 | * |
614 | * This function will handle the initalization of any architecture | 614 | * This function will handle the initialization of any architecture |
615 | * specific callbacks. | 615 | * specific callbacks. |
616 | */ | 616 | */ |
617 | int kgdb_arch_init(void) | 617 | int kgdb_arch_init(void) |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 72cef58693c7..1d39bfbd26bb 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -226,7 +226,7 @@ static void kvm_setup_secondary_clock(void) | |||
226 | * registered memory location. If the guest happens to shutdown, this memory | 226 | * registered memory location. If the guest happens to shutdown, this memory |
227 | * won't be valid. In cases like kexec, in which you install a new kernel, this | 227 | * won't be valid. In cases like kexec, in which you install a new kernel, this |
228 | * means a random memory location will be kept being written. So before any | 228 | * means a random memory location will be kept being written. So before any |
229 | * kind of shutdown from our side, we unregister the clock by writting anything | 229 | * kind of shutdown from our side, we unregister the clock by writing anything |
230 | * that does not have the 'enable' bit set in the msr | 230 | * that does not have the 'enable' bit set in the msr |
231 | */ | 231 | */ |
232 | #ifdef CONFIG_KEXEC_CORE | 232 | #ifdef CONFIG_KEXEC_CORE |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index dfa2781610e8..6cbab31ac23a 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <asm/syscalls.h> | 48 | #include <asm/syscalls.h> |
49 | #include <asm/debugreg.h> | 49 | #include <asm/debugreg.h> |
50 | #include <asm/switch_to.h> | 50 | #include <asm/switch_to.h> |
51 | #include <asm/xen/hypervisor.h> | ||
51 | 52 | ||
52 | asmlinkage extern void ret_from_fork(void); | 53 | asmlinkage extern void ret_from_fork(void); |
53 | 54 | ||
@@ -413,6 +414,17 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
413 | task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV)) | 414 | task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV)) |
414 | __switch_to_xtra(prev_p, next_p, tss); | 415 | __switch_to_xtra(prev_p, next_p, tss); |
415 | 416 | ||
417 | #ifdef CONFIG_XEN | ||
418 | /* | ||
419 | * On Xen PV, IOPL bits in pt_regs->flags have no effect, and | ||
420 | * current_pt_regs()->flags may not match the current task's | ||
421 | * intended IOPL. We need to switch it manually. | ||
422 | */ | ||
423 | if (unlikely(static_cpu_has(X86_FEATURE_XENPV) && | ||
424 | prev->iopl != next->iopl)) | ||
425 | xen_set_iopl_mask(next->iopl); | ||
426 | #endif | ||
427 | |||
416 | if (static_cpu_has_bug(X86_BUG_SYSRET_SS_ATTRS)) { | 428 | if (static_cpu_has_bug(X86_BUG_SYSRET_SS_ATTRS)) { |
417 | /* | 429 | /* |
418 | * AMD CPUs have a misfeature: SYSRET sets the SS selector but | 430 | * AMD CPUs have a misfeature: SYSRET sets the SS selector but |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 643dbdccf4bc..b2c99f811c3f 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -274,11 +274,6 @@ int topology_update_package_map(unsigned int apicid, unsigned int cpu) | |||
274 | if (test_and_set_bit(pkg, physical_package_map)) | 274 | if (test_and_set_bit(pkg, physical_package_map)) |
275 | goto found; | 275 | goto found; |
276 | 276 | ||
277 | if (pkg < __max_logical_packages) { | ||
278 | set_bit(pkg, logical_package_map); | ||
279 | physical_to_logical_pkg[pkg] = pkg; | ||
280 | goto found; | ||
281 | } | ||
282 | new = find_first_zero_bit(logical_package_map, __max_logical_packages); | 277 | new = find_first_zero_bit(logical_package_map, __max_logical_packages); |
283 | if (new >= __max_logical_packages) { | 278 | if (new >= __max_logical_packages) { |
284 | physical_to_logical_pkg[pkg] = -1; | 279 | physical_to_logical_pkg[pkg] = -1; |
@@ -317,9 +312,27 @@ static void __init smp_init_package_map(void) | |||
317 | /* | 312 | /* |
318 | * Today neither Intel nor AMD support heterogenous systems. That | 313 | * Today neither Intel nor AMD support heterogenous systems. That |
319 | * might change in the future.... | 314 | * might change in the future.... |
315 | * | ||
316 | * While ideally we'd want '* smp_num_siblings' in the below @ncpus | ||
317 | * computation, this won't actually work since some Intel BIOSes | ||
318 | * report inconsistent HT data when they disable HT. | ||
319 | * | ||
320 | * In particular, they reduce the APIC-IDs to only include the cores, | ||
321 | * but leave the CPUID topology to say there are (2) siblings. | ||
322 | * This means we don't know how many threads there will be until | ||
323 | * after the APIC enumeration. | ||
324 | * | ||
325 | * By not including this we'll sometimes over-estimate the number of | ||
326 | * logical packages by the amount of !present siblings, but this is | ||
327 | * still better than MAX_LOCAL_APIC. | ||
328 | * | ||
329 | * We use total_cpus not nr_cpu_ids because nr_cpu_ids can be limited | ||
330 | * on the command line leading to a similar issue as the HT disable | ||
331 | * problem because the hyperthreads are usually enumerated after the | ||
332 | * primary cores. | ||
320 | */ | 333 | */ |
321 | ncpus = boot_cpu_data.x86_max_cores * smp_num_siblings; | 334 | ncpus = boot_cpu_data.x86_max_cores; |
322 | __max_logical_packages = DIV_ROUND_UP(nr_cpu_ids, ncpus); | 335 | __max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus); |
323 | 336 | ||
324 | /* | 337 | /* |
325 | * Possibly larger than what we need as the number of apic ids per | 338 | * Possibly larger than what we need as the number of apic ids per |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 56380440d862..c9c4c7ce3eb2 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -881,7 +881,7 @@ void tsc_restore_sched_clock_state(void) | |||
881 | local_irq_save(flags); | 881 | local_irq_save(flags); |
882 | 882 | ||
883 | /* | 883 | /* |
884 | * We're comming out of suspend, there's no concurrency yet; don't | 884 | * We're coming out of suspend, there's no concurrency yet; don't |
885 | * bother being nice about the RCU stuff, just write to both | 885 | * bother being nice about the RCU stuff, just write to both |
886 | * data fields. | 886 | * data fields. |
887 | */ | 887 | */ |
@@ -1306,11 +1306,15 @@ void __init tsc_init(void) | |||
1306 | unsigned long calibrate_delay_is_known(void) | 1306 | unsigned long calibrate_delay_is_known(void) |
1307 | { | 1307 | { |
1308 | int sibling, cpu = smp_processor_id(); | 1308 | int sibling, cpu = smp_processor_id(); |
1309 | struct cpumask *mask = topology_core_cpumask(cpu); | ||
1309 | 1310 | ||
1310 | if (!tsc_disabled && !cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC)) | 1311 | if (!tsc_disabled && !cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC)) |
1311 | return 0; | 1312 | return 0; |
1312 | 1313 | ||
1313 | sibling = cpumask_any_but(topology_core_cpumask(cpu), cpu); | 1314 | if (!mask) |
1315 | return 0; | ||
1316 | |||
1317 | sibling = cpumask_any_but(mask, cpu); | ||
1314 | if (sibling < nr_cpu_ids) | 1318 | if (sibling < nr_cpu_ids) |
1315 | return cpu_data(sibling).loops_per_jiffy; | 1319 | return cpu_data(sibling).loops_per_jiffy; |
1316 | return 0; | 1320 | return 0; |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 6bdfbc23ecaa..70e95d097ef1 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -479,7 +479,7 @@ static bool spte_is_locklessly_modifiable(u64 spte) | |||
479 | static bool spte_has_volatile_bits(u64 spte) | 479 | static bool spte_has_volatile_bits(u64 spte) |
480 | { | 480 | { |
481 | /* | 481 | /* |
482 | * Always atomicly update spte if it can be updated | 482 | * Always atomically update spte if it can be updated |
483 | * out of mmu-lock, it can ensure dirty bit is not lost, | 483 | * out of mmu-lock, it can ensure dirty bit is not lost, |
484 | * also, it can help us to get a stable is_writable_pte() | 484 | * also, it can help us to get a stable is_writable_pte() |
485 | * to ensure tlb flush is not missed. | 485 | * to ensure tlb flush is not missed. |
@@ -550,7 +550,7 @@ static bool mmu_spte_update(u64 *sptep, u64 new_spte) | |||
550 | 550 | ||
551 | /* | 551 | /* |
552 | * For the spte updated out of mmu-lock is safe, since | 552 | * For the spte updated out of mmu-lock is safe, since |
553 | * we always atomicly update it, see the comments in | 553 | * we always atomically update it, see the comments in |
554 | * spte_has_volatile_bits(). | 554 | * spte_has_volatile_bits(). |
555 | */ | 555 | */ |
556 | if (spte_is_locklessly_modifiable(old_spte) && | 556 | if (spte_is_locklessly_modifiable(old_spte) && |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index efc243e4dabf..ee1c8a93871c 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -5528,7 +5528,7 @@ static int handle_set_cr4(struct kvm_vcpu *vcpu, unsigned long val) | |||
5528 | return kvm_set_cr4(vcpu, val); | 5528 | return kvm_set_cr4(vcpu, val); |
5529 | } | 5529 | } |
5530 | 5530 | ||
5531 | /* called to set cr0 as approriate for clts instruction exit. */ | 5531 | /* called to set cr0 as appropriate for clts instruction exit. */ |
5532 | static void handle_clts(struct kvm_vcpu *vcpu) | 5532 | static void handle_clts(struct kvm_vcpu *vcpu) |
5533 | { | 5533 | { |
5534 | if (is_guest_mode(vcpu)) { | 5534 | if (is_guest_mode(vcpu)) { |
@@ -7267,7 +7267,7 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu) | |||
7267 | /* The value to write might be 32 or 64 bits, depending on L1's long | 7267 | /* The value to write might be 32 or 64 bits, depending on L1's long |
7268 | * mode, and eventually we need to write that into a field of several | 7268 | * mode, and eventually we need to write that into a field of several |
7269 | * possible lengths. The code below first zero-extends the value to 64 | 7269 | * possible lengths. The code below first zero-extends the value to 64 |
7270 | * bit (field_value), and then copies only the approriate number of | 7270 | * bit (field_value), and then copies only the appropriate number of |
7271 | * bits into the vmcs12 field. | 7271 | * bits into the vmcs12 field. |
7272 | */ | 7272 | */ |
7273 | u64 field_value = 0; | 7273 | u64 field_value = 0; |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index e260ccbc8f55..742d0f7d3556 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1562,7 +1562,7 @@ static cycle_t read_tsc(void) | |||
1562 | 1562 | ||
1563 | /* | 1563 | /* |
1564 | * GCC likes to generate cmov here, but this branch is extremely | 1564 | * GCC likes to generate cmov here, but this branch is extremely |
1565 | * predictable (it's just a funciton of time and the likely is | 1565 | * predictable (it's just a function of time and the likely is |
1566 | * very likely) and there's a data dependence, so force GCC | 1566 | * very likely) and there's a data dependence, so force GCC |
1567 | * to generate a branch instead. I don't barrier() because | 1567 | * to generate a branch instead. I don't barrier() because |
1568 | * we don't actually need a barrier, and if this function | 1568 | * we don't actually need a barrier, and if this function |
diff --git a/arch/x86/lib/memcpy_64.S b/arch/x86/lib/memcpy_64.S index cbb8ee5830ff..2ec0b0abbfaa 100644 --- a/arch/x86/lib/memcpy_64.S +++ b/arch/x86/lib/memcpy_64.S | |||
@@ -1,6 +1,7 @@ | |||
1 | /* Copyright 2002 Andi Kleen */ | 1 | /* Copyright 2002 Andi Kleen */ |
2 | 2 | ||
3 | #include <linux/linkage.h> | 3 | #include <linux/linkage.h> |
4 | #include <asm/errno.h> | ||
4 | #include <asm/cpufeatures.h> | 5 | #include <asm/cpufeatures.h> |
5 | #include <asm/alternative-asm.h> | 6 | #include <asm/alternative-asm.h> |
6 | 7 | ||
@@ -268,16 +269,16 @@ ENTRY(memcpy_mcsafe) | |||
268 | decl %ecx | 269 | decl %ecx |
269 | jnz .L_copy_trailing_bytes | 270 | jnz .L_copy_trailing_bytes |
270 | 271 | ||
271 | /* Copy successful. Return true */ | 272 | /* Copy successful. Return zero */ |
272 | .L_done_memcpy_trap: | 273 | .L_done_memcpy_trap: |
273 | xorq %rax, %rax | 274 | xorq %rax, %rax |
274 | ret | 275 | ret |
275 | ENDPROC(memcpy_mcsafe) | 276 | ENDPROC(memcpy_mcsafe) |
276 | 277 | ||
277 | .section .fixup, "ax" | 278 | .section .fixup, "ax" |
278 | /* Return false for any failure */ | 279 | /* Return -EFAULT for any failure */ |
279 | .L_memcpy_mcsafe_fail: | 280 | .L_memcpy_mcsafe_fail: |
280 | mov $1, %rax | 281 | mov $-EFAULT, %rax |
281 | ret | 282 | ret |
282 | 283 | ||
283 | .previous | 284 | .previous |
diff --git a/arch/x86/lib/memset_64.S b/arch/x86/lib/memset_64.S index c9c81227ea37..e1229ecd2a82 100644 --- a/arch/x86/lib/memset_64.S +++ b/arch/x86/lib/memset_64.S | |||
@@ -9,7 +9,7 @@ | |||
9 | /* | 9 | /* |
10 | * ISO C memset - set a memory block to a byte value. This function uses fast | 10 | * ISO C memset - set a memory block to a byte value. This function uses fast |
11 | * string to get better performance than the original function. The code is | 11 | * string to get better performance than the original function. The code is |
12 | * simpler and shorter than the orignal function as well. | 12 | * simpler and shorter than the original function as well. |
13 | * | 13 | * |
14 | * rdi destination | 14 | * rdi destination |
15 | * rsi value (char) | 15 | * rsi value (char) |
diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c index a0a0b9861902..80476878eb4c 100644 --- a/arch/x86/mm/mpx.c +++ b/arch/x86/mm/mpx.c | |||
@@ -728,14 +728,14 @@ static inline unsigned long bd_entry_virt_space(struct mm_struct *mm) | |||
728 | 728 | ||
729 | /* | 729 | /* |
730 | * This covers 32-bit emulation as well as 32-bit kernels | 730 | * This covers 32-bit emulation as well as 32-bit kernels |
731 | * running on 64-bit harware. | 731 | * running on 64-bit hardware. |
732 | */ | 732 | */ |
733 | if (!is_64bit_mm(mm)) | 733 | if (!is_64bit_mm(mm)) |
734 | return (4ULL * GB) / MPX_BD_NR_ENTRIES_32; | 734 | return (4ULL * GB) / MPX_BD_NR_ENTRIES_32; |
735 | 735 | ||
736 | /* | 736 | /* |
737 | * 'x86_virt_bits' returns what the hardware is capable | 737 | * 'x86_virt_bits' returns what the hardware is capable |
738 | * of, and returns the full >32-bit adddress space when | 738 | * of, and returns the full >32-bit address space when |
739 | * running 32-bit kernels on 64-bit hardware. | 739 | * running 32-bit kernels on 64-bit hardware. |
740 | */ | 740 | */ |
741 | virt_space = (1ULL << boot_cpu_data.x86_virt_bits); | 741 | virt_space = (1ULL << boot_cpu_data.x86_virt_bits); |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 04e2e7144bee..faec01e7a17d 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -149,7 +149,7 @@ enum { | |||
149 | PAT_WT = 4, /* Write Through */ | 149 | PAT_WT = 4, /* Write Through */ |
150 | PAT_WP = 5, /* Write Protected */ | 150 | PAT_WP = 5, /* Write Protected */ |
151 | PAT_WB = 6, /* Write Back (default) */ | 151 | PAT_WB = 6, /* Write Back (default) */ |
152 | PAT_UC_MINUS = 7, /* UC, but can be overriden by MTRR */ | 152 | PAT_UC_MINUS = 7, /* UC, but can be overridden by MTRR */ |
153 | }; | 153 | }; |
154 | 154 | ||
155 | #define CM(c) (_PAGE_CACHE_MODE_ ## c) | 155 | #define CM(c) (_PAGE_CACHE_MODE_ ## c) |
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 1d2e6392f5fa..0e07e0968c3a 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c | |||
@@ -437,7 +437,8 @@ static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action, | |||
437 | void *data) | 437 | void *data) |
438 | { | 438 | { |
439 | int cpu = (unsigned long)data; | 439 | int cpu = (unsigned long)data; |
440 | switch (action) { | 440 | |
441 | switch (action & ~CPU_TASKS_FROZEN) { | ||
441 | case CPU_DOWN_FAILED: | 442 | case CPU_DOWN_FAILED: |
442 | case CPU_ONLINE: | 443 | case CPU_ONLINE: |
443 | smp_call_function_single(cpu, nmi_cpu_up, NULL, 0); | 444 | smp_call_function_single(cpu, nmi_cpu_up, NULL, 0); |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_bma023.c b/arch/x86/platform/intel-mid/device_libs/platform_bma023.c index 0ae7f2ae2296..c26cf393d35a 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_bma023.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_bma023.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_bma023.c: bma023 platform data initilization file | 2 | * platform_bma023.c: bma023 platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * | 5 | * |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_emc1403.c b/arch/x86/platform/intel-mid/device_libs/platform_emc1403.c index 69a783689d21..c259fb6c8f4f 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_emc1403.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_emc1403.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_emc1403.c: emc1403 platform data initilization file | 2 | * platform_emc1403.c: emc1403 platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c index dccae6b0413f..52534ec29765 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_gpio_keys.c: gpio_keys platform data initilization file | 2 | * platform_gpio_keys.c: gpio_keys platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lis331.c b/arch/x86/platform/intel-mid/device_libs/platform_lis331.c index 54226de7541a..a35cf912de43 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_lis331.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_lis331.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_lis331.c: lis331 platform data initilization file | 2 | * platform_lis331.c: lis331 platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max7315.c b/arch/x86/platform/intel-mid/device_libs/platform_max7315.c index 2c8acbc1e9ad..6e075afa7877 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_max7315.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_max7315.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_max7315.c: max7315 platform data initilization file | 2 | * platform_max7315.c: max7315 platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c b/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c index cfe9a47a1e87..ee22864bbc2f 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_mpu3050.c: mpu3050 platform data initilization file | 2 | * platform_mpu3050.c: mpu3050 platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic.c b/arch/x86/platform/intel-mid/device_libs/platform_msic.c index 9f4a775a69d6..e421106c11cf 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_msic.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_msic.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_msic.c: MSIC platform data initilization file | 2 | * platform_msic.c: MSIC platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c index 29629397d2b3..cb3490ecb341 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_msic_audio.c: MSIC audio platform data initilization file | 2 | * platform_msic_audio.c: MSIC audio platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c index f446c33df1a8..4f72193939a6 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_msic_battery.c: MSIC battery platform data initilization file | 2 | * platform_msic_battery.c: MSIC battery platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c index 2a4f7b1dd917..70de5b531ba0 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_msic_gpio.c: MSIC GPIO platform data initilization file | 2 | * platform_msic_gpio.c: MSIC GPIO platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c index 6497111ddb54..3d7c2011b6cf 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_msic_ocd.c: MSIC OCD platform data initilization file | 2 | * platform_msic_ocd.c: MSIC OCD platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c index 83a3459bc337..038f618fbc52 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_msic_power_btn.c: MSIC power btn platform data initilization file | 2 | * platform_msic_power_btn.c: MSIC power btn platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c index a351878b96bc..114a5755b1e4 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_msic_thermal.c: msic_thermal platform data initilization file | 2 | * platform_msic_thermal.c: msic_thermal platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c b/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c index 65c2a9a19db4..e30cb62e3300 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_pmic_gpio.c: PMIC GPIO platform data initilization file | 2 | * platform_pmic_gpio.c: PMIC GPIO platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c b/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c index 740fc757050c..b1526b95fd43 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_tc35876x.c: tc35876x platform data initilization file | 2 | * platform_tc35876x.c: tc35876x platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_tca6416.c b/arch/x86/platform/intel-mid/device_libs/platform_tca6416.c index 33be0b3be6e1..4f41372ce400 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_tca6416.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_tca6416.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * platform_tca6416.c: tca6416 platform data initilization file | 2 | * platform_tca6416.c: tca6416 platform data initialization file |
3 | * | 3 | * |
4 | * (C) Copyright 2013 Intel Corporation | 4 | * (C) Copyright 2013 Intel Corporation |
5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> | 5 | * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> |
diff --git a/arch/x86/purgatory/stack.S b/arch/x86/purgatory/stack.S index 3cefba1fefc8..50a4147f91fb 100644 --- a/arch/x86/purgatory/stack.S +++ b/arch/x86/purgatory/stack.S | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* A stack for the loaded kernel. | 10 | /* A stack for the loaded kernel. |
11 | * Seperate and in the data section so it can be prepopulated. | 11 | * Separate and in the data section so it can be prepopulated. |
12 | */ | 12 | */ |
13 | .data | 13 | .data |
14 | .balign 4096 | 14 | .balign 4096 |
diff --git a/arch/x86/video/fbdev.c b/arch/x86/video/fbdev.c index d5644bbe8cba..9fd24846d094 100644 --- a/arch/x86/video/fbdev.c +++ b/arch/x86/video/fbdev.c | |||
@@ -14,26 +14,24 @@ | |||
14 | int fb_is_primary_device(struct fb_info *info) | 14 | int fb_is_primary_device(struct fb_info *info) |
15 | { | 15 | { |
16 | struct device *device = info->device; | 16 | struct device *device = info->device; |
17 | struct pci_dev *pci_dev = NULL; | ||
18 | struct pci_dev *default_device = vga_default_device(); | 17 | struct pci_dev *default_device = vga_default_device(); |
19 | struct resource *res = NULL; | 18 | struct pci_dev *pci_dev; |
19 | struct resource *res; | ||
20 | 20 | ||
21 | if (device) | 21 | if (!device || !dev_is_pci(device)) |
22 | pci_dev = to_pci_dev(device); | ||
23 | |||
24 | if (!pci_dev) | ||
25 | return 0; | 22 | return 0; |
26 | 23 | ||
24 | pci_dev = to_pci_dev(device); | ||
25 | |||
27 | if (default_device) { | 26 | if (default_device) { |
28 | if (pci_dev == default_device) | 27 | if (pci_dev == default_device) |
29 | return 1; | 28 | return 1; |
30 | else | 29 | return 0; |
31 | return 0; | ||
32 | } | 30 | } |
33 | 31 | ||
34 | res = &pci_dev->resource[PCI_ROM_RESOURCE]; | 32 | res = pci_dev->resource + PCI_ROM_RESOURCE; |
35 | 33 | ||
36 | if (res && res->flags & IORESOURCE_ROM_SHADOW) | 34 | if (res->flags & IORESOURCE_ROM_SHADOW) |
37 | return 1; | 35 | return 1; |
38 | 36 | ||
39 | return 0; | 37 | return 0; |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 2379a5a88504..880862c7d9dd 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -962,7 +962,7 @@ static void xen_load_sp0(struct tss_struct *tss, | |||
962 | tss->x86_tss.sp0 = thread->sp0; | 962 | tss->x86_tss.sp0 = thread->sp0; |
963 | } | 963 | } |
964 | 964 | ||
965 | static void xen_set_iopl_mask(unsigned mask) | 965 | void xen_set_iopl_mask(unsigned mask) |
966 | { | 966 | { |
967 | struct physdev_set_iopl set_iopl; | 967 | struct physdev_set_iopl set_iopl; |
968 | 968 | ||
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index c913ca4f6958..478a2de543a5 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -1256,7 +1256,7 @@ static void __init xen_pagetable_cleanhighmap(void) | |||
1256 | xen_cleanhighmap(addr, addr + size); | 1256 | xen_cleanhighmap(addr, addr + size); |
1257 | xen_start_info->pt_base = (unsigned long)__va(__pa(xen_start_info->pt_base)); | 1257 | xen_start_info->pt_base = (unsigned long)__va(__pa(xen_start_info->pt_base)); |
1258 | #ifdef DEBUG | 1258 | #ifdef DEBUG |
1259 | /* This is superflous and is not neccessary, but you know what | 1259 | /* This is superfluous and is not necessary, but you know what |
1260 | * lets do it. The MODULES_VADDR -> MODULES_END should be clear of | 1260 | * lets do it. The MODULES_VADDR -> MODULES_END should be clear of |
1261 | * anything at this stage. */ | 1261 | * anything at this stage. */ |
1262 | xen_cleanhighmap(MODULES_VADDR, roundup(MODULES_VADDR, PUD_SIZE) - 1); | 1262 | xen_cleanhighmap(MODULES_VADDR, roundup(MODULES_VADDR, PUD_SIZE) - 1); |
@@ -1474,7 +1474,7 @@ static void xen_write_cr3(unsigned long cr3) | |||
1474 | /* | 1474 | /* |
1475 | * At the start of the day - when Xen launches a guest, it has already | 1475 | * At the start of the day - when Xen launches a guest, it has already |
1476 | * built pagetables for the guest. We diligently look over them | 1476 | * built pagetables for the guest. We diligently look over them |
1477 | * in xen_setup_kernel_pagetable and graft as appropiate them in the | 1477 | * in xen_setup_kernel_pagetable and graft as appropriate them in the |
1478 | * init_level4_pgt and its friends. Then when we are happy we load | 1478 | * init_level4_pgt and its friends. Then when we are happy we load |
1479 | * the new init_level4_pgt - and continue on. | 1479 | * the new init_level4_pgt - and continue on. |
1480 | * | 1480 | * |
@@ -2792,7 +2792,7 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token, | |||
2792 | struct remap_data *rmd = data; | 2792 | struct remap_data *rmd = data; |
2793 | pte_t pte = pte_mkspecial(mfn_pte(*rmd->mfn, rmd->prot)); | 2793 | pte_t pte = pte_mkspecial(mfn_pte(*rmd->mfn, rmd->prot)); |
2794 | 2794 | ||
2795 | /* If we have a contigious range, just update the mfn itself, | 2795 | /* If we have a contiguous range, just update the mfn itself, |
2796 | else update pointer to be "next mfn". */ | 2796 | else update pointer to be "next mfn". */ |
2797 | if (rmd->contiguous) | 2797 | if (rmd->contiguous) |
2798 | (*rmd->mfn)++; | 2798 | (*rmd->mfn)++; |
@@ -2833,7 +2833,7 @@ static int do_remap_gfn(struct vm_area_struct *vma, | |||
2833 | 2833 | ||
2834 | rmd.mfn = gfn; | 2834 | rmd.mfn = gfn; |
2835 | rmd.prot = prot; | 2835 | rmd.prot = prot; |
2836 | /* We use the err_ptr to indicate if there we are doing a contigious | 2836 | /* We use the err_ptr to indicate if there we are doing a contiguous |
2837 | * mapping or a discontigious mapping. */ | 2837 | * mapping or a discontigious mapping. */ |
2838 | rmd.contiguous = !err_ptr; | 2838 | rmd.contiguous = !err_ptr; |
2839 | 2839 | ||
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S index de93b20fa0d2..7f8d8abf4c1a 100644 --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S | |||
@@ -26,7 +26,7 @@ | |||
26 | (1 << XENFEAT_auto_translated_physmap) | \ | 26 | (1 << XENFEAT_auto_translated_physmap) | \ |
27 | (1 << XENFEAT_supervisor_mode_kernel) | \ | 27 | (1 << XENFEAT_supervisor_mode_kernel) | \ |
28 | (1 << XENFEAT_hvm_callback_vector)) | 28 | (1 << XENFEAT_hvm_callback_vector)) |
29 | /* The XENFEAT_writable_page_tables is not stricly neccessary as we set that | 29 | /* The XENFEAT_writable_page_tables is not stricly necessary as we set that |
30 | * up regardless whether this CONFIG option is enabled or not, but it | 30 | * up regardless whether this CONFIG option is enabled or not, but it |
31 | * clarifies what the right flags need to be. | 31 | * clarifies what the right flags need to be. |
32 | */ | 32 | */ |
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 7ec5b86735f3..4630eeae18e0 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
@@ -65,7 +65,6 @@ static inline bool trigger_allbutself_cpu_backtrace(void) | |||
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | #ifdef CONFIG_LOCKUP_DETECTOR | 67 | #ifdef CONFIG_LOCKUP_DETECTOR |
68 | int hw_nmi_is_cpu_stuck(struct pt_regs *); | ||
69 | u64 hw_nmi_get_sample_period(int watchdog_thresh); | 68 | u64 hw_nmi_get_sample_period(int watchdog_thresh); |
70 | extern int nmi_watchdog_enabled; | 69 | extern int nmi_watchdog_enabled; |
71 | extern int soft_watchdog_enabled; | 70 | extern int soft_watchdog_enabled; |
diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index d5ce7d7aae3e..b47ebd170690 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile | |||
@@ -5,7 +5,7 @@ include ../lib.mk | |||
5 | .PHONY: all all_32 all_64 warn_32bit_failure clean | 5 | .PHONY: all all_32 all_64 warn_32bit_failure clean |
6 | 6 | ||
7 | TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_syscall \ | 7 | TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_syscall \ |
8 | check_initial_reg_state sigreturn ldt_gdt | 8 | check_initial_reg_state sigreturn ldt_gdt iopl |
9 | TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault test_syscall_vdso unwind_vdso \ | 9 | TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault test_syscall_vdso unwind_vdso \ |
10 | test_FCMOV test_FCOMI test_FISTTP \ | 10 | test_FCMOV test_FCOMI test_FISTTP \ |
11 | vdso_restorer | 11 | vdso_restorer |
diff --git a/tools/testing/selftests/x86/iopl.c b/tools/testing/selftests/x86/iopl.c new file mode 100644 index 000000000000..c496ca97bc18 --- /dev/null +++ b/tools/testing/selftests/x86/iopl.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * iopl.c - Test case for a Linux on Xen 64-bit bug | ||
3 | * Copyright (c) 2015 Andrew Lutomirski | ||
4 | */ | ||
5 | |||
6 | #define _GNU_SOURCE | ||
7 | #include <err.h> | ||
8 | #include <stdio.h> | ||
9 | #include <stdint.h> | ||
10 | #include <signal.h> | ||
11 | #include <setjmp.h> | ||
12 | #include <stdlib.h> | ||
13 | #include <string.h> | ||
14 | #include <errno.h> | ||
15 | #include <unistd.h> | ||
16 | #include <sys/types.h> | ||
17 | #include <sys/wait.h> | ||
18 | #include <stdbool.h> | ||
19 | #include <sched.h> | ||
20 | #include <sys/io.h> | ||
21 | |||
22 | static int nerrs = 0; | ||
23 | |||
24 | static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *), | ||
25 | int flags) | ||
26 | { | ||
27 | struct sigaction sa; | ||
28 | memset(&sa, 0, sizeof(sa)); | ||
29 | sa.sa_sigaction = handler; | ||
30 | sa.sa_flags = SA_SIGINFO | flags; | ||
31 | sigemptyset(&sa.sa_mask); | ||
32 | if (sigaction(sig, &sa, 0)) | ||
33 | err(1, "sigaction"); | ||
34 | |||
35 | } | ||
36 | |||
37 | static jmp_buf jmpbuf; | ||
38 | |||
39 | static void sigsegv(int sig, siginfo_t *si, void *ctx_void) | ||
40 | { | ||
41 | siglongjmp(jmpbuf, 1); | ||
42 | } | ||
43 | |||
44 | int main(void) | ||
45 | { | ||
46 | cpu_set_t cpuset; | ||
47 | CPU_ZERO(&cpuset); | ||
48 | CPU_SET(0, &cpuset); | ||
49 | if (sched_setaffinity(0, sizeof(cpuset), &cpuset) != 0) | ||
50 | err(1, "sched_setaffinity to CPU 0"); | ||
51 | |||
52 | /* Probe for iopl support. Note that iopl(0) works even as nonroot. */ | ||
53 | if (iopl(3) != 0) { | ||
54 | printf("[OK]\tiopl(3) failed (%d) -- try running as root\n", | ||
55 | errno); | ||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | /* Restore our original state prior to starting the test. */ | ||
60 | if (iopl(0) != 0) | ||
61 | err(1, "iopl(0)"); | ||
62 | |||
63 | pid_t child = fork(); | ||
64 | if (child == -1) | ||
65 | err(1, "fork"); | ||
66 | |||
67 | if (child == 0) { | ||
68 | printf("\tchild: set IOPL to 3\n"); | ||
69 | if (iopl(3) != 0) | ||
70 | err(1, "iopl"); | ||
71 | |||
72 | printf("[RUN]\tchild: write to 0x80\n"); | ||
73 | asm volatile ("outb %%al, $0x80" : : "a" (0)); | ||
74 | |||
75 | return 0; | ||
76 | } else { | ||
77 | int status; | ||
78 | if (waitpid(child, &status, 0) != child || | ||
79 | !WIFEXITED(status)) { | ||
80 | printf("[FAIL]\tChild died\n"); | ||
81 | nerrs++; | ||
82 | } else if (WEXITSTATUS(status) != 0) { | ||
83 | printf("[FAIL]\tChild failed\n"); | ||
84 | nerrs++; | ||
85 | } else { | ||
86 | printf("[OK]\tChild succeeded\n"); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | printf("[RUN]\tparent: write to 0x80 (should fail)\n"); | ||
91 | |||
92 | sethandler(SIGSEGV, sigsegv, 0); | ||
93 | if (sigsetjmp(jmpbuf, 1) != 0) { | ||
94 | printf("[OK]\twrite was denied\n"); | ||
95 | } else { | ||
96 | asm volatile ("outb %%al, $0x80" : : "a" (0)); | ||
97 | printf("[FAIL]\twrite was allowed\n"); | ||
98 | nerrs++; | ||
99 | } | ||
100 | |||
101 | /* Test the capability checks. */ | ||
102 | printf("\tiopl(3)\n"); | ||
103 | if (iopl(3) != 0) | ||
104 | err(1, "iopl(3)"); | ||
105 | |||
106 | printf("\tDrop privileges\n"); | ||
107 | if (setresuid(1, 1, 1) != 0) { | ||
108 | printf("[WARN]\tDropping privileges failed\n"); | ||
109 | goto done; | ||
110 | } | ||
111 | |||
112 | printf("[RUN]\tiopl(3) unprivileged but with IOPL==3\n"); | ||
113 | if (iopl(3) != 0) { | ||
114 | printf("[FAIL]\tiopl(3) should work if iopl is already 3 even if unprivileged\n"); | ||
115 | nerrs++; | ||
116 | } | ||
117 | |||
118 | printf("[RUN]\tiopl(0) unprivileged\n"); | ||
119 | if (iopl(0) != 0) { | ||
120 | printf("[FAIL]\tiopl(0) should work if iopl is already 3 even if unprivileged\n"); | ||
121 | nerrs++; | ||
122 | } | ||
123 | |||
124 | printf("[RUN]\tiopl(3) unprivileged\n"); | ||
125 | if (iopl(3) == 0) { | ||
126 | printf("[FAIL]\tiopl(3) should fail if when unprivileged if iopl==0\n"); | ||
127 | nerrs++; | ||
128 | } else { | ||
129 | printf("[OK]\tFailed as expected\n"); | ||
130 | } | ||
131 | |||
132 | done: | ||
133 | return nerrs ? 1 : 0; | ||
134 | } | ||
135 | |||