|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH for-4.16 4/4] tools/python: fix python libxc bindings to pass a max grant version
On Mon, Nov 15, 2021 at 01:17:41PM +0100, Roger Pau Monne wrote:
> Such max version should be provided by the caller, otherwise the
> bindings will default to specifying a max version of 2, which is
> inline with the current defaults in the hypervisor.
>
> Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain')
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Acked-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
> ---
> Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>
>
> Without this fix the python bindings won't be usable, as they will
> attempt to pass a max version of 0 which will be refused by the
> hypervisor. The main risk would be breaking the bindings, but given
> the current state it's unlikely to result in a worse outcome.
> ---
> tools/python/xen/lowlevel/xc/xc.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/tools/python/xen/lowlevel/xc/xc.c
> b/tools/python/xen/lowlevel/xc/xc.c
> index 6293d205a3..fd00861032 100644
> --- a/tools/python/xen/lowlevel/xc/xc.c
> +++ b/tools/python/xen/lowlevel/xc/xc.c
> @@ -116,7 +116,7 @@ static PyObject *pyxc_domain_create(XcObject *self,
> PyObject *args,
> PyObject *kwds)
> {
> - uint32_t dom = 0, target = 0;
> + uint32_t dom = 0, target = 0, max_grant_version = 2;
> int ret;
> size_t i;
> PyObject *pyhandle = NULL;
> @@ -132,12 +132,13 @@ static PyObject *pyxc_domain_create(XcObject *self,
> };
>
> static char *kwd_list[] = { "domid", "ssidref", "handle", "flags",
> - "target", "max_vcpus", NULL };
> + "target", "max_vcpus", "max_grant_version",
> + NULL };
>
> - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiii", kwd_list,
> + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiiii", kwd_list,
> &dom, &config.ssidref, &pyhandle,
> &config.flags, &target,
> - &config.max_vcpus) )
> + &config.max_vcpus, &max_grant_version)
> )
> return NULL;
> if ( pyhandle != NULL )
> {
> @@ -162,6 +163,7 @@ static PyObject *pyxc_domain_create(XcObject *self,
> #else
> #error Architecture not supported
> #endif
> + config.grant_opts = XEN_DOMCTL_GRANT_version(max_grant_version);
>
> if ( (ret = xc_domain_create(self->xc_handle, &dom, &config)) < 0 )
> return pyxc_error_to_exception(self->xc_handle);
> --
> 2.33.0
>
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
Attachment:
signature.asc
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |