* Does. there exists race condition in virtio-gpu device
@ 2020-09-09 12:49 Li Qiang
2020-09-14 7:42 ` Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Li Qiang @ 2020-09-09 12:49 UTC (permalink / raw)
To: Paolo Bonzini, Gerd Hoffmann; +Cc: Qemu Developers
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?
Thanks,
Li Qiang
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Does. there exists race condition in virtio-gpu device
2020-09-09 12:49 Does. there exists race condition in virtio-gpu device Li Qiang
@ 2020-09-14 7:42 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2020-09-14 7:42 UTC (permalink / raw)
To: Li Qiang; +Cc: Paolo Bonzini, Qemu Developers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-14 7:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-09 12:49 Does. there exists race condition in virtio-gpu device Li Qiang
2020-09-14 7:42 ` Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).