mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: math_state_restore and kernel_fpu_end disable interrupts?
@ 2014-01-19 11:35 George Spelvin
  2014-01-19 19:02 ` Nate Eldredge
  0 siblings, 1 reply; 9+ messages in thread
From: George Spelvin @ 2014-01-19 11:35 UTC (permalink / raw)
  To: nate; +Cc: adilger, jack, linux, linux-kernel, viro

THANK YOU!

I've been having a problem with ext4 metadata checksums, which use SSE
for large blocks, and traced it to kernel_fpu_end() disabling interrupts,
but had paused to debug this (I assumed well-tested) piece of kernel
code before pushing it harder.

(Search October-December LKML archives for "3.11.4: kernel BUG at
fs/buffer.c:1268".")

No, I'm pretty sure it's a real bug.  At least, it's biting me on the
ass.


^ permalink raw reply	[flat|nested] 9+ messages in thread
* math_state_restore and kernel_fpu_end disable interrupts?
@ 2014-01-18  6:15 Nate Eldredge
  0 siblings, 0 replies; 9+ messages in thread
From: Nate Eldredge @ 2014-01-18  6:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Maarten Baert

In trying to track down a bug (see below), I noticed that 
math_state_restore() in arch/x86/kernel/traps.c appears to unconditionally 
disable interrupts when called.  Is this intended behavior or a bug?

The bug in question is triggered by dumping core on an ecryptfs file 
system when aesni-intel is loaded.  (See 
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1265841 for the 
original report.)  The symptom is that __find_get_block() gets called with 
interrupts disabled, causing a BUG().  I tried to find where interrupts 
were getting disabled and wound up in aes_set_key_common() in 
arch/x86/crypto/aesni-intel_glue.c.  It calls aesni_set_key(), and since 
that uses the FPU, it wraps it in kernel_fpu_begin()/kernel_fpu_end(). 
But kernel_fpu_end() calls math_state_restore() which disables interrupts. 
I've verified that interrupts are still enabled just before the call to 
kernel_fpu_end().

math_state_restore() does:

local_irq_enable();
init_fpu(tsk);
local_irq_disable();

with the result that interrupts are disabled when it finishes, even if 
they were enabled to begin with.  That looks strange to me; are we sure it 
shouldn't just save and restore the interrupt flag?  Or are we not 
supposed to call it with interrupts enabled?

Given the intimidating comment preceding math_state_restore() ("Don't 
touch unless you *really* know how it works"), it's entirely possible I am 
missing something...

Any suggestions appreciated.  Thanks!

-- 
Nate Eldredge
nate@thatsmathematics.com


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-01-28 19:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-19 11:35 math_state_restore and kernel_fpu_end disable interrupts? George Spelvin
2014-01-19 19:02 ` Nate Eldredge
2014-01-19 21:02   ` George Spelvin
2014-01-21  2:22     ` Nate Eldredge
2014-01-21 13:58       ` Jan Kara
2014-01-21 17:10       ` George Spelvin
2014-01-28 18:53     ` George Spelvin
2014-01-28 19:23       ` Nate Eldredge
  -- strict thread matches above, loose matches on Subject: below --
2014-01-18  6:15 Nate Eldredge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®