[Qemu-devel] [PATCH v4 2/3] libvhost-user: fix -Werror=format= on ppc64

Marc-André Lureau posted 3 patches 6 years, 6 months ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>
[Qemu-devel] [PATCH v4 2/3] libvhost-user: fix -Werror=format= on ppc64
Posted by Marc-André Lureau 6 years, 6 months ago
That should fix the following warning:

/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c: In function
‘vu_set_mem_table_exec_postcopy’:
/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but
argument 5 has type ‘__u64’ [-Werror=format=]
         DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
         ^
/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but
argument 6 has type ‘__u64’ [-Werror=format=]
cc1: all warnings being treated as errors

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 contrib/libvhost-user/libvhost-user.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index 40443a3daa..ab85166b15 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -663,8 +663,10 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
                      __func__, i);
             return false;
         }
-        DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
-                __func__, i, reg_struct.range.start, reg_struct.range.len);
+        DPRINT("%s: region %d: Registered userfault for %"
+               PRIu64 " + %" PRIu64 "\n", __func__, i,
+               (uint64_t)reg_struct.range.start,
+               (uint64_t)reg_struct.range.len);
         /* Now it's registered we can let the client at it */
         if (mprotect((void *)(uintptr_t)dev_region->mmap_addr,
                      dev_region->size + dev_region->mmap_offset,
-- 
2.21.0.777.g83232e3864


Re: [Qemu-devel] [PATCH v4 2/3] libvhost-user: fix -Werror=format= on ppc64
Posted by Philippe Mathieu-Daudé 6 years, 5 months ago
Hi Marc-André,

On 5/14/19 12:41 PM, Marc-André Lureau wrote:
> That should fix the following warning:
> 
> /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c: In function
> ‘vu_set_mem_table_exec_postcopy’:
> /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
> format ‘%llx’ expects argument of type ‘long long unsigned int’, but
> argument 5 has type ‘__u64’ [-Werror=format=]
>          DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
>          ^
> /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
> format ‘%llx’ expects argument of type ‘long long unsigned int’, but
> argument 6 has type ‘__u64’ [-Werror=format=]
> cc1: all warnings being treated as errors
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  contrib/libvhost-user/libvhost-user.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> index 40443a3daa..ab85166b15 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -663,8 +663,10 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
>                       __func__, i);
>              return false;
>          }
> -        DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
> -                __func__, i, reg_struct.range.start, reg_struct.range.len);
> +        DPRINT("%s: region %d: Registered userfault for %"
> +               PRIu64 " + %" PRIu64 "\n", __func__, i,

I guess you want PRIx64 in both places here.

I'd put the '%' on the next line:

           DPRINT("%s: region %d: Registered userfault for "
                  "%" PRIx64 " + %" PRIx64 "\n", __func__, i,

Using PRIx64:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> +               (uint64_t)reg_struct.range.start,
> +               (uint64_t)reg_struct.range.len);
>          /* Now it's registered we can let the client at it */
>          if (mprotect((void *)(uintptr_t)dev_region->mmap_addr,
>                       dev_region->size + dev_region->mmap_offset,
> 

Re: [Qemu-devel] [PATCH v4 2/3] libvhost-user: fix -Werror=format= on ppc64
Posted by Marc-André Lureau 6 years, 5 months ago
Hi

On Tue, May 14, 2019 at 2:10 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> Hi Marc-André,
>
> On 5/14/19 12:41 PM, Marc-André Lureau wrote:
> > That should fix the following warning:
> >
> > /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c: In function
> > ‘vu_set_mem_table_exec_postcopy’:
> > /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
> > format ‘%llx’ expects argument of type ‘long long unsigned int’, but
> > argument 5 has type ‘__u64’ [-Werror=format=]
> >          DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
> >          ^
> > /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
> > format ‘%llx’ expects argument of type ‘long long unsigned int’, but
> > argument 6 has type ‘__u64’ [-Werror=format=]
> > cc1: all warnings being treated as errors
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  contrib/libvhost-user/libvhost-user.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> > index 40443a3daa..ab85166b15 100644
> > --- a/contrib/libvhost-user/libvhost-user.c
> > +++ b/contrib/libvhost-user/libvhost-user.c
> > @@ -663,8 +663,10 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
> >                       __func__, i);
> >              return false;
> >          }
> > -        DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
> > -                __func__, i, reg_struct.range.start, reg_struct.range.len);
> > +        DPRINT("%s: region %d: Registered userfault for %"
> > +               PRIu64 " + %" PRIu64 "\n", __func__, i,
>
> I guess you want PRIx64 in both places here.
>
> I'd put the '%' on the next line:
>
>            DPRINT("%s: region %d: Registered userfault for "
>                   "%" PRIx64 " + %" PRIx64 "\n", __func__, i,
>
> Using PRIx64:
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

indeed, thanks
Gerd, can you change it on commit?

-- 
Marc-André Lureau

Re: [Qemu-devel] [PATCH v4 2/3] libvhost-user: fix -Werror=format= on ppc64
Posted by Gerd Hoffmann 6 years, 5 months ago
On Tue, May 14, 2019 at 02:33:41PM +0200, Marc-André Lureau wrote:
> Hi
> 
> On Tue, May 14, 2019 at 2:10 PM Philippe Mathieu-Daudé
> <philmd@redhat.com> wrote:
> >
> > Hi Marc-André,
> >
> > On 5/14/19 12:41 PM, Marc-André Lureau wrote:
> > > That should fix the following warning:
> > >
> > > /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c: In function
> > > ‘vu_set_mem_table_exec_postcopy’:
> > > /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
> > > format ‘%llx’ expects argument of type ‘long long unsigned int’, but
> > > argument 5 has type ‘__u64’ [-Werror=format=]
> > >          DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
> > >          ^
> > > /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
> > > format ‘%llx’ expects argument of type ‘long long unsigned int’, but
> > > argument 6 has type ‘__u64’ [-Werror=format=]
> > > cc1: all warnings being treated as errors
> > >
> > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > > ---
> > >  contrib/libvhost-user/libvhost-user.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> > > index 40443a3daa..ab85166b15 100644
> > > --- a/contrib/libvhost-user/libvhost-user.c
> > > +++ b/contrib/libvhost-user/libvhost-user.c
> > > @@ -663,8 +663,10 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
> > >                       __func__, i);
> > >              return false;
> > >          }
> > > -        DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
> > > -                __func__, i, reg_struct.range.start, reg_struct.range.len);
> > > +        DPRINT("%s: region %d: Registered userfault for %"
> > > +               PRIu64 " + %" PRIu64 "\n", __func__, i,
> >
> > I guess you want PRIx64 in both places here.
> >
> > I'd put the '%' on the next line:
> >
> >            DPRINT("%s: region %d: Registered userfault for "
> >                   "%" PRIx64 " + %" PRIx64 "\n", __func__, i,
> >
> > Using PRIx64:
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> indeed, thanks
> Gerd, can you change it on commit?

Fixed & queued.

What is the status of the vhost-gpu series btw?
It doesn't apply cleanly (simliar to v3 of this series),
IIRC I've mentioned that a while back ...

cheers,
  Gerd


Re: [Qemu-devel] [PATCH v4 2/3] libvhost-user: fix -Werror=format= on ppc64
Posted by Marc-André Lureau 6 years, 5 months ago
Hi

On Wed, May 22, 2019 at 7:23 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Tue, May 14, 2019 at 02:33:41PM +0200, Marc-André Lureau wrote:
> > Hi
> >
> > On Tue, May 14, 2019 at 2:10 PM Philippe Mathieu-Daudé
> > <philmd@redhat.com> wrote:
> > >
> > > Hi Marc-André,
> > >
> > > On 5/14/19 12:41 PM, Marc-André Lureau wrote:
> > > > That should fix the following warning:
> > > >
> > > > /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c: In function
> > > > ‘vu_set_mem_table_exec_postcopy’:
> > > > /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
> > > > format ‘%llx’ expects argument of type ‘long long unsigned int’, but
> > > > argument 5 has type ‘__u64’ [-Werror=format=]
> > > >          DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
> > > >          ^
> > > > /home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:666:9: error:
> > > > format ‘%llx’ expects argument of type ‘long long unsigned int’, but
> > > > argument 6 has type ‘__u64’ [-Werror=format=]
> > > > cc1: all warnings being treated as errors
> > > >
> > > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > > > ---
> > > >  contrib/libvhost-user/libvhost-user.c | 6 ++++--
> > > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> > > > index 40443a3daa..ab85166b15 100644
> > > > --- a/contrib/libvhost-user/libvhost-user.c
> > > > +++ b/contrib/libvhost-user/libvhost-user.c
> > > > @@ -663,8 +663,10 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
> > > >                       __func__, i);
> > > >              return false;
> > > >          }
> > > > -        DPRINT("%s: region %d: Registered userfault for %llx + %llx\n",
> > > > -                __func__, i, reg_struct.range.start, reg_struct.range.len);
> > > > +        DPRINT("%s: region %d: Registered userfault for %"
> > > > +               PRIu64 " + %" PRIu64 "\n", __func__, i,
> > >
> > > I guess you want PRIx64 in both places here.
> > >
> > > I'd put the '%' on the next line:
> > >
> > >            DPRINT("%s: region %d: Registered userfault for "
> > >                   "%" PRIx64 " + %" PRIx64 "\n", __func__, i,
> > >
> > > Using PRIx64:
> > > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> >
> > indeed, thanks
> > Gerd, can you change it on commit?
>
> Fixed & queued.
>
> What is the status of the vhost-gpu series btw?
> It doesn't apply cleanly (simliar to v3 of this series),
> IIRC I've mentioned that a while back ...

I thought I replied to you. It is strange, because the last series I
sent did apply succesfully in patchew:
https://patchew.org/QEMU/20190513184433.21038-1-marcandre.lureau@redhat.com/

It didn't change much since then, I updated the doc to mention the
pixman format of bitmaps, and fixed some conflicts on rebase:
https://github.com/elmarco/qemu/tree/vhost-user-gpu

I'll resend once the input series is merged, unless you have more
comments to make on v7.

thanks!

-- 
Marc-André Lureau