On Wed, Sep 09, 2020 at 08:49:25PM +0800, Li Qiang wrote: > Hello Gerd and Paolo, > > I think there is a race condition in virtio-gpu device. > In 'virtio_gpu_reset' and 'virtio_gpu_process_cmdq' they both operate > on 'g->cmdq'. > > However the 'virtio_gpu_reset' is in vcpu thread and the > 'virtio_gpu_process_cmdq' is > in main thread through BH. > > So I think there is a race condition. But I don't find a pattern for > this kind of bug(BH and vcpu thread). I missed anything?
There is a global lock for that (vcpu threads grab it before calling io handlers), so devices typically don't have to worry about that kind of race patterns. HTH, Gerd