VirtIO
目录
1 总体介绍
KVM虚拟化CPU和内存,QEMU虚拟化IO。
- Virtio提供一个或多个Queue,GuestOS把IO保存到Queue中;
- 通知后端处理;
优化:
- IO host处理从Qemu旁路;
- Poll替代notify;
2 IO Stack
2.1 存算分离全链路
- VM发送IO到Virtio-Queue;
- VM通过notify机制通知后端驱动处理IO;
- Qemu从VirtIO-Queue取出数据,放入qemu处理线程池;
- Qemu发送IO到分布式客户端,等待完成;
- Qemu通知VM IO完成;
- 分布式客户端处理后端交互;
2.2 Guest OS IO Stack for virtio-blk
submit_bio(); generic_make_request(); queue->queue_rq(); // -> virtio_queue_rq virtio_queue_rq(); vq_kick(); virtqueue_notify(); vp_notify();
2.3 Guest OS IO Stack Vhost-user
- VM填充IO,写入Shmring;
- 分布式存储客户端Polling查询IO;
- 分布式存储客户端完成IO后,通过EventFd注入中断;
3 Virtio-Blk
4 Virtio-Net
5 Virtio-PCI
6 Virtio-Ballon
7 Virtio-Console
8 Some infomation
8.1 Vring - Virtio ring
- desc;
- avail;
- used;
9 References
- Direct-Virtio: A New Direct Virtualized I/O Framework for NVMe SSDs
- https://www.mdpi.com/2079-9292/10/17/2058
- IO虚拟化 VirtIO原理
- https://blog.csdn.net/tony_vip/article/details/104286588
- Virtualized I/O with Vhost-user
- https://spdk.io/doc/vhost_processing.html
- Virtio-scsi
- https://www.ovirt.org/develop/release-management/features/storage/virtio-scsi.html
- Virtio packed ring
- https://lwn.net/Articles/752745/
- Packed VirtQueue
- https://www.redhat.com/en/blog/packed-virtqueue-how-reduce-overhead-virtio
- Virtqueues and virtio ring: How the data travels
- https://www.redhat.com/en/blog/virtqueues-and-virtio-ring-how-data-travels