[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-discuss] How to use the in-qemu API for virtio serial device

From: wukunhenggo
Subject: [Qemu-discuss] How to use the in-qemu API for virtio serial device
Date: Tue, 26 Jul 2016 11:30:52 +0800

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: 

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!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]