On Wed, Jul 19, 2023 at 04:21:08PM -0700, Roman Kiryanov wrote: > Hi, > > I work in Android Studio Emulator and we use virtio-snd (implemented > ourselves) for audio output/input. According to the spec (1.2), the > device has one TX virtqueue for all output streams and one RX > virtqueue for all input streams. Each stream may and usually have more > than one period (I request 4 periods). > > Because virtqueues are shared between streams (if there are more than > one stream in the same direction), I cannot fetch vq messages when a > stream needs one. I fetch vq messages (and put them into my own buffer > to process them later) when the kernel puts them into a vq. I hope > this is correct. I think I tried processing them immediately (at least > for TX) but the kernel was not happy with this because I was draining > the buffer too fast causing XRUN. > > If a snapshot request comes when audio streams are active I may have > several unprocessed messages for several streams for both TX and RX. > In my case messages are VirtQueueElement* which I don't think can be > saved directly. > > Could you please advise what a device is expected to do in this case?
Do you mean QEMU's VirtQueueElement? There are devices in QEMU that save/load in-flight VirtQueueElements. See qemu_put_virtqueue_element(). Often devices quiesce (e.g. by draining in-flight I/O requests) when the VM is stopped before the device state is saved. That makes life simpler. Stefan > > Thank you. > > Regards, > Roman. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org > For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org >
signature.asc
Description: PGP signature