From: "H. Peter Anvin" <hpa@zytor.com>
To: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Roland McGrath <roland@redhat.com>,
Mikael Pettersson <mikpe@it.uu.se>,
Andi Kleen <andi@firstfloor.org>,
x86@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, drepper@redhat.com,
Hongjiu.lu@intel.com, linux-kernel@vger.kernel.org,
arjan@linux.intel.com, rmk+lkml@arm.linux.org.uk, dan@debian.org,
asit.k.mallick@intel.com
Subject: x86: xsave/xrstor support; ucontext_t extensions
Date: Thu, 05 Jun 2008 17:28:15 -0700 [thread overview]
Message-ID: <4848849F.6000502@zytor.com> (raw)
In-Reply-To: <20080523180928.GE18385@linux-os.sc.intel.com>
Sorry for not getting back on this for so long.
I have looked at the XSAVE architecture, and it is pretty darn hideous,
mostly because it doesn't describe itself in the absence of CPUID
information. Given that, it would have been much better if there had
been separate invocations of XSAVE for each substate region. On the
other hand, normalizing to the current CPU format is probably desirable
anyway.
I would like to make this proposal for the signal frames (again, flagged
with a uc_flags bit for RT frames):
- The SW-reserved areas at the bottom of the FXSAVE region will be used
as follows:
- A magic number (M1)
- A length pointer (L1), giving the length of the entire XSAVE region.
- At the end of the XSAVE region, i.e. at the offset given by the length
pointer, we create a secondary structure looking something like this:
- Magic number (M2)
- Descriptor count (DC)
- DC * <EBX, EAX> from CPUID leaf 0Dh
- Possibly a checksum or CRC of this structure
Note that this tail structure will always be the same on a given kernel,
so it can be pre-canned at boot time. This tail structure serves two
purposes:
- It can be used to verify against truncation of the state.
(I.e. if an XSAVE-unaware application tries to copy and save away
a state and later restore it, but only copies the first 512 bytes
and later just puts a pointer to it.)
- It can be used to verify against an alien state (saved and restored
from another CPU, or even just another kernel version with different
support.)
If there is a mismatch, we can then take appropriate action:
- No M1 or M2 signature, or L1 or DC are insane:
-> Reinitialize any non-FXSAVE state.
- M1, M2, L1, and DC make sense, but mismatch on DC or descriptor
offsets:
-> Do a region-by-region copy in of the state; reinitialize any
regions not provided.
- Mismatch on descriptor sizes:
-> Consider that region corrupt and reinitialize?
The region-by-region copy could of course be used even in the same-CPU
case, if there turns out to be a negible performance difference over
whole-block copy.
Thoughts?
-hpa
next prev parent reply other threads:[~2008-06-06 0:39 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-13 1:10 [RFC] x86: xsave/xrstor support, ucontext_t extensions Suresh Siddha
2008-05-16 13:26 ` Mikael Pettersson
2008-05-18 1:34 ` Suresh Siddha
2008-05-19 14:52 ` Mikael Pettersson
2008-05-19 15:04 ` Andi Kleen
2008-05-19 16:29 ` H. Peter Anvin
2008-05-19 16:57 ` Suresh Siddha
2008-05-19 17:45 ` H. Peter Anvin
2008-05-20 1:57 ` Suresh Siddha
2008-05-20 8:58 ` Mikael Pettersson
2008-05-20 10:01 ` Andi Kleen
2008-05-20 13:19 ` Mikael Pettersson
2008-05-20 14:58 ` H. Peter Anvin
2008-05-20 15:20 ` Mikael Pettersson
2008-05-20 17:53 ` Suresh Siddha
2008-05-20 17:59 ` H. Peter Anvin
2008-05-22 0:28 ` H. Peter Anvin
2008-05-22 0:53 ` Roland McGrath
2008-05-22 1:38 ` H. Peter Anvin
2008-05-22 6:40 ` Roland McGrath
2008-05-22 7:18 ` H. Peter Anvin
2008-05-22 8:49 ` Mikael Pettersson
2008-05-22 8:57 ` Mikael Pettersson
2008-05-22 20:56 ` Suresh Siddha
2008-05-22 21:02 ` H. Peter Anvin
2008-05-22 21:29 ` Suresh Siddha
2008-05-22 21:34 ` H. Peter Anvin
2008-05-22 22:22 ` Mikael Pettersson
2008-05-23 1:48 ` Suresh Siddha
2008-05-23 2:12 ` Roland McGrath
2008-05-23 2:49 ` H. Peter Anvin
2008-05-23 18:09 ` Suresh Siddha
2008-06-06 0:28 ` H. Peter Anvin [this message]
2008-06-06 20:14 ` x86: xsave/xrstor support; " Suresh Siddha
2008-06-06 23:03 ` H. Peter Anvin
2008-05-23 2:45 ` [RFC] x86: xsave/xrstor support, " H. Peter Anvin
2008-05-23 11:46 ` Mikael Pettersson
2008-05-23 12:11 ` Andi Kleen
2008-05-22 21:32 ` Chris Wright
2008-05-22 22:15 ` Mikael Pettersson
2008-05-22 22:29 ` Chris Wright
2008-05-23 0:32 ` H. Peter Anvin
2008-05-23 0:44 ` Chris Wright
2008-05-22 22:36 ` Mikael Pettersson
2008-05-23 0:33 ` H. Peter Anvin
2008-05-23 0:42 ` Suresh Siddha
2008-05-23 1:33 ` Roland McGrath
2008-05-23 16:57 ` H. Peter Anvin
2008-05-23 17:50 ` Suresh Siddha
2008-05-23 2:27 ` H. Peter Anvin
2008-05-20 17:57 ` H. Peter Anvin
2008-05-20 14:55 ` H. Peter Anvin
2008-05-20 15:03 ` Andi Kleen
2008-05-20 20:10 ` Roland McGrath
2008-05-22 0:05 ` H. Peter Anvin
2008-05-22 0:47 ` Roland McGrath
2008-05-22 8:14 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4848849F.6000502@zytor.com \
--to=hpa@zytor.com \
--cc=Hongjiu.lu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=arjan@linux.intel.com \
--cc=asit.k.mallick@intel.com \
--cc=dan@debian.org \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikpe@it.uu.se \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=roland@redhat.com \
--cc=suresh.b.siddha@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox