Skip to contentSkip to conversation

fix virtio-related build breakages

PATCH Applied Michael Roth 5 participants 8 messages Jan 14, 2013 – Jan 15, 2013

lore
Share & tools
lore
#0 lore raw

cover fix virtio-related build breakages

Build fixes for recent virtio commits. See patches for details.

#1 lore raw

PATCH 1/2 virtio-pci: build for uninitialized return value in vq_vector_unmask

Fixes the following:

/home/mdroth/w/qemu2.git/hw/virtio-pci.c: In function ‘kvm_virtio_pci_vector_unmask’:
/home/mdroth/w/qemu2.git/hw/virtio-pci.c:673:12: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make: *** [hw/virtio-pci.o] Error 1
make: *** Waiting for unfinished jobs....

---
 hw/virtio-pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio-pci.c +1 -1
index 0b49739..0934246 100644
@@ -616,7 +616,7 @@ static int kvm_virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
     VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no);
     EventNotifier *n = virtio_queue_get_guest_notifier(vq);
     VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
-    int ret;
+    int ret = 0;
 
     if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) {
         ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg);
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 2/2 dataplane: fix build breakage on set_guest_notifiers()

In reply to Michael Roth

virtio_pci_set_guest_notifiers() now takes an additional argument to specify the number of virtqueues to assign a guest notifier for. This causes a build breakage for CONFIG_VIRTIO_BLK_DATA_PLANE builds:

/home/mdroth/w/qemu2.git/hw/dataplane/virtio-blk.c: In function ‘virtio_blk_data_plane_start’:
/home/mdroth/w/qemu2.git/hw/dataplane/virtio-blk.c:451:47: error: too few arguments to function ‘s->vdev->binding->set_guest_notifiers’ /home/mdroth/w/qemu2.git/hw/dataplane/virtio-blk.c: In function ‘virtio_blk_data_plane_stop’:
/home/mdroth/w/qemu2.git/hw/dataplane/virtio-blk.c:511:5: error: too few arguments to function ‘s->vdev->binding->set_guest_notifiers’ make[1]: *** [hw/dataplane/virtio-blk.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [subdir-x86_64-softmmu] Error 2

Fix this by passing 1 as the number of virtqueues to assign notifiers for.

---
 hw/dataplane/virtio-blk.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/dataplane/virtio-blk.c +2 -2
index 1f7346e..4b26faa 100644
@@ -447,7 +447,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
     event_poll_init(&s->event_poll);
 
     /* Set up guest notifier (irq) */
-    if (s->vdev->binding->set_guest_notifiers(s->vdev->binding_opaque,
+    if (s->vdev->binding->set_guest_notifiers(s->vdev->binding_opaque, 1,
                                               true) != 0) {
         fprintf(stderr, "virtio-blk failed to set guest notifier, "
                 "ensure -enable-kvm is set\n");
@@ -508,7 +508,7 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
     event_poll_cleanup(&s->event_poll);
 
     /* Clean up guest notifier (irq) */
-    s->vdev->binding->set_guest_notifiers(s->vdev->binding_opaque, false);
+    s->vdev->binding->set_guest_notifiers(s->vdev->binding_opaque, 1, false);
 
     vring_teardown(&s->vring);
 }
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] virtio-pci: build for uninitialized return value in vq_vector_unmask

In reply to Michael Roth
Quoted 11 lines · Michael Roth

Fixes the following:

/home/mdroth/w/qemu2.git/hw/virtio-pci.c: In function ‘kvm_virtio_pci_vector_unmask’:
/home/mdroth/w/qemu2.git/hw/virtio-pci.c:673:12: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make: *** [hw/virtio-pci.o] Error 1
make: *** Waiting for unfinished jobs....

Quoted 21 lines
---
 hw/virtio-pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio-pci.c +1 -1
index 0b49739..0934246 100644
@@ -616,7 +616,7 @@ static int kvm_virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
     VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no);
     EventNotifier *n = virtio_queue_get_guest_notifier(vq);
     VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
-    int ret;
+    int ret = 0;
 
     if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) {
         ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg);
Signature · 1 line
1.7.9.5
Signature · 1 line
Eduardo
#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] virtio-pci: build for uninitialized return value in vq_vector_unmask

In reply to Michael Roth
Quoted 11 lines · Michael Roth

Fixes the following:

/home/mdroth/w/qemu2.git/hw/virtio-pci.c: In function ‘kvm_virtio_pci_vector_unmask’:
/home/mdroth/w/qemu2.git/hw/virtio-pci.c:673:12: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make: *** [hw/virtio-pci.o] Error 1
make: *** Waiting for unfinished jobs....

Looks like I didn't have libaio-devel installed on my new development box :-/

Regards,

Anthony Liguori

Quoted 19 lines
---
 hw/virtio-pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio-pci.c +1 -1
index 0b49739..0934246 100644
@@ -616,7 +616,7 @@ static int kvm_virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
     VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no);
     EventNotifier *n = virtio_queue_get_guest_notifier(vq);
     VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
-    int ret;
+    int ret = 0;
 
     if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) {
         ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg);
Signature · 1 line
1.7.9.5
#4 lore raw

Re: [Qemu-devel] [PATCH 1/2] virtio-pci: build for uninitialized return value in vq_vector_unmask

Quoted 12 lines · Anthony Liguori
Quoted 10 lines · Michael Roth

Fixes the following:

/home/mdroth/w/qemu2.git/hw/virtio-pci.c: In function ‘kvm_virtio_pci_vector_unmask’:
/home/mdroth/w/qemu2.git/hw/virtio-pci.c:673:12: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make: *** [hw/virtio-pci.o] Error 1
make: *** Waiting for unfinished jobs....

Quoted 8 lines
Quoted 1 line

Looks like I didn't have libaio-devel installed on my new development box :-/

Regards,

Anthony Liguori

Me neither. And apparently neither does the buildbot.

Quoted 20 lines
Quoted 19 lines
---
 hw/virtio-pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio-pci.c +1 -1
index 0b49739..0934246 100644
@@ -616,7 +616,7 @@ static int kvm_virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
     VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no);
     EventNotifier *n = virtio_queue_get_guest_notifier(vq);
     VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
-    int ret;
+    int ret = 0;
 
     if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) {
         ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg);
Signature · 1 line
1.7.9.5
#6 lore raw

Re: [Qemu-devel] [PATCH 2/2] dataplane: fix build breakage on set_guest_notifiers()

In reply to Michael Roth
Quoted 16 lines · Michael Roth

virtio_pci_set_guest_notifiers() now takes an additional argument to specify the number of virtqueues to assign a guest notifier for. This causes a build breakage for CONFIG_VIRTIO_BLK_DATA_PLANE builds:

/home/mdroth/w/qemu2.git/hw/dataplane/virtio-blk.c: In function ‘virtio_blk_data_plane_start’:
/home/mdroth/w/qemu2.git/hw/dataplane/virtio-blk.c:451:47: error: too few arguments to function ‘s->vdev->binding->set_guest_notifiers’ /home/mdroth/w/qemu2.git/hw/dataplane/virtio-blk.c: In function ‘virtio_blk_data_plane_stop’:
/home/mdroth/w/qemu2.git/hw/dataplane/virtio-blk.c:511:5: error: too few arguments to function ‘s->vdev->binding->set_guest_notifiers’ make[1]: *** [hw/dataplane/virtio-blk.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [subdir-x86_64-softmmu] Error 2

Quoted 7 lines

Fix this by passing 1 as the number of virtqueues to assign notifiers for.

---
 hw/dataplane/virtio-blk.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks for the fix, Mike!

Stefan