[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Does. there exists race condition in virtio-gpu device
From: |
Gerd Hoffmann |
Subject: |
Re: Does. there exists race condition in virtio-gpu device |
Date: |
Mon, 14 Sep 2020 09:42:20 +0200 |
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