lkml.org 
[lkml]   [2018]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 11/11] x86/fpu: defer FPU state load until return to userspace
On 2018-10-04 09:14:33 [-0700], Andy Lutomirski wrote:
> > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > index 3b2490b819181..3dad5c3b335eb 100644
> > --- a/arch/x86/entry/common.c
> > +++ b/arch/x86/entry/common.c
> > @@ -196,6 +197,14 @@ __visible inline void prepare_exit_to_usermode(struct pt_regs *regs)
> > if (unlikely(cached_flags & EXIT_TO_USERMODE_LOOP_FLAGS))
> > exit_to_usermode_loop(regs, cached_flags);
> >
> > + /* Reload ti->flags; we may have rescheduled above. */
> > + cached_flags = READ_ONCE(ti->flags);
> > +
> > + if (unlikely(cached_flags & _TIF_LOAD_FPU))
> > + switch_fpu_return();
> > + else
> > + fpregs_is_state_consistent();
>
> Shouldn't this be:
>
> fpregs_assert_state_consistent(); /* see below */
>
> if (unlikely(cached_flags & _TIF_LOAD_FPU))
> switch_fpu_return();

hmm. This should work.

> > diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h
> > index a9caac9d4a729..e3077860f7333 100644
> > --- a/arch/x86/include/asm/fpu/api.h
> > +++ b/arch/x86/include/asm/fpu/api.h
> > @@ -27,6 +27,17 @@ extern void kernel_fpu_begin(void);
> > extern void kernel_fpu_end(void);
> > extern bool irq_fpu_usable(void);
> >
> > +#ifdef CONFIG_X86_DEBUG_FPU
> > +extern void fpregs_is_state_consistent(void);
> > +#else
> > +static inline void fpregs_is_state_consistent(void) { }
> > +#endif
>
> Can you name this something like fpregs_assert_state_consistent()?
sure.

Sebastian

\
 
 \ /
  Last update: 2018-10-12 22:26    [W:0.175 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site