Commit af7f8721 authored by Ingo Molnar's avatar Ingo Molnar

x86/fpu: Document fpu__unlazy_stopped()

Explain its usage and also document a TODO item.
Reviewed-by: default avatarBorislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 4c138410
...@@ -284,10 +284,27 @@ int fpstate_alloc_init(struct task_struct *curr) ...@@ -284,10 +284,27 @@ int fpstate_alloc_init(struct task_struct *curr)
EXPORT_SYMBOL_GPL(fpstate_alloc_init); EXPORT_SYMBOL_GPL(fpstate_alloc_init);
/* /*
* The _current_ task is using the FPU for the first time * This function is called before we modify a stopped child's
* so initialize it and set the mxcsr to its default * FPU state context.
* value at reset if we support XMM instructions and then *
* remember the current task has used the FPU. * If the child has not used the FPU before then initialize its
* FPU context.
*
* If the child has used the FPU before then unlazy it.
*
* [ After this function call, after the context is modified and
* the child task is woken up, the child task will restore
* the modified FPU state from the modified context. If we
* didn't clear its lazy status here then the lazy in-registers
* state pending on its former CPU could be restored, losing
* the modifications. ]
*
* This function is also called before we read a stopped child's
* FPU state - to make sure it's modified.
*
* TODO: A future optimization would be to skip the unlazying in
* the read-only case, it's not strictly necessary for
* read-only access to the context.
*/ */
static int fpu__unlazy_stopped(struct task_struct *child) static int fpu__unlazy_stopped(struct task_struct *child)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment