[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150129210118.GB30530@redhat.com>
Date: Thu, 29 Jan 2015 22:01:18 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Rik van Riel <riel@...hat.com>
Cc: "H. Peter Anvin" <hpa@...or.com>,
Suresh Siddha <suresh.b.siddha@...el.com>,
Andy Lutomirski <luto@...capital.net>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Fenghua Yu <fenghua.yu@...el.com>,
the arch/x86 maintainers <x86@...nel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: question about save_xstate_sig() - WHY DOES THIS WORK?
On 01/27, Rik van Riel wrote:
>
> On 01/27/2015 03:27 PM, Rik van Riel wrote:
> > On 01/27/2015 02:40 PM, Oleg Nesterov wrote:
>
> >>>> - Why unlazy_fpu() always does __save_init_fpu() even if
> >>>> use_eager_fpu?
> >>>>
> >>>> and note that in this case __thread_fpu_end() is wrong if
> >>>> use_eager_fpu, but fortunately the only possible caller of
> >>>> unlazy_fpu() is coredump. fpu_copy() checks use_eager_fpu().
> >>>>
> >>>> - Is unlazy_fpu()->__save_init_fpu() safe wrt
> >>>> __kernel_fpu_begin() from irq?
> >
> > It looks like it should be safe, as long as __save_init_fpu() knows
> > that the task no longer has the FPU after __kernel_fpu_end(), so it
> > does not try to save the kernel FPU state to the user's
> > task->thread.fpu.state->xstate
> >
> > The caveat here is that __kernel_fpu_begin()/__kernel_fpu_end()
> > needs to be kept from running during unlazy_fpu().
> >
> > This means interrupted_kernel_fpu_idle and/or irq_fpu_usable need
> > to check whether preemption is disabled, and lock out
> > __kernel_fpu_begin() when preemption is disabled.
> >
> > It does not look like it currently does that...
>
> ... and that won't work, because preempt_disable() is a noop
> without CONFIG_PREEMPT enabled. Sigh.
>
> Not sure how to work around that, except by having
> __Kernel_fpu_end() always restore the task FPU state, if the
> task had the FPU when entering.
This is what it does after
[PATCH 2/3] x86, fpu: don't abuse ->has_fpu in __kernel_fpu_{begin,end}()
http://marc.info/?l=linux-kernel&m=142134967718861&w=2
(acked by you and already applied).
But probably I misunderstood you, I do not see how this can help...
OK, lets discuss this later.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists