Re: [PATCH v2] virtio_balloon: prime stats vq after virtio_device_ready()
From: Michael S. Tsirkin
Date: Mon Jul 06 2026 - 05:29:51 EST
On Mon, Jul 06, 2026 at 10:38:18AM +0200, David Hildenbrand (Arm) wrote:
> >>> - virtqueue_kick(vb->stats_vq);
> >>> + disable_work(&vb->update_balloon_stats_work);
> >>
> >> That's to stop the stats queue triggering stats_request() I assume?
> >
> > Yes.
> >
> >> Is that
> >> valid before we actually added+kicked ourselves?
> >
> > Why not?
>
> I was wondering whether the spec would state something about that.
Sorry I do not get the question. Virtio API expects
callers to serialize calls for each VQ. So this just prevents the work
from running and accessing the VQ while probe calls add_buf/kick.
I'll add a comment explaining that.
But it has nothing to do with the spec.
> >
> >> Also, can't we simply handle that in stats_request(), just ignoring it there?
> >
> > Then we'd need to maintain a special flag and I dislike that.
>
> I was hoping that we could use the device-ready indication, but there would be a
> small race window indeed.
>
> --
> Cheers,
>
> David