Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1271100
| From | "Jason A. Donenfeld" <Jason@zx2c4.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | irq_fpu_usable() is irreliable |
| Date | 2015-11-17 12:40 +0100 |
| Message-ID | <qvMMa-4qX-21@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Hi folks,
The availability of the FPU in kernel space, as you know, is
determined by this function:
bool irq_fpu_usable(void)
{
return !in_interrupt() ||
interrupted_user_mode() ||
interrupted_kernel_fpu_idle();
}
My understanding is that the first check is !in_interrupt(), because
if `current` is valid - if we are in process context - then we have a
place to store the existing FPU regs in kernel_fpu_begin, to be
restored later in kernel_fpu_end. Recently I've been tracking down a
problem in which irq_fpu_usable() returns false, yet a stack trace
shows the first function is the syscall entry point. This leads me to
believe that in_interrupt() is not an adequate way of testing for a
valid `current`. In my particular problematic case, the reason
in_interrupt() was returning false is because a number of
rcu_read_lock_bh()s were being held; IOW this is occurring in the
ndo_start_xmit path of a network driver.
I therefore propose changing the function to this:
bool irq_fpu_usable(void)
{
return (!in_irq() && !in_nmi()) ||
interrupted_user_mode() ||
interrupted_kernel_fpu_idle();
}
What would you think of that?
Thanks,
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
irq_fpu_usable() is irreliable "Jason A. Donenfeld" <Jason@zx2c4.com> - 2015-11-17 12:40 +0100
Re: irq_fpu_usable() is irreliable Ingo Molnar <mingo@kernel.org> - 2015-11-18 08:00 +0100
Re: irq_fpu_usable() is irreliable "Jason A. Donenfeld" <Jason@zx2c4.com> - 2015-11-18 13:20 +0100
Re: irq_fpu_usable() is irreliable "Jason A. Donenfeld" <Jason@zx2c4.com> - 2015-11-18 21:00 +0100
Re: irq_fpu_usable() is irreliable Ingo Molnar <mingo@kernel.org> - 2015-11-27 09:50 +0100
Re: irq_fpu_usable() is irreliable Ingo Molnar <mingo@kernel.org> - 2015-11-27 09:50 +0100
csiph-web