[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160502171936.GA22224@test-lenovo>
Date: Mon, 2 May 2016 10:19:36 -0700
From: Yu-cheng Yu <yu-cheng.yu@...el.com>
To: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...e.de>,
Sai Praneeth Prakhya <sai.praneeth.prakhya@...el.com>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>
Subject: Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows
correct xstates copy from kernel to user directly
On Mon, May 02, 2016 at 09:43:47AM -0700, Dave Hansen wrote:
> > If (fpu.fpstate_active == 0), then the task does not use FPU; we don't
> > want to save these registers, right?
>
> No. It's possible to have fpstate_active=0 while fpregs_active=1. Such
> a task uses the FPU, but just hasn't done an XSAVE* to save the register
> content to the fpstate buffer.
>
> Note, this is just theoretical, and does not happen in this particular
> call path today.
What about...
static int may_copy_fpregs_to_sigframe(void)
{
if (fpregs_active())
return 1;
WARN_ONCE(!current->thread.fpu.fpstate_active,
"direct FPU save with no math use\n");
if (boot_cpu_has(X86_FEATURE_XSAVES))
return 1;
return 0;
}
Powered by blists - more mailing lists