Michael Tokarev <m...@tls.msk.ru> 于2020年9月3日周四 下午1:12写道: > > 02.09.2020 19:22, Li Qiang wrote: > .. > > @@ -809,6 +809,10 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g) > > { > > struct virtio_gpu_ctrl_command *cmd; > > > > + if (atomic_read(&g->in_io)) { > > + return; > > + } > > + atomic_set(&g->in_io, 1); > > Can't we race in these two instructions? Both > threads atomic_reads at the same time, both see zero, > and both are trying to set it to 1, no? > > Just asking really, b/c despite of the atomic_ prefix, > to me this look a bit unsafe..
Yes you're right. My patch is wrong. Here I try to address race condition and DMA to MMIO issue at the same time. I will first focus the DMA to MMIO issue in the revision patch. Thanks, Li Qiang > > Thanks, > > /mjt