lkml.org 
[lkml]   [2015]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/4] x86/fpu: document user_fpu_begin()
On Wed, Mar 11, 2015 at 06:34:09PM +0100, Oleg Nesterov wrote:
> Currently user_fpu_begin() has a single caller and it is not clear that
> why do we actually need it, and why we should not worry about preemption
> right after preempt_enable().
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> ---
> arch/x86/include/asm/fpu-internal.h | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
> index 4bec98f..c615ae9 100644
> --- a/arch/x86/include/asm/fpu-internal.h
> +++ b/arch/x86/include/asm/fpu-internal.h
> @@ -464,7 +464,9 @@ static inline int restore_xstate_sig(void __user *buf, int ia32_frame)
> * Need to be preemption-safe.
> *
> * NOTE! user_fpu_begin() must be used only immediately before restoring
> - * it. This function does not do any save/restore on their own.
> + * it. This function does not do any save/restore on its own. In a lazy
> + * fpu mode this is just optimization to avoid a dna fault, the task can
> + * lose FPU right after preempt_enable().
> */

I cleaned it up a bit more, if you don't mind:

---
From: Oleg Nesterov <oleg@redhat.com>
Date: Wed, 11 Mar 2015 18:34:09 +0100
Subject: [PATCH] x86/fpu: Document user_fpu_begin()

Currently, user_fpu_begin() has a single caller and it is not clear why
do we actually need it and why we should not worry about preemption
right after preempt_enable().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Riikonen <priikone@iki.fi>
Cc: Rik van Riel <riel@redhat.com>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/20150311173409.GC5032@redhat.com
Signed-off-by:
---
arch/x86/include/asm/fpu-internal.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index 810f20fd4e4e..e8ee3da3b924 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -508,10 +508,12 @@ static inline int restore_xstate_sig(void __user *buf, int ia32_frame)
}

/*
- * Need to be preemption-safe.
+ * Needs to be preemption-safe.
*
* NOTE! user_fpu_begin() must be used only immediately before restoring
- * it. This function does not do any save/restore on their own.
+ * the save state. It does not do any saving/restoring on its own. In
+ * lazy FPU mode, it is just an optimization to avoid a #NM exception,
+ * the task can lose the FPU right after preempt_enable().
*/
static inline void user_fpu_begin(void)
{
--
--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--


\
 
 \ /
  Last update: 2015-03-13 11:01    [W:0.241 / U:23.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site