android_kernel_google_msm/arch/x86/kernel
Suresh Siddha b10e02daa7 x86, kvm: fix kvm's usage of kernel_fpu_begin/end()
commit b1a74bf821 upstream.

Preemption is disabled between kernel_fpu_begin/end() and as such
it is not a good idea to use these routines in kvm_load/put_guest_fpu()
which can be very far apart.

kvm_load/put_guest_fpu() routines are already called with
preemption disabled and KVM already uses the preempt notifier to save
the guest fpu state using kvm_put_guest_fpu().

So introduce __kernel_fpu_begin/end() routines which don't touch
preemption and use them instead of kernel_fpu_begin/end()
for KVM's use model of saving/restoring guest FPU state.

Also with this change (and with eagerFPU model), fix the host cr0.TS vm-exit
state in the case of VMX. For eagerFPU case, host cr0.TS is always clear.
So no need to worry about it. For the traditional lazyFPU restore case,
change the cr0.TS bit for the host state during vm-exit to be always clear
and cr0.TS bit is set in the __vmx_load_host_state() when the FPU
(guest FPU or the host task's FPU) state is not active. This ensures
that the host/guest FPU state is properly saved, restored
during context-switch and with interrupts (using irq_fpu_usable()) not
stomping on the active FPU state.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Link: http://lkml.kernel.org/r/1348164109.26695.338.camel@sbsiddha-desk.sc.intel.com
Cc: Avi Kivity <avi@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
[xr: Backported to 3.4: Adjust context]
Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
2015-09-18 09:20:46 +08:00
..
acpi ACPI: Add a quirk for "AMILO PRO V2030" to ignore the timer overriding 2012-07-16 09:04:07 -07:00
apic x86, apic: Handle a bad TSC more gracefully 2015-02-02 17:05:03 +08:00
cpu x86/mce: Fix MCE severity messages 2015-09-18 09:20:42 +08:00
.gitignore
alternative.c x86/alternatives: Fix p6 nops on non-modular kernels 2012-10-07 08:32:29 -07:00
amd_gart_64.c X86 & IA64: adapt for dma_map_ops changes 2012-03-28 16:36:31 +02:00
amd_nb.c Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci 2012-01-11 18:50:26 -08:00
apb_timer.c
aperture_64.c
apm_32.c Disintegrate asm/system.h for X86 2012-03-28 18:11:12 +01:00
asm-offsets.c x86, efi: EFI boot stub support 2011-12-12 14:26:10 -08:00
asm-offsets_32.c x86: Generate system call tables and unistd_*.h from tables 2011-11-17 13:35:37 -08:00
asm-offsets_64.c x32: If configured, add x32 system calls to system call tables 2012-02-20 12:52:06 -08:00
audit_64.c
bootflag.c
check.c
cpuid.c Disintegrate asm/system.h for X86 2012-03-28 18:11:12 +01:00
crash.c x86/apic: Disable I/O APIC before shutdown of the local APIC 2014-06-07 16:02:08 -07:00
crash_dump_32.c x86: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:15 +08:00
crash_dump_64.c
devicetree.c irq_domain/x86: Convert x86 (embedded) to use common irq_domain 2012-02-23 14:37:47 -07:00
doublefault_32.c
dumpstack.c Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-03-29 18:21:35 -07:00
dumpstack_32.c x86/32: Print control and debug registers for kerenel context 2012-03-08 10:57:35 +01:00
dumpstack_64.c x86_64, traps: Stop using IST for #SS 2015-02-02 17:05:23 +08:00
e820.c x86, mm: Trim memory in memblock to be page aligned 2012-10-31 10:02:56 -07:00
early-quirks.c
early_printk.c Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-01-11 19:13:40 -08:00
entry_32.S x86, espfix: Make it possible to disable 16-bit support 2014-08-07 12:00:11 -07:00
entry_64.S x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization 2015-06-19 11:40:21 +08:00
espfix_64.c x86/espfix/xen: Fix allocation of pages for paravirt page tables 2014-08-07 12:00:11 -07:00
ftrace.c
head.c x86: Make sure we can boot in the case the BDA contains pure garbage 2013-03-04 06:06:39 +08:00
head32.c memblock: Kill memblock_init() 2011-12-08 10:22:07 -08:00
head64.c memblock: Kill memblock_init() 2011-12-08 10:22:07 -08:00
head_32.S
head_64.S x86: Keep current stack in NMI breakpoints 2011-12-21 15:38:55 -05:00
hpet.c x86: hpet: Fix masking of MSI interrupts 2012-12-17 10:37:44 -08:00
hw_breakpoint.c
i386_ksyms_32.c
i387.c x86, kvm: fix kvm's usage of kernel_fpu_begin/end() 2015-09-18 09:20:46 +08:00
i8237.c
i8253.c
i8259.c Disintegrate asm/system.h for X86 2012-03-28 18:11:12 +01:00
init_task.c
io_delay.c
ioport.c
irq.c x86: Eliminate irq_mis_count counted in arch_irq_stat 2013-05-07 19:51:57 -07:00
irq_32.c x86-32/irq: Don't switch to irq stack for a user-mode irq 2012-02-20 09:30:18 +01:00
irq_64.c x86: Add stack top margin for stack overflow checking 2011-12-07 09:27:11 +01:00
irq_work.c
irqinit.c Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-03-29 18:21:35 -07:00
jump_label.c jump_label, x86: Fix section mismatch 2011-12-06 20:41:02 +01:00
kdebugfs.c simple_open: automatically convert to simple_open() 2012-04-05 15:25:50 -07:00
kgdb.c KGDB/KDB regression fixes 2012-04-04 17:26:08 -07:00
kprobes-common.h x86/kprobes: Split out optprobe related code to kprobes-opt.c 2012-03-06 09:49:49 +01:00
kprobes-opt.c x86/kprobes: Split out optprobe related code to kprobes-opt.c 2012-03-06 09:49:49 +01:00
kprobes.c ftrace/jprobes/x86: Fix conflict between jprobes and function graph tracing 2015-04-14 17:33:53 +08:00
kvm.c x86, kvm: Clear paravirt_enabled on KVM guests for espfix32's benefit 2015-02-02 17:05:24 +08:00
kvmclock.c x86, kvm: Clear paravirt_enabled on KVM guests for espfix32's benefit 2015-02-02 17:05:24 +08:00
ldt.c x86, espfix: Make it possible to disable 16-bit support 2014-08-07 12:00:11 -07:00
machine_kexec_32.c Disintegrate asm/system.h for X86 2012-03-28 18:11:12 +01:00
machine_kexec_64.c
Makefile x86, espfix: Make espfix64 a Kconfig option, fix UML 2014-08-07 12:00:11 -07:00
mca_32.c Disintegrate asm/system.h for X86 2012-03-28 18:11:12 +01:00
microcode_amd.c x86/microcode/amd: Tone down printk(), don't treat a missing firmware file as an error 2013-11-29 10:50:35 -08:00
microcode_core.c x86, microcode: Sanitize per-cpu microcode reloading interface 2012-08-15 08:10:31 -07:00
microcode_intel.c x86/microcode: Ensure that module is only loaded on supported Intel CPUs 2012-05-07 14:37:14 +02:00
mmconf-fam10h_64.c
module.c Disintegrate asm/system.h for X86 2012-03-28 18:11:12 +01:00
mpparse.c Merge branch 'memblock-kill-early_node_map' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into core/memblock 2011-12-20 12:14:26 +01:00
msr.c x86/msr: Add capabilities check 2013-02-03 18:24:42 -06:00
nmi.c x86: Reset the debug_stack update counter 2012-06-10 00:36:12 +09:00
nmi_selftest.c x86: Properly _init-annotate NMI selftest code 2012-02-27 08:43:37 +01:00
paravirt-spinlocks.c
paravirt.c x86, mm: Patch out arch_flush_lazy_mmu_mode() when running on bare metal 2013-04-16 21:27:27 -07:00
paravirt_patch_32.c
paravirt_patch_64.c x86_64/entry/xen: Do not invoke espfix64 on Xen 2014-08-07 12:00:11 -07:00
pci-calgary_64.c Merge branch 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping 2012-04-04 17:13:43 -07:00
pci-dma.c Merge branch 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping 2012-04-04 17:13:43 -07:00
pci-iommu_table.c
pci-nommu.c X86 & IA64: adapt for dma_map_ops changes 2012-03-28 16:36:31 +02:00
pci-swiotlb.c X86 & IA64: adapt for dma_map_ops changes 2012-03-28 16:36:31 +02:00
pcspeaker.c
probe_roms.c x86: Include probe_roms.h in probe_roms.c 2012-03-08 10:57:35 +01:00
process.c x86: Remove the ancient and deprecated disable_hlt() and enable_hlt() facility 2012-03-30 08:50:27 +02:00
process_32.c Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-03-29 14:28:26 -07:00
process_64.c x86_64, switch_to(): Load TLS descriptors before switching DS and ES 2015-04-14 17:33:46 +08:00
ptrace.c x86-32: Export kernel_stack_pointer() for modules 2012-12-05 18:38:34 -08:00
pvclock.c
quirks.c x86/amd/numa: Fix northbridge quirk to assign correct NUMA node 2014-03-23 21:37:05 -07:00
reboot.c x86/reboot: Fix a warning message triggered by stop_other_cpus() 2015-06-19 11:40:31 +08:00
reboot_32.S
reboot_fixups_32.c
relocate_kernel_32.S
relocate_kernel_64.S x86: Fix typo in kexec register clearing 2013-06-20 11:58:46 -07:00
resource.c
rtc.c x86/rtc, mrst: Don't register a platform RTC device for for Intel MID platforms 2011-12-05 17:09:21 +01:00
setup.c x86/Sandy Bridge: mark arrays in __init functions as __initconst 2014-06-07 16:02:09 -07:00
setup_percpu.c percpu, x86: don't use PMD_SIZE as embedded atom_size on 32bit 2012-05-08 09:42:18 -07:00
signal.c Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-03-29 18:21:35 -07:00
smp.c x86, reboot: Fix typo in nmi reboot path 2012-01-07 12:19:37 +01:00
smpboot.c sched: Fix unreleased llc_shared_mask bit during CPU hotplug 2014-12-01 18:02:37 +08:00
stacktrace.c
step.c ptrace/x86: Partly fix set_task_blockstep()->update_debugctlmsr() logic 2014-06-07 16:02:09 -07:00
sys_i386_32.c
sys_x86_64.c x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member 2014-06-07 16:02:09 -07:00
syscall_32.c x86, syscall: Re-fix typo in comment 2011-11-18 16:25:07 -08:00
syscall_64.c x32: If configured, add x32 system calls to system call tables 2012-02-20 12:52:06 -08:00
tboot.c tboot: Add return values for tboot_sleep 2012-03-13 14:06:55 -04:00
tce_64.c Disintegrate asm/system.h for X86 2012-03-28 18:11:12 +01:00
test_nx.c
test_rodata.c
time.c x86/time: Eliminate unused irq0_irqs counter 2012-02-27 08:46:25 +01:00
tls.c x86/tls: Don't validate lm in set_thread_area() after all 2015-04-14 17:33:46 +08:00
tls.h
topology.c x86: Fix files explicitly requiring export.h for EXPORT_SYMBOL/THIS_MODULE 2011-10-31 19:30:35 -04:00
trampoline.c
trampoline_32.S
trampoline_64.S
traps.c x86/asm/entry/32: Fix user_mode() misuses 2015-06-19 11:40:26 +08:00
tsc.c x86, apic: Handle a bad TSC more gracefully 2015-02-02 17:05:03 +08:00
tsc_sync.c x86/tsc: Reduce the TSC sync check time for core-siblings 2012-02-22 11:49:40 +01:00
verify_cpu.S
vm86_32.c Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-03-29 18:21:35 -07:00
vmlinux.lds.S
vsmp_64.c
vsyscall_64.c x86: vsyscall: Use NULL instead 0 for a pointer argument 2012-04-06 11:49:59 +02:00
vsyscall_emu_64.S
vsyscall_trace.h
x86_init.c x86/platform: Remove incorrect error message in x86_default_fixup_cpu_id() 2012-04-16 20:43:43 +02:00
x8664_ksyms_64.c
xsave.c i387: Split up <asm/i387.h> into exported and internal interfaces 2012-02-21 14:12:54 -08:00