Re: [PATCH 1/1] x86/fpu: math_state_restore() should not blindly disable irqs

From: Ingo Molnar
Date: Sat Mar 07 2015 - 05:36:24 EST



* Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:

> On Fri, Mar 6, 2015 at 2:00 PM, Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> > On Fri, Mar 6, 2015 at 11:23 AM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> >>
> >> Please don't. IMO it's really nice that we don't use trap gates at
> >> all on x86_64, and I find the conditional_sti thing much nicer than
> >> having to audit all of the entry code to see whether it's safe to run
> >> it with IRQs on.
> >
> > So I'm not sure I see much difference, but I'd certainly be ok with
> > just moving the "conditional_sti()" up unconditionally to be the first
> > thing in do_device_not_available().
>
> I'd be fine with that. The important difference is that it's after swapgs.

The thing is, we have to be careful about NMI contexts anyway. So how
about being careful in irq contexts as well?

We could shave a good 10 cycles from the FPU trap overhead, maybe
more?

We could save the same 10 cycles from page fault overhead as well,
AFAICS.

Hm?

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/