x86, fpu: always use kernel_fpu_begin/end() for in-kernel FPU usage
authorSuresh Siddha <suresh.b.siddha@intel.com>
Fri, 24 Aug 2012 21:13:00 +0000 (14:13 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Tue, 18 Sep 2012 22:52:08 +0000 (15:52 -0700)
commit841e3604d35aa70d399146abdc526d8c89a2c2f5
tree80d2266c21e5ae0b5f4097db3ee71888fc92bec1
parent9c1c3fac53378c9782c18f80107965578d7b7167
x86, fpu: always use kernel_fpu_begin/end() for in-kernel FPU usage

use kernel_fpu_begin/end() instead of unconditionally accessing cr0 and
saving/restoring just the few used xmm/ymm registers.

This has some advantages like:
* If the task's FPU state is already active, then kernel_fpu_begin()
  will just save the user-state and avoiding the read/write of cr0.
  In general, cr0 accesses are much slower.

* Manual save/restore of xmm/ymm registers will affect the 'modified' and
  the 'init' optimizations brought in the by xsaveopt/xrstor
  infrastructure.

* Foward compatibility with future vector register extensions will be a
  problem if the xmm/ymm registers are manually saved and restored
  (corrupting the extended state of those vector registers).

With this patch, there was no significant difference in the xor throughput
using AVX, measured during boot.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Link: http://lkml.kernel.org/r/1345842782-24175-5-git-send-email-suresh.b.siddha@intel.com
Cc: Jim Kukunas <james.t.kukunas@linux.intel.com>
Cc: NeilBrown <neilb@suse.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/include/asm/xor_32.h
arch/x86/include/asm/xor_64.h
arch/x86/include/asm/xor_avx.h