From: Ingo Molnar <mingo@elte.hu>
To: "Jürgen Mell" <j.mell@t-online.de>
Cc: "Suresh Siddha" <suresh.b.siddha@intel.com>,
"Andi Kleen" <andi@firstfloor.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, arjan@linux.intel.com,
hpa@zytor.com, tglx@linutronix.de,
"Simon Holm Thøgersen" <odie@cs.aau.dk>
Subject: Re: CONFIG_PREEMPT causes corruption of application's FPU stack
Date: Wed, 4 Jun 2008 12:53:17 +0200 [thread overview]
Message-ID: <20080604105317.GA17874@elte.hu> (raw)
In-Reply-To: <200806040944.15815.j.mell@t-online.de>
* Jürgen Mell <j.mell@t-online.de> wrote:
> > Jürgen, I think I found the reason for your issue aswell.
> >
> > As you observed, it is probably coming from the commit
> > acc207616a91a413a50fdd8847a747c4a7324167, i386: add sleazy FPU
> > optimization
> >
> > It's a side affect though. This is the failing scenario:
> >
> > process 'A' in save_i387_ia32() just after clear_used_math()
> >
> > Got an interrupt and pre-empted out.
> >
> > At the next context switch to process 'A' again, kernel tries to restore
> > the math state proactively and sees a fpu_counter > 0 and
> > !tsk_used_math()
> >
> > This results in init_fpu() during the __switch_to()'s
> > math_state_restore()
> >
> > And resulting in fpu corruption which will be saved/restored
> > (save_i387_fxsave and restore_i387_fxsave) during the remaining
> > part of the signal handling after the context switch.
> >
> > So in short, yes the problem shows up for preempt enabled kernels and
> > the same patch I sent out 30 mins back (appended again) should fix your
> > issue aswell. Can you please test this and check if my theory is indeed
> > correct. If it fixes your issue aswell, then I will re-post the patch
> > with a new changelog and updated comments in the patch.
> >
>
> I have applied your patch to both an openSUSE 2.6.22.17 kernel and a
> 2.6.26-rc4 kernel.org kernel and run the test with Einstein@home on
> two different machines. One machine is running 24 hours now, the other
> 18 hours.
>
> During this time there were no faults on both machines.
>
> As it never before took more than 12 hours until the first appearance
> of the problem, I think your patch fixed it. Very good work!
>
> I will continue running the test, but I believe we can call this
> fixed.
>
> Thank you again!
fix applied to tip/x86/urgent. Thanks everyone, nice find!
Ingo
next prev parent reply other threads:[~2008-06-04 10:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-01 9:01 CONFIG_PREEMPT causes corruption of application's FPU stack j.mell
2008-06-01 11:40 ` Andi Kleen
2008-06-01 16:47 ` Jürgen Mell
2008-06-02 21:37 ` Suresh Siddha
2008-06-02 22:57 ` Suresh Siddha
2008-06-03 6:02 ` Jürgen Mell
2008-06-04 7:44 ` Jürgen Mell
2008-06-04 10:53 ` Ingo Molnar [this message]
2008-06-04 12:55 ` Steven Rostedt
2008-06-04 13:02 ` Ingo Molnar
2008-06-01 12:12 ` Steven Rostedt
2008-06-01 17:11 ` Simon Holm Thøgersen
2008-06-02 21:31 ` Suresh Siddha
2008-06-03 13:23 ` Simon Holm Thøgersen
2008-06-03 19:43 ` Suresh Siddha
2008-06-03 21:08 ` Simon Holm Thøgersen
-- strict thread matches above, loose matches on Subject: below --
2008-05-24 18:52 j.mell
2008-05-17 16:31 Jürgen Mell
2008-05-18 15:07 ` Steven Rostedt
2008-05-18 15:57 ` Jürgen Mell
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=20080604105317.GA17874@elte.hu \
--to=mingo@elte.hu \
--cc=andi@firstfloor.org \
--cc=arjan@linux.intel.com \
--cc=hpa@zytor.com \
--cc=j.mell@t-online.de \
--cc=linux-kernel@vger.kernel.org \
--cc=odie@cs.aau.dk \
--cc=rostedt@goodmis.org \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
/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