[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1607597639a6c6255127fef07704ee9193e33166.camel@intel.com>
Date: Thu, 19 Dec 2019 09:40:06 -0800
From: Yu-cheng Yu <yu-cheng.yu@...el.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Tony Luck <tony.luck@...el.com>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Rik van Riel <riel@...riel.com>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v2 3/3] x86/fpu/xstate: Invalidate fpregs when
__fpu_restore_sig() fails
On Thu, 2019-12-19 at 18:16 +0100, Sebastian Andrzej Siewior wrote:
> On 2019-12-19 08:44:08 [-0800], Yu-cheng Yu wrote:
> > Yes, this works. But then everywhere that calls copy_*_to_xregs_*() etc. needs to be checked.
> > Are there other alternatives?
>
> I don't like the big hammer approach of your very much. It might make
> all it "correct" but then it might lead to more "invalids" then needed.
> It also required to export the symbol which I would like to avoid.
Copying to registers invalids current fpregs context. It might not cause
extra register loading, because registers are in fact already invalidated
and any task owning the context needs to reload anyway. Setting
fpu_fpregs_owner_ctx is only to let the rest of the kernel know the
fact that already happened.
But, I agree with you the patch does look biggish.
>
> So if this patch works for you and you don't find anything else where it
> falls apart then I will audit tomorrow all callers which got the
> "invalidator" added and check for that angle.
Yes, that works for me. Also, most of these call sites are under fpregs_lock(),
and we could use __cpu_invalidate_fpregs_state().
I was also thinking maybe add warnings when any new code re-introduces the issue,
but not sure where to add that. Do you think that is needed?
Thanks,
Yu-cheng
Powered by blists - more mailing lists