Re: [tip:x86/fpu] x86/fpu: Don't export __kernel_fpu_{begin,end}()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [tip:x86/fpu] x86/fpu: Don't export __kernel_fpu_{begin,end}()
- From: Borislav Petkov <bp@xxxxxxxxx>
- Date: Tue, 4 Dec 2018 13:33:55 +0100
- Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, the arch/x86 maintainers <x86@xxxxxxxxxx>, nstange@xxxxxxx, Rik van Riel <riel@xxxxxxxxxxx>, KVM devel mailing list <kvm@xxxxxxxxxxxxxxx>, "Jason A. Donenfeld" <Jason@xxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Radim Krčmář <rkrcmar@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxx>, linux-efi <linux-efi@xxxxxxxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, linux-tip-commits@xxxxxxxxxxxxxxx
- In-reply-to: <20181204121510.ebw4vb265lcepa2m@linutronix.de>
- References: <20181129150210.2k4mawt37ow6c2vq@linutronix.de> <tip-7d79adb87fa79e4a4c59424fd5b5a922861fc5f6@git.kernel.org> <CAKv+Gu-s59fSWrMevmbJWyBtNVYLkF7FATALGBD470CWsN9C1Q@mail.gmail.com> <20181203220841.GB4794@zn.tnic> <20181204121510.ebw4vb265lcepa2m@linutronix.de>
- User-agent: Mutt/1.10.1 (2018-07-13)
On Tue, Dec 04, 2018 at 01:15:10PM +0100, Sebastian Andrzej Siewior wrote:
> Do you refer to
> | * - by IRQ context code to potentially use the FPU
> | * if it's unused.
>
> ? It is possible to use the FPU in IRQ context.
I mean interrupted_user_mode() where we apparently can use the FPU when
handling an IRQ from user mode.
> The FPU could be used in user-context surrounded by kernel_fpu_begin().
Right, that.
> This only disables preemption so an IRQ could interrupt it. This IRQ
> could then use the FPU or raise a SoftIRQ which would use it.
> Therefore on x86 it is required to check with irq_fpu_usable() if the
Yes, and the check that thing does is:
return !in_interrupt() ||
interrupted_user_mode() || ...
so you're either *not* in interrupt, or you've gotten the IRQ while in
user mode.
> FPU can be used. If the FPU can not be used, you have to implement
> fallback code.
>
> With the "restore FPU on return to userland" series we need to modify
> the FPU in a few places. The softirq and preemption is disabled. I
> didn't find any in-IRQ users.
> Going forward I would like to remove the in-IRQ part and
> irq_fpu_usable() and disable softirq as part of kernel_fpu_begin().
Right, and we should document all those new conditions prominently so
that people are aware.
Thx.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
[Index of Archives]
[Linux Stable Commits]
[Linux Stable Kernel]
[Linux Kernel]
[Linux USB Devel]
[Linux Video &Media]
[Linux Audio Users]
[Yosemite News]
[Linux SCSI]