On Thu, Mar 12, 2026 at 02:31:32PM +0800, Zhang Chen wrote:
> On Thu, Mar 12, 2026 at 1:36 PM Stefan Hajnoczi <[email protected]> wrote:
> >
> > On Tue, Mar 10, 2026 at 06:15:16PM +0800, Zhang Chen wrote:
> > > On Mon, Mar 9, 2026 at 4:44 PM Stefan Hajnoczi <[email protected]> 
> > > wrote:
> > > >
> > > > On Thu, Mar 05, 2026 at 10:24:53PM +0800, Zhang Chen wrote:
> > > > > @@ -1434,11 +1436,17 @@ static void colo_compare_finalize(Object *obj)
> > > > >
> > > > >      qemu_bh_delete(s->event_bh);
> > > > >
> > > > > -    AioContext *ctx = iothread_get_aio_context(s->iothread);
> > > > > +    /*
> > > > > +     * Use the device's canonical path as the holder ID to track 
> > > > > IOThread
> > > > > +     * usage and ensure the AioContext remains valid during the 
> > > > > device's
> > > > > +     * lifecycle.
> > > > > +     */
> > > > > +    AioContext *ctx = iothread_get_aio_context(s->iothread, NULL);
> > > >
> > > > Should NULL be path?
> > > >
> > >
> > > Yes, here code in the finalize function need to waiting for the
> > > coroutine to complete processing
> > > Or do you have any other suggestion?
> >
> > I'm not sure I understand. My question was about:
> >
> >   AioContext *ctx = iothread_get_aio_context(s->iothread, NULL);
> >                                                           ^^^^
> >
> > NULL is passed as the argument but this function has a 'path' local
> > variable. The path variable should be passed instead of NULL.
> 
> Let me explain in detail.
> colo-compare have two real holders for the iothread,
> 1. colo_compare_timer_init.
> 2. worker_context for chardev handlers.
> 
> I try to make them use one pair of iothread_get/put.

I suggest storing the AioContext pointer in a new CompareState field in
colo_compare_iothread() and and then using it in colo_compare_finalize()
instead of calling iothread_get_aio_context(s->iothread, NULL).

Stefan

Attachment: signature.asc
Description: PGP signature

Reply via email to