lkml.org 
[lkml]   [2014]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Make math_state_restore() save and restore the interrupt flag
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 <nate@thatsmathematics.com>

> 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



\
 
 \ /
  Last update: 2014-02-06 07:21    [W:0.117 / U:3.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site