2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

x86/xsave: Set only used XFEATURE_* in xstate_bv

Setting all supported by CPU features in xstate_bv may bring it into
dirty-upper-state as documented in specs, resulting in lower
performance. Let's not do this and set only those have been used by
dumpee.

P.S.
Off course it has to be a one-liner!

Fixes: #1171

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
This commit is contained in:
Dmitry Safonov
2021-03-09 13:24:20 +00:00
committed by Andrei Vagin
parent 3f8e3220ba
commit 4930c98020

View File

@@ -433,7 +433,7 @@ int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core)
#define assign_array(dst, src, e) memcpy(dst.e, (src)->e, sizeof(dst.e)) #define assign_array(dst, src, e) memcpy(dst.e, (src)->e, sizeof(dst.e))
#define assign_xsave(feature, xsave, member, area) \ #define assign_xsave(feature, xsave, member, area) \
do { \ do { \
if (compel_fpu_has_feature(feature)) { \ if (compel_fpu_has_feature(feature) && (xsave->xstate_bv & (1UL << feature))) { \
uint32_t off = compel_fpu_feature_offset(feature); \ uint32_t off = compel_fpu_feature_offset(feature); \
void *to = &area[off]; \ void *to = &area[off]; \
void *from = xsave->member; \ void *from = xsave->member; \