From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 5 Feb 2014 22:26:24 -0700 (MST) From: Nate Eldredge To: Suresh Siddha cc: Linus Torvalds , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , the arch/x86 maintainers , stable , Linux Kernel Mailing List , Maarten Baert , Jan Kara , George Spelvin , Pekka Riikonen Subject: Re: [PATCH] Make math_state_restore() save and restore the interrupt flag In-Reply-To: <1391410583.3801.6.camel@europa> Message-ID: References: <1391325599.6481.5.camel@europa> <1391410583.3801.6.camel@europa> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: On Sun, 2 Feb 2014, Suresh Siddha wrote: > Here is the second patch, which should fix the issue reported in this > thread. Maarten, Nate, George, please give this patch a try as is and > see if it helps address the issue you ran into. And please ack/review > with your test results. 3.13 plus this patch: boots and fixes the testcase I reported (core dump on ecrypt). Tested-by: Nate Eldredge > diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c > index 4e5f770..670bba1 100644 > --- a/arch/x86/kernel/i387.c > +++ b/arch/x86/kernel/i387.c > @@ -87,10 +87,19 @@ EXPORT_SYMBOL(__kernel_fpu_begin); > > void __kernel_fpu_end(void) > { > - if (use_eager_fpu()) > - math_state_restore(); > - else > + if (use_eager_fpu()) { > + /* > + * For eager fpu, most the time, tsk_used_math() is true. > + * Restore the user math as we are done with the kernel usage. > + * At few instances during thread exit, signal handling etc, > + * tsk_used_math() is false. Those few places will take proper > + * actions, so we don't need to restore the math here. > + */ > + if (likely(tsk_used_math(current))) > + math_state_restore(); > + } else { > stts(); > + } > } > EXPORT_SYMBOL(__kernel_fpu_end); -- Nate Eldredge nate@thatsmathematics.com