[CRIU] [PATCH] x86: Allow forward compatibility mode for FPU
Cyrill Gorcunov
gorcunov at openvz.org
Tue Jan 28 03:48:46 PST 2014
At the moment we refuse to restore if CPU mismatch
at FPU related features. Strictly speaking this is
not required.
We can allow to restore on the node with xsave capability
even if the node was created on cpu which has fxsave
capability only.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
arch/x86/crtools.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/arch/x86/crtools.c b/arch/x86/crtools.c
index 0b59d32309b2..4b52b4554c16 100644
--- a/arch/x86/crtools.c
+++ b/arch/x86/crtools.c
@@ -317,12 +317,8 @@ static bool valid_xsave_frame(CoreEntry *core)
}
if (cpu_has_feature(X86_FEATURE_XSAVE)) {
- if (!core->thread_info->fpregs->xsave) {
- pr_err("FPU xsave area is missing, "
- "but host cpu requires it\n");
- return false;
- }
- if (core->thread_info->fpregs->xsave->n_ymmh_space < ARRAY_SIZE(x->ymmh.ymmh_space)) {
+ if (core->thread_info->fpregs->xsave &&
+ core->thread_info->fpregs->xsave->n_ymmh_space < ARRAY_SIZE(x->ymmh.ymmh_space)) {
pr_err("Corruption in FPU ymmh_space area "
"(got %li but %li expected)\n",
(long)core->thread_info->fpregs->xsave->n_ymmh_space,
@@ -402,7 +398,13 @@ int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core)
void *magic2;
x->xsave_hdr.xstate_bv = XSTATE_FP | XSTATE_SSE | XSTATE_YMM;
- assign_array(x->ymmh, core->thread_info->fpregs->xsave, ymmh_space);
+
+ /*
+ * fpregs->xsave pointer might not present on image so we
+ * simply clear out all ymm registers.
+ */
+ if (core->thread_info->fpregs->xsave)
+ assign_array(x->ymmh, core->thread_info->fpregs->xsave, ymmh_space);
fpx_sw->magic1 = FP_XSTATE_MAGIC1;
fpx_sw->xstate_bv = XSTATE_FP | XSTATE_SSE | XSTATE_YMM;
--
1.8.3.1
More information about the CRIU
mailing list