[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH for-4.16 4/4] tools/python: fix python libxc bindings to pass a max grant version


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Mon, 15 Nov 2021 13:17:41 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=30IYql6s76qwSQS6YX21BegD/gb/wXVIVUlLhStCcWE=; b=Ek220kWO8lJN2txWil+hFVkVBVL2tNdDQXYZmoWVNBiKah3FlONOLB3CLBAvJZIJACHWdNKyhRnIXDa6XXhKf8BjTY2Hqa6wcuqWdnxrkmx8n22YY7yJH5yLELbs0THZyqne2JgjKmZNRzZwZMflENNUMqtchS/7bo1/aACO/cw/Ua0wLrcyC0YEl69X57UG3d5sI8t3lP8opxq0bTiB+RGrXUbUZCq9fL3qrVgPkoQXfoRP/xuvezFhJLzOTJ8k9g17haqQwt6GdWHFT6/OBx0lTV44ENPGnPNFXk6vKOURSzWLEJTJKGwEjUOV971tcJLBja5yUGAxouxRdRLIJw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNr14cNc7l8q/41wtRBEodLxq7lKcztucCRNXtBT9IZus0ivuS7RPnd4tY2Y9Y3qOfMdVnpT4Qng3w12R0NkB8Yz7elMCXaQds3gsIZ+nAOlemyMyUh6F89W2dGpfMsg/V8GXAPSQBgMBkAfXkR1uhq15LuLzFYl7Yt8hczSPWEjv/dh4A8ccqSLq0S3qS+gWLhBojSBtRHmrtJBIEhU5JmaPEJU0RKc6U1zdh0h9WOh8yTPzl8y4gPGGZ316UgoJKcZft4pRRwDyl0M+pe56PrlI2SR8nfGu5LJguZrfXlpea/avpRZ97nkcMTdm6m8UNcWTBPCcCr/wyBo1ZDhsQ==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 15 Nov 2021 12:18:46 +0000
  • Ironport-data: A9a23:tgNOpKuZeeX9+qEc/sWr5+FcZ+fnVKVZMUV32f8akzHdYApBsoF/q tZmKWGBOveJYTPyKItyaYm/80pV6pLUx9NgQQNq/H1mQnwR+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZQP0VOZigHtIQMsadUsxKbVIiGHhJZS5LwbZj29cx2IXhWmthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ NplhKyrFSoELPPwqOUTDBR2IS9BGZN89+qSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DJoQQt2sm1TjEJf0nXYrCU+PB4towMDIY258eQK+AP pRxhTxHak/bcjBWYBQtAZsvo8GOul7HTwUApwfAzUYwyzeKl1EguFT3C/LKfvSaSMMTmVyXz krH4GbREhwcLMaYyzeO7jSrnOCntTP2XsceGaO18tZugUaP3SoDBRsOT1y5rPKlzEmkVLp3L kUO/yM0oKsa9Uq1T8L8VRm1vH6FuBEHX9NaVeY97WmwJrH8uljDQDJeF3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DH6tmpN 1dmstFea3N5DpB/L7HCWCDer5KqrT3k9HL9JTjJjVWPHxXgslbnnZE422gYytLrWd9dP4E/M 323Ls4m9PsQwVbUu2LQl0+G8TTrdzCk5zrJTYAGh4c8QGLyRel8qTzHRS01goXF2on+8ZszU H11yjCoomzufCyzRHRk0fV8pRtgdPkjv9OHtaFhMQ5IijlziyoeINicbufuy1dmpDi1H8a1P 335zswNcV67H3cOkmzvBvWwgHllA0j7nfzoGXoyUfLkIjcfnYXGsBBjYVWfl/y8Ew7puxx16 pNwiawq4dXJQmoplW82/H4EzVR0makq3srluAey1ZFV5EFVbNXpYsDuGtIDZY7Gj7g4oxPKp guMCjl3ocVTbqmVQGdgoE2q+bcGkjbXy32DHTqg/blkAS/xxtCvgwlLM92pAZIyHtycegD2w 3+CNUcqFh5dL5hUUtMPpZyfSKJMB24ffu1ChPoHb3GLtBNB5ufke+83F0KjNvaD6DgiqFCwa j8bA==
  • Ironport-sdr: gY2jcILEfhyJ4L3xtYtkSc35EKoevNExjHqFOcl+VpFVroiFKNEPnGjs+bm/4nBQWsUasURAF3 9iF8fv6bz5oFFQ0LKh4/7kxEAKK8fgWDohisrUReZ5N0vZJFe5+F8dq+vxou0ufWEnOg5ZpVDO vxX3iRrUT3+c23pXWRHMfEF/6V9HKnpHutRbxcmkh1A3efLb7iL9madGNzY6ZfbVfoY2JlOvyU xQt0HsPTL3PWNMbAUT5Dh7VW26oW6S1q0spuLdFoNg7yI07YXDuBinELc887uL3tdOQ/t+0tCT yF/6HyETXTah1PObPqyYfl7g
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>
---
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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.