From: Shuai Ruan <shuai.ruan@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: andrew.cooper3@citrix.com, keir@xen.org, xen-devel@lists.xen.org
Subject: Re: [V4] x86/xsaves: fix overwriting between non-lazy/lazy xsaves
Date: Wed, 16 Mar 2016 17:35:53 +0800 [thread overview]
Message-ID: <34071.2756071754$1458121175@news.gmane.org> (raw)
In-Reply-To: <56E81D4402000078000DC77C@prv-mh.provo.novell.com>
On Tue, Mar 15, 2016 at 07:33:40AM -0600, Jan Beulich wrote:
> >>> On 15.03.16 at 10:40, <shuai.ruan@linux.intel.com> wrote:
> > xrstor() will look as follow:
> > if ( using_xsaves )
> > {
> > if ( unlikely(!(prt->xsave_hdr->xcom_bv &
> > XSTATE_COMPACTION_ENABLED)) )
> > ptr->xsave_hdr->xcomp_bv =
> > ptr->xsave_hdr->xstate_bv |
> > XSTATE_COMPACTION_ENABLED;
> > XRSTORS;
> > }
> > else
> > XRSTOR;
>
> This makes me imply that "using_xsaves" is still a global variable,
> set depending on CPU features. That's exactly what I've said
> would presumably not be sufficient in code like xrstor(). What
> point is there in using XSTORS if the guest never touched XSS?
> I would much rather have expected for you to introduce a
> flag paralleling v->arch.nonlazy_xstate_used indicating
> whether for a particular vCPU XSAVES/XRSTORS really need to be
> used (or maybe just looking at xcr0_accum would be sufficient,
> and no new flag is needed; in fact I think that flag would also
> better go away in favor of just inspecting xcr0_accum).
if xrstor() side depend on checking xcr0_accum and using_xsaves,
then xsave() can not only depend on using_xsaves (or
X86_FEATURE_USE_XSAVES). So I will drop alternativer patching
in xsave() side.
And both xsave() xrestor() will depend on using_xsaves and checking
xcr0_accum. And compress_xsave_states() will check this too.
Detail is :
#define XSTATE_SUPER 0
#define using_xsaves 0
if ( using_xsaves && (v->arch.xcr0_accum & XSTATE_SUPER) )
{
.....
XSAVES/XRSTORS;
}
....
Thanks
>
> Jan
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-16 9:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 8:22 [V4] x86/xsaves: fix overwriting between non-lazy/lazy xsaves Shuai Ruan
2016-03-10 9:30 ` Jan Beulich
2016-03-11 6:45 ` Shuai Ruan
[not found] ` <20160311064516.GA11162@shuai.ruan@linux.intel.com>
2016-03-11 10:16 ` Jan Beulich
2016-03-15 9:40 ` Shuai Ruan
[not found] ` <20160315094037.GA4682@shuai.ruan@linux.intel.com>
2016-03-15 13:33 ` Jan Beulich
2016-03-16 9:35 ` Shuai Ruan [this message]
[not found] ` <20160316093436.GA3531@shuai.ruan@linux.intel.com>
2016-03-16 10:08 ` Jan Beulich
2016-03-16 10:51 ` Shuai Ruan
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='34071.2756071754$1458121175@news.gmane.org' \
--to=shuai.ruan@linux.intel.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).