mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nate Eldredge <nate@thatsmathematics.com>
To: George Spelvin <linux@horizon.com>
Cc: adilger@dilger.ca, jack@suse.cz, linux-kernel@vger.kernel.org,
	viro@zeniv.linux.org.uk,
	Suresh Siddha <suresh.b.siddha@intel.com>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Maarten Baert <maarten-baert@hotmail.com>
Subject: Re: math_state_restore and kernel_fpu_end disable interrupts?
Date: Sun, 19 Jan 2014 12:02:22 -0700 (MST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1401191150520.2663@minerva.lan> (raw)
In-Reply-To: <20140119113555.30961.qmail@science.horizon.com>

[Here's my original message, since George's reply didn't quote or 
reference it: https://lkml.org/lkml/2014/1/18/3.  Summary: 
math_state_restore() always leaves interrupts disabled, and I think this 
is a bug.]

On Sun, 19 Jan 2014, George Spelvin wrote:

> 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.

Interesting.  I guess it's not surprising this has other effects.

Here's the commit that added the code in question (about 6 years ago): 
https://github.com/torvalds/linux/commit/aa283f49276e7d840a40fb01eee6de97eaa7e012

It's credited to Suresh Siddha, whom I've cc'ed (along with others who 
signed off).  Suresh, if you're still around, could you comment on why 
math_state_restore always leaves interrupts disabled, regardless of their 
state on entry?  Is there a deep reason or is it a bug?

Assuming it's a bug, here's the obvious patch:

--- linux-source-3.11.0/arch/x86/kernel/traps.c	2013-09-02 14:46:10.000000000 -0600
+++ linux-source-3.11.0-nate/arch/x86/kernel/traps.c	2014-01-19 11:25:32.977221476 -0700
@@ -624,6 +624,9 @@
  	struct task_struct *tsk = current;

  	if (!tsk_used_math(tsk)) {
+		unsigned long flags;
+
+		local_save_flags(flags);
  		local_irq_enable();
  		/*
  		 * does a slab alloc which can sleep
@@ -635,7 +638,7 @@
  			do_group_exit(SIGKILL);
  			return;
  		}
-		local_irq_disable();
+		local_irq_restore(flags);
  	}

  	__thread_fpu_begin(tsk);

I tested it briefly: the kernel still boots fine, and it fixes the problem 
I was seeing (BUG() when core dumping on ecryptfs).  George, does it help 
your problem?

Thanks everyone!

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

-- 
Nate Eldredge
nate@thatsmathematics.com


  reply	other threads:[~2014-01-19 19:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-19 11:35 George Spelvin
2014-01-19 19:02 ` Nate Eldredge [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1401191150520.2663@minerva.lan \
    --to=nate@thatsmathematics.com \
    --cc=adilger@dilger.ca \
    --cc=arjan@linux.intel.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=maarten-baert@hotmail.com \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®