Re: x86: xsave/xrstor support; ucontext_t extensions

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Suresh Siddha
Date: Friday, June 6, 2008 - 1:14 pm

On Thu, Jun 05, 2008 at 05:28:15PM -0700, H. Peter Anvin wrote:

I thought we had a closure on the previous thread. But no problem.
It's better late than never.


xsave,xrstor are performance senstive instructions as they are used
in process context switches. It doesn't have to describe itself and
at any time, one can get all the xsave relevant layout information using
cpuid. And when needed, SW can always pass extra information with the
xsave image.


It's primarily designed for context switch handling, with
fxsave's interoperability in mind. Even though the substates are
laidout one after another, xsave/xrstor can operate on individual
states based on the edx:eax mask.

Each substate will probably also have different instructions to
save/restore/init their substate.


yes.


As previously agreed.


As I mentioned earlier, we can avoid this magic number, by including
a pointer (which points to start of the fp and xstate on stack) along with M1. 

This will catch any one copying the FP state of the frame but not aware of
Xstate.


As you mentioned, this doesn't change after a kernel boot. So do we really
need to save this static information on every signal? (also please see below
about the compaction).


As I mentioned above, pointer along with M1 should be enough to catch this?


Though the xsave layout is extendable, save area is not
compacted if some features are not supported by processor and/or
system software. This is documented in Vol 2b under "xsave"
instruction.

In my RFC, we had the bit mask also saved in the SW-reserved area,
which represents the extended state saved in the signal frame.
This is in addition to the bit mask represeted by the xstate_bv
in the header. xstate_bv indicates the current status (init/non-init)
of the sub-states for the bit mask saved in the SW-reserved area.

While restoring, kernel can also use the same bit mask in SW area to restore
the state and init the other state not referred by the bit mask.


Given that the descriptor offsets don't change, we can
achieve the same thing with a bit mask representing the state in
the xsave layout. xrstor with the approriate bit masks will automatically
restore/init the state.


Today in 64bit, we directly do fxsave/fxrstor in and out of user-space
for signal handlers. I would like to retain this behavior as much as possible
with xsave/xrstor aswell (and at the same time, provide as much information
as possible for the user to interpret the signal frame). Bit mask representing
the state saved in the xsave image, M1, length and some cookie (pointer along
with M1) to detect the image truncation can achieve this. Isn't it?

thanks,
suresh
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] x86: xsave/xrstor support, ucontext_t extensions, Suresh Siddha, (Mon May 12, 6:10 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Fri May 16, 6:26 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Mon May 19, 7:52 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Mon May 19, 9:29 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Mon May 19, 10:45 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Tue May 20, 1:58 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Tue May 20, 6:19 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Tue May 20, 7:55 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Tue May 20, 7:58 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Tue May 20, 8:20 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Suresh Siddha, (Tue May 20, 10:53 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Tue May 20, 10:57 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Tue May 20, 10:59 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Roland McGrath, (Tue May 20, 1:10 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Wed May 21, 5:05 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Wed May 21, 5:28 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Roland McGrath, (Wed May 21, 5:47 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Roland McGrath, (Wed May 21, 5:53 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Wed May 21, 6:38 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Roland McGrath, (Wed May 21, 11:40 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Thu May 22, 12:18 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Thu May 22, 1:49 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Thu May 22, 1:57 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Thu May 22, 2:02 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Thu May 22, 2:34 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Thu May 22, 3:15 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Thu May 22, 3:22 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Thu May 22, 3:36 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Thu May 22, 5:32 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Thu May 22, 5:33 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Roland McGrath, (Thu May 22, 6:33 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Roland McGrath, (Thu May 22, 7:12 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Thu May 22, 7:27 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Thu May 22, 7:45 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Thu May 22, 7:49 pm)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Mikael Pettersson, (Fri May 23, 4:46 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, H. Peter Anvin, (Fri May 23, 9:57 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Suresh Siddha, (Fri May 23, 10:50 am)
Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions, Suresh Siddha, (Fri May 23, 11:09 am)
x86: xsave/xrstor support; ucontext_t extensions, H. Peter Anvin, (Thu Jun 5, 5:28 pm)
Re: x86: xsave/xrstor support; ucontext_t extensions, Suresh Siddha, (Fri Jun 6, 1:14 pm)
Re: x86: xsave/xrstor support; ucontext_t extensions, H. Peter Anvin, (Fri Jun 6, 4:03 pm)