> On 17 May 2022, at 20:41, Andrew Cooper <andrew.coop...@citrix.com> wrote:
> 
> Sadly, cpupool IDs are chosen by the caller, not assigned sequentially, so
> this does need to have a full 32 bits of range.
> 
> Also leave a BUILD_BUG_ON() to catch more obvious ABI changes in the future.
> 
> Fixes: 92ea9c54fc81 ("arm/dom0less: assign dom0less guests to cpupools")
> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>

Thanks for the fix.


> ---
> CC: Christian Lindig <christian.lin...@citrix.com>
> CC: Edwin Török <edvin.to...@citrix.com>
> CC: Luca Fancellu <luca.fance...@arm.com>
> ---
> tools/ocaml/libs/xc/xenctrl.ml      | 1 +
> tools/ocaml/libs/xc/xenctrl.mli     | 1 +
> tools/ocaml/libs/xc/xenctrl_stubs.c | 8 +++++++-
> 3 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
> index 7503031d8f61..8eab6f60eb14 100644
> --- a/tools/ocaml/libs/xc/xenctrl.ml
> +++ b/tools/ocaml/libs/xc/xenctrl.ml
> @@ -85,6 +85,7 @@ type domctl_create_config =
>       max_grant_frames: int;
>       max_maptrack_frames: int;
>       max_grant_version: int;
> +     cpupool_id: int32;

What are the valid values for a CPU pool id, in particular what value should be 
passed here to get back the behaviour prior to these changes in Xen?
(i.e. would it be cpu pool id 0 or -1 if cpu pools aren't otherwise explicitly 
configured on the system)

Thanks,
--Edwin

>       arch: arch_domainconfig;
> }
> 
> diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
> index d1d9c9247afc..d3014a2708d8 100644
> --- a/tools/ocaml/libs/xc/xenctrl.mli
> +++ b/tools/ocaml/libs/xc/xenctrl.mli
> @@ -77,6 +77,7 @@ type domctl_create_config = {
>   max_grant_frames: int;
>   max_maptrack_frames: int;
>   max_grant_version: int;
> +  cpupool_id: int32;
>   arch: arch_domainconfig;
> }
> 
> diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
> b/tools/ocaml/libs/xc/xenctrl_stubs.c
> index 5b4fe72c8dec..513ee142d2a0 100644
> --- a/tools/ocaml/libs/xc/xenctrl_stubs.c
> +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
> @@ -189,7 +189,8 @@ CAMLprim value stub_xc_domain_create(value xch, value 
> wanted_domid, value config
> #define VAL_MAX_GRANT_FRAMES    Field(config, 6)
> #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7)
> #define VAL_MAX_GRANT_VERSION   Field(config, 8)
> -#define VAL_ARCH                Field(config, 9)
> +#define VAL_CPUPOOL_ID          Field(config, 9)
> +#define VAL_ARCH                Field(config, 10)
> 
>       uint32_t domid = Int_val(wanted_domid);
>       int result;
> @@ -201,6 +202,7 @@ CAMLprim value stub_xc_domain_create(value xch, value 
> wanted_domid, value config
>               .max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
>               .grant_opts =
>                   XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)),
> +             .cpupool_id = Int32_val(VAL_CPUPOOL_ID),
>       };
> 
>       domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE));
> @@ -225,6 +227,9 @@ CAMLprim value stub_xc_domain_create(value xch, value 
> wanted_domid, value config
>       case 1: /* X86 - emulation flags in the block */
> #if defined(__i386__) || defined(__x86_64__)
> 
> +             /* Quick & dirty check for ABI changes. */
> +             BUILD_BUG_ON(sizeof(cfg) != 64);
> +
>         /* Mnemonics for the named fields inside xen_x86_arch_domainconfig */
> #define VAL_EMUL_FLAGS          Field(arch_domconfig, 0)
> 
> @@ -254,6 +259,7 @@ CAMLprim value stub_xc_domain_create(value xch, value 
> wanted_domid, value config
>       }
> 
> #undef VAL_ARCH
> +#undef VAL_CPUPOOL_ID
> #undef VAL_MAX_GRANT_VERSION
> #undef VAL_MAX_MAPTRACK_FRAMES
> #undef VAL_MAX_GRANT_FRAMES
> -- 
> 2.11.0
> 

Reply via email to