Re: [PATCH v13 00/13] Introduce VDUSE - vDPA Device in Userspace

Yongji Xie
2021-10-11T08:31:21Z

Hi Xiaodong,

On Mon, Oct 11, 2021 at 3:32 PM Liuxiangdong <liuxiangdong5@huawei.com> wrote:
>
> Hi, Yongji.
>
> I tried vduse with null-blk:
>
> $ qemu-storage-daemon \
> --chardev socket,id=charmonitor,path=/tmp/qmp.sock,server,nowait \
> --monitor chardev=charmonitor \
> --blockdev
> driver=host_device,cache.direct=on,aio=native,filename=/dev/nullb0,node-name=disk0
> \
> --export
> type=vduse-blk,id=test,node-name=disk0,writable=on,name=vduse-null,num-queues=16,queue-size=128
>
> The qemu-storage-daemon is yours
> (https://github.com/bytedance/qemu/tree/vduse)
>
> And then, how can we use this vduse-null (dev/vduse/vduse-null) in vm(QEMU)?
>

Then we need to attach this device to vdpa bus via vdpa tool [1]:

# vdpa dev add vduse-null mgmtdev vduse

With the virtio-vdpa module loaded, we will see the block device in host.

And if we'd like to use it in a VM, we need to load the vhost-vdpa
module (a /dev/vhost-vdpa-0 char device will be presented) and build a
new qemu binary with the source code in
https://github.com/bytedance/qemu/tree/vhost-vdpa-blk. Then we can use
the below command line to start a VM with the vhost-vdpa-blk device:

./qemu-system-x86_64 -M pc -cpu host --enable-kvm -smp 8 \
-m 4G -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \
-numa node,memdev=mem -monitor vc -serial stdio -no-user-config -nodefaults \
-vnc 0.0.0.0:1 -k en-us -vga cirrus \
-device vhost-vdpa-blk-pci,num-queues=1,vdpa-dev=/dev/vhost-vdpa-0

[1] https://man7.org/linux/man-pages/man8/vdpa-dev.8.html

Thanks,
Yongji