On 21/05/2016 01:40, Stefan Hajnoczi wrote: > while (req) { > qemu_put_sbyte(f, 1);
Could you just put an extra 32-bit queue id here if num_queues > 1? A guest with num_queues > 1 cannot be started on pre-2.7 QEMU, so you can change the migration format (if virtio were using vmstate, it would be a VMSTATE_UINT32_TEST). Thanks, Paolo > qemu_put_virtqueue_element(f, &req->elem); > req = req->next; > + s->num_rq++; > } > qemu_put_sbyte(f, 0); > + > + /* In order to distinguish virtio-blk subsections from the generic virtio > + * device subsections that follow we emit a terminating byte. Old > versions > + * of QEMU don't expect the terminating byte so, for compatibility, only > + * write it when virtio-blk subsections are needed. > + */ > + if (virtio_blk_mq_rq_indices_needed(s)) { > + uint32_t i; > + > + s->mq_rq_indices = g_new(uint32_t, s->num_rq); > + req = s->rq; > + for (i = 0; i < s->num_rq; i++) { > + s->mq_rq_indices[i] = virtio_get_queue_index(req->vq); > + req = req->next; > + } > + > + vmstate_save_state(f, &virtio_blk_vmstate, s, NULL); > + qemu_put_ubyte(f, ~QEMU_VM_SUBSECTION); > + > + g_free(s->mq_rq_indices); > + s->mq_rq_indices = NULL;