From: Yu-cheng Yu <yu-cheng.yu@intel.com>
To: x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@suse.de>,
Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>,
"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Yu-cheng Yu <yu-cheng.yu@intel.com>
Subject: [PATCH 07/10] x86/xsaves: Fix init_fpstate.header.xcomp_bv
Date: Mon, 22 Feb 2016 10:59:56 -0800 [thread overview]
Message-ID: <1456167596-3932-1-git-send-email-yu-cheng.yu@intel.com> (raw)
In setup_init_fpu_buf(), we use XRSTOR/XRSTORS with xfeatures (xstate_bv)
of 0x0 to effectively set all xstate components to init values. We then
execute XSAVE/XSAVES on the same buffer to save back init values.
This actually does not apply to XSAVES as XSAVES uses optimization. After
init, all components are in INIT and not MODIFIED state and will not be
saved. There is no need of setting xcomp_bv except for bit 63 to indicate
a compacted format.
Currently, init_fpstate is used in two ways:
(1) With copy_kernel_to_xregs(): because header.xfeatures is zero, the
content is not actually read;
(2) With memcpy(): to sanitize a standard-format xsave area; the buffer is
setup as expected.
Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
---
arch/x86/kernel/fpu/xstate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 13829e1..4087261 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -371,10 +371,10 @@ static void __init setup_init_fpu_buf(void)
print_xstate_features();
if (cpu_has_xsaves)
- init_fpstate.xsave.header.xcomp_bv = (u64)1 << 63 | xfeatures_mask;
+ init_fpstate.xsave.header.xcomp_bv = (u64)1 << 63;
/*
- * Init all the features state with header_bv being 0x0
+ * Init all the features state with header.xfeatures being 0x0
*/
copy_kernel_to_xregs_booting(&init_fpstate.xsave);
--
1.9.1
next reply other threads:[~2016-02-22 19:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 18:59 Yu-cheng Yu [this message]
2016-02-22 19:55 ` [PATCH 07/10] x86/xsaves: Fix init_fpstate.header.xcomp_bv Dave Hansen
2016-02-22 20:42 ` Yu-cheng Yu
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=1456167596-3932-1-git-send-email-yu-cheng.yu@intel.com \
--to=yu-cheng.yu@intel.com \
--cc=bp@suse.de \
--cc=dave.hansen@linux.intel.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=ravi.v.shankar@intel.com \
--cc=sai.praneeth.prakhya@intel.com \
--cc=tglx@linutronix.de \
--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