qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 29/30] trace: Fix parameter types in hw/virti


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2 29/30] trace: Fix parameter types in hw/virtio
Date: Thu, 16 Mar 2017 15:45:56 +0800
User-agent: Mutt/1.7.1 (2016-10-04)

On Mon, Mar 13, 2017 at 02:55:46PM -0500, Eric Blake wrote:
> An upcoming patch will let the compiler warn us when we are silently
> losing precision in traces; update the trace definitions to pass
> through the full value at the callsite.
> 
> Signed-off-by: Eric Blake <address@hidden>
> ---
>  hw/virtio/trace-events | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
> index 6926eed..7b3743d 100644
> --- a/hw/virtio/trace-events
> +++ b/hw/virtio/trace-events
> @@ -4,7 +4,7 @@
>  virtqueue_fill(void *vq, const void *elem, unsigned int len, unsigned int 
> idx) "vq %p elem %p len %u idx %u"
>  virtqueue_flush(void *vq, unsigned int count) "vq %p count %u"
>  virtqueue_pop(void *vq, void *elem, unsigned int in_num, unsigned int 
> out_num) "vq %p elem %p in_num %u out_num %u"
> -virtio_queue_notify(void *vdev, int n, void *vq) "vdev %p n %d vq %p"
> +virtio_queue_notify(void *vdev, ptrdiff_t n, void *vq) "vdev %p n %td vq %p"

I'm not sure about this change.  Logically the virtqueue number, n, is
not a ptrdiff_t.  The type for n is always int in
include/hw/virtio/virtio.h and it should be the same for the trace
event.

It just happens to be that the caller calculates it using pointer
subtraction.  The trace event shouldn't reflect this.  One day the
caller might change the calculation and it would then be necessary to
change the type of the trace event.

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]