[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1421012793-30106-11-git-send-email-riel@redhat.com>
Date: Sun, 11 Jan 2015 16:46:32 -0500
From: riel@...hat.com
To: linux-kernel@...r.kernel.org
Cc: mingo@...hat.com, hpa@...or.com, matt.fleming@...el.com,
bp@...e.de, oleg@...hat.com, pbonzini@...hat.com,
tglx@...utronix.de, luto@...capital.net
Subject: [RFC PATCH 10/11] x86,fpu: fix fpu_copy to deal with not-loaded fpu
From: Rik van Riel <riel@...hat.com>
It is possible to hit fpu_copy in eager fpu mode, but without
the current task's FPU context actually loaded into the CPU.
In that case, we should copy the FPU context from memory, not
save it from registers.
Signed-off-by: Rik van Riel <riel@...hat.com>
---
arch/x86/include/asm/fpu-internal.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index 8546c0a..095dacc 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -594,7 +594,8 @@ static inline void fpu_free(struct fpu *fpu)
static inline void fpu_copy(struct task_struct *dst, struct task_struct *src)
{
- if (use_eager_fpu()) {
+ preempt_disable();
+ if (use_eager_fpu() && __thread_has_fpu(src)) {
memset(&dst->thread.fpu.state->xsave, 0, xstate_size);
__save_fpu(dst);
} else {
@@ -604,6 +605,7 @@ static inline void fpu_copy(struct task_struct *dst, struct task_struct *src)
unlazy_fpu(src);
memcpy(dfpu->state, sfpu->state, xstate_size);
}
+ preempt_enable();
}
static inline unsigned long
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists