Message ID | 20210831103634.33-1-xieyongji@bytedance.com (mailing list archive) |
---|---|
Headers | show |
Series | Introduce VDUSE - vDPA Device in Userspace | expand |
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)? Because qemu-storage-daemon open this vduse-null in vduse_dev_init(), all the operations which open this dev will report "failed to open '/dev/vduse/vduse-null': Device or resource busy". Or something I understood wrong? Thanks! Xiangdong Liu
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
On Mon, Oct 11, 2021 at 4:31 PM Yongji Xie <xieyongji@bytedance.com> wrote: > > 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 > It should be: # vdpa dev add name vduse-null mgmtdev vduse Thanks, Yongji