[Spice-devel] [PATCH spice-server v2 2/2] stream-device: Implements properly device reset on open/close

Frediano Ziglio fziglio at redhat.com
Thu Jan 11 12:01:32 UTC 2018


> 
> On Thu, Dec 07, 2017 at 08:47:39AM +0000, Frediano Ziglio wrote:
> > Due to the way Qemu handle the device we must consume all pending
> > data inside the callback to read data from the device.
> 
> Any idea if QEMU can be fixed to do the right thing? We'll still need
> some kind of workaround to deal with older QEMUs, but might be nicer
> if newer QEMUs don't have this limitation. It was not clear to me if the

Didn't think much about but seems not easy to do.
Basically the buffer to read is available only when Qemu calls
spice_server_char_device_wakeup from spice_chr_write

> limitation comes from chardev/spice.c or from a more generic QEMU layer.
> I would say "inside the stream_device_read_msg_from_dev() callback"
> rather than "inside the callback to read data from the device"
> 
> > We need to consume all data from previous device dialog to avoid
> 
> s/dialog/communication maybe?
> 
> > that next device usage is still seeing old data.
> 
> > This as Qemu return 0 if you call SpiceCharDeviceInterface::read
> > outside this callback (which is called by Qemu using
> > spice_server_char_device_wakeup).
> 
> "This needs to be done within this callback, as QEMU returns 0 if you
> call SpiceCharDeviceInterface::read() outside of it"? "QEMU invokes this
> callback through a call to spice_server_char_device_wakeup"
> 
> > Also to communicate the error and avoiding to have to read any data the
> > guest want to write disable the device.
> 
> I'm not sure what you mean here.
> 
> Christophe
> 

Frediano


More information about the Spice-devel mailing list