static void virtio_balloon_set_status(VirtIODevice *vdev, uint8_t status) { VirtIOBalloon *s = VIRTIO_BALLOON(vdev); if (!s->stats_vq_elem && vdev->vm_running && (status & VIRTIO_CONFIG_S_DRIVER_OK) && virtqueue_rewind(s->svq, 1)) { /* poll stats queue for the element we have discarded when the VM * was stopped */ virtio_balloon_receive_stats(vdev, s->svq); } if (virtio_balloon_free_page_support(s)) { /* * The VM is woken up and the iothread was blocked, so signal it to * continue. */ if (vdev->vm_running && s->block_iothread) { qemu_mutex_lock(&s->free_page_lock); s->block_iothread = false; qemu_cond_signal(&s->free_page_cond); qemu_mutex_unlock(&s->free_page_lock); } /* The VM is stopped, block the iothread. */ if (!vdev->vm_running) { qemu_mutex_lock(&s->free_page_lock); s->block_iothread = true; qemu_mutex_unlock(&s->free_page_lock); } } }
static void virtio_balloon_set_status(VirtIODevice *vdev, uint8_t status) { VirtIOBalloon *s = VIRTIO_BALLOON(vdev); if (!s->stats_vq_elem && vdev->vm_running && (status & VIRTIO_CONFIG_S_DRIVER_OK) && virtqueue_rewind(s->svq, 1)) { /* poll stats queue for the element we have discarded when the VM * was stopped */ virtio_balloon_receive_stats(vdev, s->svq); } }