Hello,
I want to exchange "complex" data between the guest and the host in KVM+QEMU.
My idea was to use the virtio-serial to do so. In guest side, qemu provide some simple and useful function such as open(), read() and write. In host side, my application can also utilize same function like operating socket file to complete communication with guests. But I discover some in-qemu host API, which is decribed here:
http://www.linux-kvm.org/page/Virtio-serial_API
My question is how to use in-qemu host API and compile my code to a program like virtio-console.
The reason why I want to use in-qemu API is when I write data to virtio-serial socket file in host frequently, guest read the
responsed char-port, some times, will wait long time.
For examle, the application in guest writes 24KB data to char-port and then reads 720 byte data from same char-port. The behavior repeats 1000 times, each time interval 100us. The application in host use epoll function to listen the responsed socket file. When guest data reaches host, host read all data and will write 720 byte data to the socket file for sending "ack" to guest.
The time between write and read in guest is not stable. Sometimes It is 160 us. Sometimes it is 10000 us.
The code in guest like:
for(1000):
gettimeofday(start, null);
write(char-port_fd, buff, buff_len);
read(char-port_fd, read_buff, buff_len);
gettimeofday(stop, null);
My host and guest OS are centos 7.0 in a Dell R720 server.
Can anyone help me? Thanks a lot!