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

Re: [PATCH] libxl: virtio: Fix build error for 32-bit platforms


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Thu, 15 Dec 2022 16:58:02 +0000
  • Accept-language: en-GB, en-US
  • 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=pyhhzk8aj6uQ3VB68cCpZYeKbw5Rn4Mz23RFoIF7kuM=; b=BN1WhyW4qR5K8y6dTucMxsSABU+g6uG6sqPCTSeKrJGCbvoKpcrqYk4yVT/d0qq2X7+ECBodEUxLvAkRZ8d56Rd212cam/ElSIPL1WYTCBxPUWT4fZxH9o4NvVmiZcTBxfIMFJRN+uXqOhEeetw9EylgqsFQESBp83rcNPNHVTrBjfI0QxtIHgFy1cAhopQHXAWqp2yUja517cKYgMWAHAOAw7yLRrGqMlQlUTrp9InmW5uPCFNG2rXllqzUXRe7KogU0tM+r9rUSJsDHt1szSfYyDrB4z+1iVvjzgijO2LbGP/QXDIP1dagsldrRwCHO3xKkd60XAr0EuxYW66BOQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AulIUiiV1OzS5ATBb+bJITFbrplPbbzM0ENQsZ7fTCM505HuSY6G3u+aJTimABysgMC5W9XRD4X/KqF2ZNI4ByTlBy3eOl/fcbm46Q15xak+2SPm4xjV8K2sxBY8A5ROs7gvK+gCU9ds9mThEL9Bm8gRJBIOAri9wmBTeeeq33YJRtmcA3NK6wdr5O/ecQPEYRzB/0RD6etWNcRS6emH0ynvq8/MEhx2ztRL6I8ppYl2DDXS32Kh6NR9Kgqu9i0jrCp6LaMIOGSwmhZ+JhAt372OA7UZtsxeWVFQannwSMuH+UsefMYdz2Ia8/fqtdKDiFrthafb4aQMtDWErpNnsQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, "osstest-admin@xxxxxxxxxxxxxx" <osstest-admin@xxxxxxxxxxxxxx>, Vincent Guittot <vincent.guittot@xxxxxxxxxx>, "stratos-dev@xxxxxxxxxxxxxxxxxxx" <stratos-dev@xxxxxxxxxxxxxxxxxxx>, Alex Bennée <alex.bennee@xxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>, Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>, Mike Holmes <mike.holmes@xxxxxxxxxx>, Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 15 Dec 2022 16:58:27 +0000
  • Ironport-data: A9a23:ISGCIq9WM1jFk7VpOXZYDrUDsH6TJUtcMsCJ2f8bNWPcYEJGY0x3y zEXCz2BMqmINGP1fNl/bIqz8E0EvZfQz9dhSwVlrS08E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKucYHsZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ire7kIx1BjOkGlA5AZnP6kW5AK2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk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p aw7tdO42PIQwVjUu2LQl0+G8TTrdzCk5zrJTYAGh4c8QGLyRel8qTzHRS01goXFxlP3bAh22 7YlBGR3NTQj9iLjjvnk0PD5ZVfn9XsjvNFGcy3k8AQbg7hjw65Db4RJYFr6FoOwd2H2RIPqp 3hsh0gN8N85zf6ZWeuuybg3AHmzXIH92Li4UXwuwqoneXJABYBT+ZRj4NQdRXUr2A6ustn7a 5N12WF87JKEBL7mjjn7dSgbWAgqqONmwturQcvtQ0XbWJeUs4mkWUnxjIjLH7UJlOz1GgleN Mec/00qswmPW9yVEqpwlWH8ObcI0jbIS32OHTqmvblogS+z0oJv3fwgvZv6ks9yA==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZEIm2pBLpcrFxWUiesl94gtQKma5u9s6AgAAXKACAAB2/AA==
  • Thread-topic: [PATCH] libxl: virtio: Fix build error for 32-bit platforms

On 15/12/2022 3:11 pm, Jan Beulich wrote:
> On 15.12.2022 14:48, Anthony PERARD wrote:
>> On Thu, Dec 15, 2022 at 07:01:40PM +0530, Viresh Kumar wrote:
>>> The field 'base' in 'struct libxl_device_virtio' is defined as uint64,
>>> while we are printing it with '%lu', which is 32bit only 32-bit
>>> platforms. And so generates a error like:
>>>
>>>   libxl_internal.h:4388:51: error: format '%lu' expects argument of type 
>>> 'long
>>>   unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned
>>>   int'} [-Werror=format=]
>>>
>>> Fix the same by using PRIx64 instead.
>>>
>>> Now that the base name is available in hexadecimal format, prefix it
>>> with '0x' as well, which strtoul() also depends upon since base passed
>>> is 0.
>>>
>>> Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device")
>>> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
>>> ---
>>> Couldn't test on 32-bit platforms yet, but works fine for 64 bit one.
>>>
>>>  tools/libs/light/libxl_virtio.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tools/libs/light/libxl_virtio.c 
>>> b/tools/libs/light/libxl_virtio.c
>>> index 6a38def2faf5..2217bda8a253 100644
>>> --- a/tools/libs/light/libxl_virtio.c
>>> +++ b/tools/libs/light/libxl_virtio.c
>>> @@ -45,12 +45,12 @@ static int libxl__set_xenstore_virtio(libxl__gc *gc, 
>>> uint32_t domid,
>>>      const char *transport = 
>>> libxl_virtio_transport_to_string(virtio->transport);
>>>  
>>>      flexarray_append_pair(back, "irq", GCSPRINTF("%u", virtio->irq));
>>> -    flexarray_append_pair(back, "base", GCSPRINTF("%lu", virtio->base));
>>> +    flexarray_append_pair(back, "base", GCSPRINTF("0x%"PRIx64, 
>>> virtio->base));
>> There is also PRIu64 that exist, which would be perfect to replace %u.
>> Could we use that instead?
>>
>> I'd rather not have to think about which base is used for numbers in
>> xenstore. I can't find any hexadecimal numbers in xenstore for a simple
>> guest at the moment, so probably best to avoid adding one. And using
>> hexadecimal isn't needed to fix the build.
> Otoh an address formatted in decimal is pretty unusable to any human
> (who might be inspecting xenstore for whatever reasons).

A consumer of xenstore has to cope with all bases anyway.  Anything that
doesn't is broken.

Keys ought to be expressed in the logical base for a human to read, and
hex for base is the right one in this case.

~Andrew

 


Rackspace

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