how to create threads like dataplane in qemu
Hello!
I want to create a specific thread for each process in VM so that virtio block requests from each process can be sumbitted in the thread related to the process. I tried to implement it by referring to dataplane,but I can not understand the source about dataplane.
What should I do?
I am not good at English.Please forgive me.
Best wishes
Zhiheng Tao
Quoted 3 lines · PERSIST
Hello!
I want to create a specific thread for each process in VM so that virtio block requests from each process can be sumbitted in the thread related to the process. I tried to implement it by referring to dataplane,but I can not understand the source about dataplane.
There are multiple abstraction layers between guest process and QEMU threads, I don't think the model you describe is practical. In dataplane, requests are submitted to host through virtio ioeventfd, and handled by the per-virtual device thread. What are you trying to achieve here?
Fam
Quoted 3 lines · PERSIST
I want to create a specific thread for each process in VM so that virtio block requests from each process can be sumbitted in the thread related to the process. I tried to implement it by referring to dataplane,but I can not understand the source about dataplane.
What should I do?
It sounds like QEMU can already do what you want:
1. Define -object iothread for each guest process that needs a dedicated dataplane thread.
2. Define -device virtio-blk-pci,iothread=iothread for each block device. It wasn't clear from your email but I'm assuming here that every guest process operates on its own disk image file. QEMU does not support true multiqueue disk I/O to a single image file yet.
You should also bind the iothreads to host logical CPUs, bind vcpu threads to host logical CPUs, and bind the guest processes to vcpus. That way each guest process has a dedicated host CPU and iothread.
Stefan