[CRIU] [PATCH 2/9] opt: cpu-cap -- Introduce "none" and "cpuinfo" arguments
Pavel Emelyanov
xemul at parallels.com
Tue Sep 30 03:02:50 PDT 2014
On 09/25/2014 05:03 PM, Cyrill Gorcunov wrote:
> They will serve to choose capability level when migrating
> images between various hardware nodes.
>
> Note it's bare functionality introduced in this commit,
> the real implementation is in next patches.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> crtools.c | 10 +++++++---
> include/cr_options.h | 5 ++++-
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/crtools.c b/crtools.c
> index b5f0a76ba866..1857f9f08246 100644
> --- a/crtools.c
> +++ b/crtools.c
> @@ -114,8 +114,12 @@ static int parse_cpu_cap(struct cr_options *opts, const char *optarg)
>
> if (!strncmp(optarg, "fpu", 3))
> ____cpu_set_cap(opts, CPU_CAP_FPU, inverse);
> - if (!strncmp(optarg, "all", 3))
> + else if (!strncmp(optarg, "all", 3))
> ____cpu_set_cap(opts, CPU_CAP_ALL, inverse);
> + else if (!strncmp(optarg, "none", 3))
> + ____cpu_set_cap(opts, CPU_CAP_NONE, inverse);
> + else if (!strncmp(optarg, "cpuinfo", 3))
> + ____cpu_set_cap(opts, CPU_CAP_CPUINFO, inverse);
> else
> goto Esyntax;
> }
> @@ -561,8 +565,8 @@ usage:
> " --pidfile FILE write root task, service or page-server pid to FILE\n"
> " -W|--work-dir DIR directory to cd and write logs/pidfiles/stats to\n"
> " (if not specified, value of --images-dir is used)\n"
> -" --cpu-cap CAP require certain cpu capability. CAP: may be one of:\n"
> -" 'fpu','all'. To disable capability, prefix it with '^'.\n"
> +" --cpu-cap [CAP] require certain cpu capability. CAP: may be one of:\n"
> +" 'cpuinfo','fpu','all','none'. To disable capability, prefix it with '^'.\n"
What's the point in none? Does it differ from "no option"?
I don't like the "cpuinfo" name. Maybe just "cpu" or at least "cpuid"?
Can we make it somehow symmetrical to "fpu" one?
> " --exec-cmd execute the command specified after '--' on successful\n"
> " restore making it the parent of the restored process\n"
> "\n"
> diff --git a/include/cr_options.h b/include/cr_options.h
> index 5a7edd9263db..96f74af7f250 100644
> --- a/include/cr_options.h
> +++ b/include/cr_options.h
> @@ -8,8 +8,11 @@
> /*
> * CPU capability options.
> */
> -#define CPU_CAP_FPU (1u)
> +#define CPU_CAP_NONE (0u)
> #define CPU_CAP_ALL (-1u)
> +#define CPU_CAP_FPU (1u) /* Only FPU capability required */
> +#define CPU_CAP_CPUINFO (2u) /* CPU capability required */
> +#define CPU_CAP_DEFAULT (CPU_CAP_FPU)
>
> struct cg_root_opt {
> struct list_head node;
>
More information about the CRIU
mailing list