linux/arch/x86/include/asm
Ingo Molnar 8c05f05edb x86/fpu: Micro-optimize the copy_xregs_to_kernel*() and copy_kernel_to_xregs*() functions
The copy_xregs_to_kernel*() and copy_kernel_to_xregs*() functions are used
to copy FPU registers to kernel memory and vice versa.

They are never expected to fail, yet they have a return code, mostly because
that way they can share the assembly macros with the copy*user*() functions.

This error code is then silently ignored by the context switching
and other code - which made the bug in:

  b8c1b8ea7b ("x86/fpu: Fix FPU state save area alignment bug")

harder to fix than necessary.

So remove the return values and check for no faults when FPU debugging
is enabled in the .config.

This improves the eagerfpu context switching fast path by a couple of
instructions, when FPU debugging is disabled:

   ffffffff810407fa:      89 c2                   mov    %eax,%edx
   ffffffff810407fc:      48 0f ae 2f             xrstor64 (%rdi)
   ffffffff81040800:      31 c0                   xor    %eax,%eax
  -ffffffff81040802:      eb 0a                   jmp    ffffffff8104080e <__switch_to+0x321>
  +ffffffff81040802:      eb 16                   jmp    ffffffff8104081a <__switch_to+0x32d>
   ffffffff81040804:      31 c0                   xor    %eax,%eax
   ffffffff81040806:      48 0f ae 8b c0 05 00    fxrstor64 0x5c0(%rbx)
   ffffffff8104080d:      00

Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-25 12:49:40 +02:00
..
crypto x86/fpu: Rename i387.h to fpu/api.h 2015-05-19 15:47:30 +02:00
fpu x86/fpu: Micro-optimize the copy_xregs_to_kernel*() and copy_kernel_to_xregs*() functions 2015-05-25 12:49:40 +02:00
numachip
trace
uv x86: UV BAU: Increase maximum CPUs per socket/hub 2014-11-03 13:49:24 +01:00
xen xen: Add __GFP_DMA flag when xen_swiotlb_init gets free pages on ARM 2015-05-06 15:02:58 +01:00
a.out-core.h
acenv.h ACPICA: Linux: Add support to exclude <asm/acenv.h> inclusion. 2014-07-23 01:10:44 +02:00
acpi.h x86/xen: Override ACPI IRQ management callback __acpi_unregister_gsi 2015-01-20 11:44:41 +01:00
agp.h
alternative-asm.h x86/alternatives: Fix ALTERNATIVE_2 padding generation properly 2015-04-04 15:58:23 +02:00
alternative.h x86/alternatives, x86/fpu: Add 'alternatives_patched' debug flag and use it in xsave_state() 2015-05-19 15:48:03 +02:00
amd_nb.h
apb_timer.h
apic.h Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-04-13 13:16:36 -07:00
apic_flat_64.h
apicdef.h
apm.h
arch_hweight.h
archrandom.h
asm-offsets.h
asm.h kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist 2014-04-24 10:02:56 +02:00
atomic.h locking,arch: Use ACCESS_ONCE() instead of cast to volatile in atomic_read() 2014-10-03 06:06:23 +02:00
atomic64_32.h
atomic64_64.h locking,arch: Use ACCESS_ONCE() instead of cast to volatile in atomic_read() 2014-10-03 06:06:23 +02:00
barrier.h x86/asm: Use alternative_2() in rdtsc_barrier() 2015-02-23 13:44:17 +01:00
bios_ebda.h
bitops.h Make ARCH_HAS_FAST_MULTIPLIER a real config variable 2014-09-13 11:14:53 -07:00
boot.h
bootparam_utils.h
bug.h
bugs.h
cache.h
cacheflush.h x86: mm: Move PAT only functions to mm/pat.c 2014-11-16 18:59:19 +01:00
calgary.h
calling.h x86/asm/entry: Clear EXTRA_REGS for all executable formats 2015-04-06 09:24:08 +02:00
ce4100.h
checksum.h
checksum_32.h
checksum_64.h net: Change x86_64 add32_with_carry to allow memory operand 2014-05-05 15:26:29 -04:00
clocksource.h
cmdline.h x86, boot: Carve out early cmdline parsing function 2014-05-20 20:21:24 -07:00
cmpxchg.h x86: Simplify __HAVE_ARCH_CMPXCHG tests 2014-07-11 17:28:51 -07:00
cmpxchg_32.h x86: Simplify __HAVE_ARCH_CMPXCHG tests 2014-07-11 17:28:51 -07:00
cmpxchg_64.h x86: Simplify __HAVE_ARCH_CMPXCHG tests 2014-07-11 17:28:51 -07:00
compat.h x86/asm/entry/64: Save user RSP in pt_regs->sp on SYSCALL64 fastpath 2015-03-10 13:56:10 +01:00
context_tracking.h
cpu.h x86: Use common outgoing-CPU-notification code 2015-03-11 13:22:35 -07:00
cpu_device_id.h
cpufeature.h x86_64, asm: Work around AMD SYSRET SS descriptor attribute issue 2015-04-26 17:57:38 -07:00
cpumask.h
crash.h kexec: support for kexec on panic using new system call 2014-08-08 15:57:33 -07:00
current.h
debugreg.h perf/x86/amd: AMD support for bp_len > HW_BREAKPOINT_LEN_8 2014-12-03 15:14:26 +01:00
delay.h
desc.h x86/traps: Separate set_intr_gate() and clean up early_trap_init() 2015-03-05 00:47:29 +01:00
desc_defs.h
device.h
disabled-features.h x86, mpx: Add MPX to disabled features 2014-11-18 00:58:53 +01:00
div64.h
dma-mapping.h
dma.h x86/mm: Fix zone ranges boot printout 2014-12-11 11:35:02 +01:00
dmi.h
dwarf2.h x86/asm: Introduce push/pop macros which generate CFI_REL_OFFSET and CFI_RESTORE 2015-03-04 22:50:49 +01:00
e820.h mm: move memtest under mm 2015-04-14 16:49:06 -07:00
edac.h
efi.h x86/fpu: Rename i387.h to fpu/api.h 2015-05-19 15:47:30 +02:00
elf.h mm: fold arch_randomize_brk into ARCH_HAS_ELF_RANDOMIZE 2015-04-14 16:49:05 -07:00
emergency-restart.h
entry_arch.h
espfix.h x86, espfix: Fix broken header guard 2014-05-02 11:34:17 -07:00
exec.h
fb.h x86: Use new cache mode type in include/asm/fb.h 2014-11-16 11:04:24 +01:00
fixmap.h Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-10 14:24:20 -08:00
floppy.h
frame.h
ftrace.h ftrace/x86: Move MCOUNT_SAVE_FRAME out of header file 2014-12-01 14:07:16 -05:00
futex.h
gart.h
genapic.h
geode.h
gpio.h
hardirq.h x86, irq, trivial: Minor improvements of IRQ related code 2014-06-21 23:05:41 +02:00
highmem.h x86: mm: Re-use the early_ioremap fixed area 2014-11-03 13:40:44 +01:00
hpet.h x86/hpet: Make boot_hpet_disable extern 2014-05-08 08:15:34 +02:00
hugetlb.h x86, mm, hugetlb: Add missing TLB page invalidation for hugetlb_cow() 2014-05-13 16:34:09 -07:00
hw_breakpoint.h perf/x86/amd: AMD support for bp_len > HW_BREAKPOINT_LEN_8 2014-12-03 15:14:26 +01:00
hw_irq.h x86/asm/entry/irq: Simplify interrupt dispatch table (IDT) layout 2015-04-08 09:02:13 +02:00
hypertransport.h
hypervisor.h hypervisor/x86/xen: Unset X86_BUG_SYSRET_SS_ATTRS on Xen PV guests 2015-05-05 18:27:43 +01:00
i8259.h x86, irq: Count legacy IRQs by legacy_pic->nr_legacy_irqs instead of NR_IRQS_LEGACY 2014-06-21 23:05:42 +02:00
ia32.h
ia32_unistd.h
idle.h
imr.h x86/intel/quark: Add Isolated Memory Regions for Quark X1000 2015-02-18 23:22:47 +01:00
inat.h
inat_types.h
init.h
insn.h x86/asm/decoder: Fix and enforce max instruction size in the insn decoder 2015-02-19 00:01:24 +01:00
inst.h
intel-mid.h x86, intel-mid: remove Intel MID specific serial support 2015-03-07 03:25:18 +01:00
intel_mid_vrtc.h
intel_scu_ipc.h
io.h Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-10 13:59:34 -08:00
io_apic.h x86/ioapic: Provide stub functions for IOAPIC%3Dn 2015-01-22 15:10:55 +01:00
iomap.h
iommu.h
iommu_table.h x86/iommu: Fix header comments regarding standard and _FINISH macros 2015-04-09 10:56:31 +02:00
iosf_mbi.h x86, iosf: Added Quark MBI identifiers 2014-05-09 14:57:08 -07:00
ipi.h
irq.h nmi: provide the option to issue an NMI back trace to every cpu but current 2014-06-23 16:47:44 -07:00
irq_regs.h
irq_remapping.h iommu/irq_remapping: Kill function irq_remapping_supported() and related code 2015-01-15 11:24:23 +01:00
irq_vectors.h x86: Avoid building unused IRQ entry stubs 2014-12-16 14:08:14 +01:00
irq_work.h x86: Tell irq work about self IPI support 2014-09-13 18:38:29 +02:00
irqflags.h x86/asm/entry: Drop now unused ENABLE_INTERRUPTS_SYSEXIT32 2015-04-03 10:34:19 +02:00
ist.h
jump_label.h jump_label: Allow asm/jump_label.h to be included in assembly 2015-04-09 09:40:23 +02:00
kasan.h x86_64: add KASan support 2015-02-13 21:21:41 -08:00
kbdleds.h
Kbuild x86: use generic dma-contiguous.h 2014-09-22 13:35:52 +02:00
kdebug.h
kexec-bzimage64.h kexec-bzImage64: support for loading bzImage using 64bit entry 2014-08-08 15:57:33 -07:00
kexec.h kexec: support for kexec on panic using new system call 2014-08-08 15:57:33 -07:00
kgdb.h
kmap_types.h
kmemcheck.h
kprobes.h kprobes/x86: Remove stale ARCH_SUPPORTS_KPROBES_ON_FTRACE define 2014-10-17 07:18:34 +02:00
kvm_emulate.h KVM: x86: IRET emulation does not clear NMI masking 2015-01-26 12:14:42 +01:00
kvm_guest.h
kvm_host.h Linux 4.1-rc5 2015-05-25 09:39:19 +02:00
kvm_para.h x86: Use bool function return values of true/false not 1/0 2015-03-31 18:05:09 +02:00
lguest.h lguest: suppress interrupts for single insn, not range. 2015-03-24 11:52:08 +10:30
lguest_hcall.h lguest: remove NOTIFY call and eventfd facility. 2015-02-11 16:47:46 +10:30
linkage.h
livepatch.h livepatch: remove extern specifier from header files 2015-02-18 20:50:05 +01:00
local.h
local64.h
mach_timer.h
mach_traps.h
math_emu.h
mc146818rtc.h x86: Simplify __HAVE_ARCH_CMPXCHG tests 2014-07-11 17:28:51 -07:00
mce.h x86/mce: Define mce_severity function pointer 2015-03-24 12:14:15 +01:00
microcode.h x86/microcode: Consolidate family,model, ... code 2015-03-02 20:32:07 +01:00
microcode_amd.h x86, microcode: Reload microcode on resume 2014-12-06 13:03:03 +01:00
microcode_intel.h x86/microcode/intel: Move mc arg last in get_matching_{microcode|sig} 2015-03-02 20:32:13 +01:00
misc.h
mmconfig.h
mmu.h perf/x86: Only allow rdpmc if a perf_event is mapped 2015-02-04 12:10:47 +01:00
mmu_context.h perf/x86: Add /sys/devices/cpu/rdpmc=2 to allow rdpmc for all tasks 2015-02-04 12:10:49 +01:00
mmx.h
mmzone.h
mmzone_32.h
mmzone_64.h
module.h
mpspec.h x86, apic: Remove mps_oem_check callback 2014-07-31 08:05:42 -07:00
mpspec_def.h
mpx.h x86/fpu: Harmonize FPU register state types 2015-05-19 15:48:09 +02:00
mshyperv.h
msidef.h
msr.h
mtrr.h
mutex.h
mutex_32.h x86: Simplify __HAVE_ARCH_CMPXCHG tests 2014-07-11 17:28:51 -07:00
mutex_64.h
mwait.h sched/idle/x86: Restore mwait_idle() to fix boot hangs, to improve power savings and to improve performance 2015-03-16 11:14:21 +01:00
nmi.h
nops.h
numa.h x86/mm/numa: Drop dead code and rename setup_node_data() to setup_alloc_data() 2014-09-16 08:55:10 +02:00
numa_32.h
olpc.h
olpc_ofw.h
page.h arm64,ia64,ppc,s390,sh,tile,um,x86,mm: remove default gate area 2014-08-08 15:57:27 -07:00
page_32.h
page_32_types.h x86_64, traps: Stop using IST for #SS 2014-11-23 13:56:19 -08:00
page_64.h x86_64,vsyscall: Make vsyscall emulation configurable 2014-11-03 21:44:57 +01:00
page_64_types.h kasan: enable stack instrumentation 2015-02-13 21:21:41 -08:00
page_types.h x86, mm: support huge I/O mapping capability I/F 2015-04-14 16:49:04 -07:00
paravirt.h x86: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
paravirt_types.h x86: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
parport.h
pat.h x86: Enable PAT to use cache mode translation tables 2014-11-16 11:04:26 +01:00
pci-direct.h
pci-functions.h
pci.h x86, irq: Move PCI MSI related code from io_apic.c into msi.c 2014-12-16 14:08:17 +01:00
pci_64.h
pci_x86.h Revert "x86/PCI: Refine the way to release PCI IRQ resources" 2015-03-20 14:56:19 +01:00
percpu.h x86-64: Use RIP-relative addressing for most per-CPU accesses 2014-11-04 20:43:14 +01:00
perf_event.h perf/x86/amd/ibs: Update IBS MSRs and feature definitions 2014-11-12 15:12:32 +01:00
perf_event_p4.h percpu: Resolve ambiguities in __get_cpu_var/cpumask_var_t 2014-08-28 08:58:57 -04:00
pgalloc.h x86: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
pgtable-2level.h x86: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:33 -08:00
pgtable-2level_types.h x86: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
pgtable-3level.h x86: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:33 -08:00
pgtable-3level_types.h x86: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
pgtable.h x86: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
pgtable_32.h x86: Remove set_pmd_pfn 2014-09-01 10:15:31 +02:00
pgtable_32_types.h x86: mm: Re-use the early_ioremap fixed area 2014-11-03 13:40:44 +01:00
pgtable_64.h mm: remove remaining references to NUMA hinting bits and helpers 2015-02-12 18:54:08 -08:00
pgtable_64_types.h x86: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
pgtable_types.h x86: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
platform_sst_audio.h ASoC: Intel: mrfld: Define sst_res_info for acpi 2014-10-27 18:02:38 +00:00
pm-trace.h PM / sleep: add pm-trace support for suspending phase 2015-03-18 15:54:27 +01:00
pmc_atom.h x86: pmc_atom: Expose contents of PSS 2015-01-20 12:50:14 +01:00
posix_types.h
preempt.h sched: Kill task_preempt_count() 2014-10-28 10:47:56 +01:00
probe_roms.h
processor-cyrix.h
processor-flags.h
processor.h x86/fpu: Fix FPU state save area alignment bug 2015-05-25 09:38:04 +02:00
prom.h x86, devicetree, irq: Use common mechanism to support irqdomain 2014-06-21 23:05:43 +02:00
proto.h x86, vdso: Move syscall and sysenter setup into kernel/cpu/common.c 2014-05-05 13:18:47 -07:00
ptrace.h x86/asm/entry: Remove user_mode_ignore_vm86() 2015-03-31 11:45:19 +02:00
pvclock-abi.h
pvclock.h x86: pvclock: Really remove the sched notifier for cross-cpu migrations 2015-04-27 15:49:30 +02:00
qrwlock.h x86, locking: Use no more OOSTORE nonsense 2014-06-18 18:41:22 +02:00
realmode.h
reboot.h
reboot_fixups.h
required-features.h
rio.h
rmwcc.h
rtc.h
rwsem.h
seccomp.h x86: switch to using asm-generic for seccomp.h 2015-04-17 09:04:10 -04:00
sections.h
segment.h x86/asm/entry/64: Use a define for an invalid segment selector 2015-04-03 15:29:13 +02:00
serial.h serial, x86: use UPF_* constants for flags 2015-03-11 14:01:17 +01:00
setup.h x86/mm/KASLR: Propagate KASLR status to kernel proper 2015-04-03 15:26:15 +02:00
setup_arch.h
shmparam.h
sigcontext.h x86/signal/64: Remove 'fs' and 'gs' from sigcontext 2015-03-17 09:25:26 +01:00
sigframe.h
sighandling.h x86/signal: Remove pax argument from restore_sigcontext 2015-04-06 09:06:39 +02:00
signal.h signals: kill sigfindinword() 2014-06-06 16:08:11 -07:00
simd.h x86/fpu: Rename i387.h to fpu/api.h 2015-05-19 15:47:30 +02:00
smap.h x86/smap: Use ALTERNATIVE macro 2015-02-23 13:44:14 +01:00
smp.h Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-04-14 13:36:04 -07:00
sparsemem.h
special_insns.h x86/asm: Add support for the CLWB instruction 2015-04-03 06:56:38 +02:00
spinlock.h x86/spinlocks: Fix regression in spinlock contention detection 2015-05-05 11:01:38 +02:00
spinlock_types.h locking/rwlock, x86: Clean up asm/spinlock*.h to remove old rwlock code 2014-09-10 11:46:38 +02:00
sta2x11.h
stackprotector.h x86/fpu: Move various internal function prototypes to fpu/internal.h 2015-05-19 15:47:48 +02:00
stacktrace.h
string.h
string_32.h
string_64.h x86_64: kasan: add interceptors for memset/memmove/memcpy functions 2015-02-13 21:21:41 -08:00
suspend.h
suspend_32.h x86/fpu: Rename i387.h to fpu/api.h 2015-05-19 15:47:30 +02:00
suspend_64.h x86/fpu: Rename i387.h to fpu/api.h 2015-05-19 15:47:30 +02:00
svm.h
swiotlb.h x86: enable DMA CMA with swiotlb 2014-06-04 16:53:57 -07:00
switch_to.h sched/x86_64: Don't save flags on context switch 2014-10-28 11:11:30 +01:00
sync_bitops.h arch,x86: Convert smp_mb__*() 2014-04-18 14:20:46 +02:00
sys_ia32.h
syscall.h
syscalls.h
sysfb.h
tce.h
thread_info.h Merge branch 'exec_domain_rip_v2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2015-04-15 13:53:55 -07:00
time.h
timer.h
timex.h
tlb.h
tlbflush.h x86: Store a per-cpu shadow copy of CR4 2015-02-04 12:10:42 +01:00
topology.h
trace_clock.h
traps.h x86, traps: Add ist_begin_non_atomic and ist_end_non_atomic 2015-01-02 10:22:46 -08:00
tsc.h
uaccess.h x86/uaccess: fix sparse errors 2015-01-13 15:22:59 +02:00
uaccess_32.h
uaccess_64.h x86: clean up/fix 'copy_in_user()' tail zeroing 2015-04-08 14:28:45 -07:00
unaligned.h
unistd.h sys_sgetmask/sys_ssetmask: add CONFIG_SGETMASK_SYSCALL 2014-06-04 16:54:14 -07:00
uprobes.h uprobes/x86: Rename arch_uprobe->def to ->defparam, minor comment updates 2014-06-05 16:21:57 +02:00
user.h x86/fpu: Rename xsave.header::xstate_bv to 'xfeatures' 2015-05-19 15:47:35 +02:00
user32.h
user_32.h
user_64.h
vdso.h x86, vdso: Move the vvar area before the vdso text 2014-07-11 16:57:51 -07:00
vga.h x86, ia64: Move EFI_FB vga_default_device() initialization to pci_vga_fixup() 2014-07-10 16:48:48 -06:00
vgtod.h x86, vdso: Use asm volatile in __getcpu 2014-12-23 13:05:30 -08:00
virtext.h x86: Store a per-cpu shadow copy of CR4 2015-02-04 12:10:42 +01:00
vm86.h
vmx.h KVM: VMX: Add PML support in VMX 2015-01-30 09:39:54 +01:00
vsyscall.h x86_64,vsyscall: Make vsyscall emulation configurable 2014-11-03 21:44:57 +01:00
vvar.h x86,vdso: Use LSL unconditionally for vgetcpu 2014-11-03 13:41:53 +01:00
word-at-a-time.h
x2apic.h
x86_init.h Revert "PCI: Add x86_msi.msi_mask_irq() and msix_mask_irq()" 2014-11-11 15:14:30 -07:00
xor.h x86/fpu: Rename i387.h to fpu/api.h 2015-05-19 15:47:30 +02:00
xor_32.h x86/fpu: Rename i387.h to fpu/api.h 2015-05-19 15:47:30 +02:00
xor_64.h
xor_avx.h x86/fpu: Rename i387.h to fpu/api.h 2015-05-19 15:47:30 +02:00