diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2010-06-22 19:23:37 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-07-06 19:31:04 -0400 |
commit | 8e221b6db4477643fefc885a97ea9889ac733140 (patch) | |
tree | 96f87079865607c26e5a3ca3eab908187bec1fbf /arch/x86/include/asm/xsave.h | |
parent | 815c4163b6c8ebf8152f42b0a5fd015cfdcedc78 (diff) |
x86: Avoid unnecessary __clear_user() and xrstor in signal handling
fxsave/xsave doesn't touch all the bytes in the memory layout used by
these instructions. Specifically SW reserved (bytes 464..511) fields
in the fxsave frame and the reserved fields in the xsave header.
To present a clean context for the signal handling, just clear these fields
instead of clearing the complete fxsave/xsave memory layout, when we dump these
registers directly to the user signal frame.
Also avoid the call to second xrstor (which inits the state not passed
in the signal frame) in restore_user_xstate() if all the state has already
been restored by the first xrstor.
These changes improve the performance of signal handling(by ~3-5% as measured
by the lat_sig).
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <1277249017.2847.85.camel@sbs-t61.sc.intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/include/asm/xsave.h')
-rw-r--r-- | arch/x86/include/asm/xsave.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h index 2c4390cae228..30dfc81804d5 100644 --- a/arch/x86/include/asm/xsave.h +++ b/arch/x86/include/asm/xsave.h | |||
@@ -59,6 +59,16 @@ static inline int fpu_xrstor_checking(struct fpu *fpu) | |||
59 | static inline int xsave_user(struct xsave_struct __user *buf) | 59 | static inline int xsave_user(struct xsave_struct __user *buf) |
60 | { | 60 | { |
61 | int err; | 61 | int err; |
62 | |||
63 | /* | ||
64 | * Clear the xsave header first, so that reserved fields are | ||
65 | * initialized to zero. | ||
66 | */ | ||
67 | err = __clear_user(&buf->xsave_hdr, | ||
68 | sizeof(struct xsave_hdr_struct)); | ||
69 | if (unlikely(err)) | ||
70 | return -EFAULT; | ||
71 | |||
62 | __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n" | 72 | __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n" |
63 | "2:\n" | 73 | "2:\n" |
64 | ".section .fixup,\"ax\"\n" | 74 | ".section .fixup,\"ax\"\n" |