linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suresh Siddha <sbsiddha@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nate Eldredge <nate@thatsmathematics.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	stable <stable@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Maarten Baert <maarten-baert@hotmail.com>,
	Jan Kara <jack@suse.cz>, George Spelvin <linux@horizon.com>,
	Pekka Riikonen <priikone@iki.fi>
Subject: Re: [PATCH] Make math_state_restore() save and restore the interrupt flag
Date: Thu, 30 Jan 2014 23:33:18 -0800	[thread overview]
Message-ID: <CALmL7E9LRZCPH5EuS_Jm-iJzpKnWj4OsXmS44VYDpLoDKPfVxA@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFz_CYQGxukpRb5zF5SZ9ZWqpvohoUzqdEb-3+bR_FMnWA@mail.gmail.com>

hi,

On Thu, Jan 30, 2014 at 2:24 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> I'm adding in some people here, because I think in the end this bug
> was introduced by commit 304bceda6a18 ("x86, fpu: use non-lazy fpu
> restore for processors supporting xsave") that introduced that
> math_state_restore() in kernel_fpu_end(), but we have other commits
> (like 5187b28ff08: "x86: Allow FPU to be used at interrupt time even
> with eagerfpu") that seem tangential too and might be part of why it
> actually *triggers* now.
>
> Comments?

I haven't been following the recent changes closely, so before I get a
chance to review the current bug and the relevant commits, wanted to
added that:

a. delayed dynamic allocation of FPU state area was not a good idea
(from me). Given most of the future cases will be anyway using eager
FPU (because of processor features like xsaveopt etc, applications
implicitly using FPU because of optimizations in commonly used
libraries etc), we should probably go back to allocation of FPU state
area during thread creation for everyone (including non-eager cases).
Memory savings will be small anyways and the code complexity
introducing subtle bugs like this in not worth it.

b. with the above change, kernel_fpu_begin() will just save any user
live math state and be ready for kernel math operations. And
kernel_fpu_end() will drop the kernel math state and for  eager-fpu
case restore the user math state.

We will avoid worrying about any memory allocations in the
math_state_restore() with interrupts disabled etc.

If there are no objections, I will see if I can come up with a quick
patch. or will ask HPA to help fill me in.

thanks,
suresh

  reply	other threads:[~2014-01-31  7:33 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30 22:01 [PATCH] Make math_state_restore() save and restore the interrupt flag Nate Eldredge
2014-01-30 22:24 ` Linus Torvalds
2014-01-31  7:33   ` Suresh Siddha [this message]
2014-02-01 19:27     ` Linus Torvalds
2014-02-01 19:35       ` H. Peter Anvin
2014-02-01 19:46         ` Linus Torvalds
2014-02-01 20:00           ` H. Peter Anvin
2014-02-01 20:16             ` Linus Torvalds
2014-02-01 20:16           ` H. Peter Anvin
2014-02-01 21:17           ` George Spelvin
2014-02-01 21:36             ` H. Peter Anvin
2014-02-01 23:40             ` H. Peter Anvin
2014-02-02  0:17               ` Linus Torvalds
2014-02-02  1:19               ` George Spelvin
2014-02-02  1:25                 ` H. Peter Anvin
2014-02-02  8:45           ` Pekka Riikonen
2014-02-02  1:06       ` Suresh Siddha
2014-02-02  1:26         ` H. Peter Anvin
2014-02-02  1:35           ` Suresh Siddha
2014-02-02  1:38             ` Linus Torvalds
2014-02-02  1:47               ` Suresh Siddha
2014-02-02  1:51                 ` Linus Torvalds
2014-02-02  1:57                   ` H. Peter Anvin
2014-02-02  2:05                     ` Linus Torvalds
2014-02-02  2:12                       ` H. Peter Anvin
2014-02-02  1:59                   ` Suresh Siddha
2014-02-02  1:43             ` H. Peter Anvin
2014-02-02  1:47               ` Linus Torvalds
2014-02-02  7:19         ` Suresh Siddha
2014-02-02 19:15           ` Linus Torvalds
2014-02-03  6:56             ` Suresh Siddha
2014-02-03 18:20               ` Linus Torvalds
2014-02-04  6:03                 ` Suresh Siddha
2014-02-06  5:26               ` Nate Eldredge
2014-02-06  5:34                 ` George Spelvin
2014-02-13 15:45               ` Maarten Baert
2014-02-13 20:00                 ` George Spelvin
2014-03-11 19:36               ` [tip:x86/urgent] x86, fpu: Check tsk_used_math() in kernel_fpu_end() for eager FPU tip-bot for Suresh Siddha
2014-02-27 23:44           ` [PATCH] Make math_state_restore() save and restore the interrupt flag H. Peter Anvin
2014-03-07 23:18             ` H. Peter Anvin
2014-03-08  6:18               ` Suresh Siddha

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=CALmL7E9LRZCPH5EuS_Jm-iJzpKnWj4OsXmS44VYDpLoDKPfVxA@mail.gmail.com \
    --to=sbsiddha@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=maarten-baert@hotmail.com \
    --cc=mingo@kernel.org \
    --cc=nate@thatsmathematics.com \
    --cc=priikone@iki.fi \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).