diff options
Diffstat (limited to 'virtio_loopback.c')
-rw-r--r-- | virtio_loopback.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/virtio_loopback.c b/virtio_loopback.c index e95c648..8b57589 100644 --- a/virtio_loopback.c +++ b/virtio_loopback.c @@ -1032,20 +1032,19 @@ void *loopback_event_select(void *_e) } if (retval > 0) { + if (pthread_mutex_lock(&interrupt_lock) != 0) { + printf("[ERROR] Locking failed\n"); + exit(1); + } DBG("\n\nEvent has come from the vhost-user-device " "(eventfd: %d) -> event_count: %d (select value: %d)\n\n", rfd, eventfd_count, retval); if (event_notifier_test_and_clear(e)) { - if (pthread_mutex_lock(&interrupt_lock) == 0) { - eventfd_count++; - virtio_irq(vq); - pthread_mutex_unlock(&interrupt_lock); - } else { - printf("[ERROR] Locking failed\n"); - exit(1); - } + eventfd_count++; + virtio_irq(vq); } + pthread_mutex_unlock(&interrupt_lock); } } } @@ -1460,7 +1459,6 @@ static uint64_t virtio_loopback_read(VirtIODevice *vdev, uint64_t offset, case VIRTIO_MMIO_MAGIC_VALUE: return VIRT_MAGIC; case VIRTIO_MMIO_VERSION: - DBG("VIRTIO_MMIO_VERSION ->\n"); if (proxy->legacy) { DBG("VIRTIO_MMIO_VERSION -> legacy\n"); return VIRT_VERSION_LEGACY; @@ -1602,8 +1600,6 @@ void virtio_loopback_write(VirtIODevice *vdev, uint64_t offset, case VIRTIO_MMIO_DRIVER_FEATURES: if (proxy->legacy) { if (proxy->guest_features_sel) { - DBG("attempt to write guest features with " - "guest_features_sel > 0 in legacy mode\n"); DBG("Set driver features: 0x%lx\n", value << 32); virtio_set_features(vdev, value << 32); } else { @@ -1691,7 +1687,7 @@ void virtio_loopback_write(VirtIODevice *vdev, uint64_t offset, /* TODO: To be implemented */ break; case VIRTIO_MMIO_QUEUE_NOTIFY: - DBG("VIRTIO_MMIO_QUEUE_NOTIFY: vq_index -> %d, notify_cnt: %d\n", + DBG("VIRTIO_MMIO_QUEUE_NOTIFY: vq_index -> %lu, notify_cnt: %d\n", value, notify_cnt++); if (value < VIRTIO_QUEUE_MAX) { virtio_queue_notify(vdev, value); |