All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wl@xen.org>,
	Ian Jackson <iwj@xenproject.org>
Subject: Re: [PATCH for-4.16 4/4] tools/python: fix python libxc bindings to pass a max grant version
Date: Wed, 17 Nov 2021 12:39:12 +0100	[thread overview]
Message-ID: <YZTp4Oi1EDEyk0Jd@mail-itl> (raw)
In-Reply-To: <20211115121741.3719-5-roger.pau@citrix.com>

[-- Attachment #1: Type: text/plain, Size: 2800 bytes --]

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@citrix.com>

Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

> ---
> Cc: Ian Jackson <iwj@xenproject.org>
> 
> 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2021-11-17 11:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 12:17 [PATCH for-4.16 0/4] gnttab: fallout/improvements from max version Roger Pau Monne
2021-11-15 12:17 ` [PATCH for-4.16 1/4] domctl: introduce a macro to set the grant table " Roger Pau Monne
2021-11-15 12:20   ` Jan Beulich
2021-11-15 12:26   ` Andrew Cooper
2021-11-15 13:23   ` Bertrand Marquis
2021-11-15 13:58   ` Julien Grall
2021-11-16 17:14     ` Ian Jackson
2021-11-15 12:17 ` [PATCH for-4.16 2/4] tests/resource: set grant version for created domains Roger Pau Monne
2021-11-15 12:21   ` Jan Beulich
2021-11-15 12:27   ` Andrew Cooper
2021-11-15 12:17 ` [PATCH for-4.16 3/4] test/tsx: " Roger Pau Monne
2021-11-15 12:21   ` Jan Beulich
2021-11-15 12:43   ` Andrew Cooper
2021-11-15 13:58     ` Roger Pau Monné
2021-11-15 14:01       ` Andrew Cooper
2021-11-16 17:15   ` Ian Jackson
2021-11-15 12:17 ` [PATCH for-4.16 4/4] tools/python: fix python libxc bindings to pass a max grant version Roger Pau Monne
2021-11-15 12:44   ` Andrew Cooper
2021-11-17 11:16     ` Ian Jackson
2021-11-16 17:12   ` Ian Jackson
2021-11-17 11:39   ` Marek Marczykowski-Górecki [this message]
2021-11-17  7:18 ` [PATCH for-4.16 0/4] gnttab: fallout/improvements from max version Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZTp4Oi1EDEyk0Jd@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=iwj@xenproject.org \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.