mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
x86: cpu -- Add ability to ignore xsaves
Currently even if kernel supports compact xsave frame a user can disable it by passing noxsaves argument as a boot option. Thus cpuid instruction will report its presence but in real it gonna be masked from kernel pov. Lets do the same and allow a user to mask it via --cpu-cap=noxsaves option (valid for x86 only). Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
f3f4dda5f3
commit
d9f072d0f9
7 changed files with 50 additions and 0 deletions
|
|
@ -38,3 +38,8 @@ int cpuinfo_check(void)
|
|||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
int cpu_parse_option(const char *opt)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,3 +38,8 @@ int cpuinfo_check(void)
|
|||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
int cpu_parse_option(const char *opt)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,3 +140,8 @@ int cpuinfo_check(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cpu_parse_option(const char *opt)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,3 +156,8 @@ int cpuinfo_check(void)
|
|||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cpu_parse_option(const char *opt)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -416,3 +416,27 @@ int cpuinfo_check(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cpu_parse_option(const char *opt)
|
||||
{
|
||||
static struct {
|
||||
const char *name;
|
||||
unsigned int feature;
|
||||
} filters[] = {
|
||||
{
|
||||
.name = "noxsaves",
|
||||
.feature = X86_FEATURE_XSAVES,
|
||||
},
|
||||
};
|
||||
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(filters); i++) {
|
||||
if (strncmp(opt, filters[i].name, strlen(filters[i].name)))
|
||||
continue;
|
||||
compel_cpu_clear_feature(filters[i].feature);
|
||||
return strlen(filters[i].name);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,11 @@ static int parse_cpu_cap(struct cr_options *opts, const char *optarg)
|
|||
} else if (!strncmp(optarg, "ins", 3)) {
|
||||
____cpu_set_cap(opts, CPU_CAP_INS, inverse);
|
||||
optarg += 3;
|
||||
} else if (!strncmp(optarg, "op=", 3)) {
|
||||
int pos = cpu_parse_option(&optarg[3]);
|
||||
if (pos <= 0)
|
||||
goto Esyntax;
|
||||
optarg += pos + 3;
|
||||
} else
|
||||
goto Esyntax;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@ extern int cpu_dump_cpuinfo(void);
|
|||
extern int cpu_validate_cpuinfo(void);
|
||||
extern int cpuinfo_dump(void);
|
||||
extern int cpuinfo_check(void);
|
||||
extern int cpu_parse_option(const char *opt);
|
||||
|
||||
#endif /* __CR_CPU_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue