On Wed, Oct 28, 2026 at 4:11 AM Stefan Hajnoczi <[email protected]> wrote:
>
> On Fri, Oct 23, 2026 at 05:42:48PM +0800, Zhang Chen wrote:
> > On Fri, Oct 23, 2026 at 4:16 AM Stefan Hajnoczi <[email protected]> wrote:
> > >
> > > Please update docs/devel/multiple-iothreads.rst. It still refers to
> > > iothread_get_aio_context() instead of the new API.
> > >
> >
> > Hi Stefan,
> >
> > Thanks for pointing this out. Would it be okay to include the documentation
> > update as a separate patch in the next revision like this?
> >
> > diff --git a/docs/devel/multiple-iothreads.rst
> > b/docs/devel/multiple-iothreads.rst
> > index a6eb046267..c184222d71 100644
> > --- a/docs/devel/multiple-iothreads.rst
> > +++ b/docs/devel/multiple-iothreads.rst
> > @@ -88,11 +88,20 @@ argument, which is used to check for and prevent
> > re-entrancy problems. For
> >  BHs associated with devices, the reentrancy-guard is contained in the
> >  corresponding ``DeviceState`` and named ``mem_reentrancy_guard``.
> >
> > -The ``AioContext`` can be obtained from the ``IOThread`` using
> > -``iothread_get_aio_context()`` or for the main loop using
> > -``qemu_get_aio_context()``. Code that takes an ``AioContext`` argument
> > -works both in ``IOThread``\ s or the main loop, depending on which
> > ``AioContext``
> > -instance the caller passes in.
> > +The ``AioContext`` can be obtained from an ``IOThread`` using
> > +``iothread_ref_and_get_aio_context(iothread, holder)``, or from the main 
> > loop
> > +using ``qemu_get_aio_context()``. Code accepting an ``AioContext`` works 
> > with
> > +either event loop.
> > +
> > +The holder-aware get registers a holder and takes an IOThread reference.
>
> I suggest ``iothread_ref_and_get_aio_context()`` instead of "The
> holder-aware get" so it's clear which API you are referring to.

OK, I will update to V19.

Thanks
Chen

>
> > +After the caller has finished using the context, release the reference with
> > +``iothread_unref_and_put_aio_context()``, passing the same IOThread and an
> > +equivalent holder. Both calls require the BQL. No matching IOThread put is
> > +needed for the main loop's context.
> > +
> > +``iothread_unsafe_get_aio_context()`` neither registers a holder nor takes 
> > a
> > +reference. It is for legacy callers that ensure the IOThread's lifetime
> > +themselves; new code must use the holder-aware API.
>
> Yes, this looks good. Thanks!
>
> >
> >  How to synchronize with an ``IOThread``
> >  ---------------------------------------
> >
> >
> > When you have a chance, I'd also appreciate your review of the remaining
> > patches that don't yet have Reviewed-by tags.
>
> I will take a look!
>
> Stefan
>

Reply via email to