On Mon, Jun 8, 2026 at 6:42 PM Markus Armbruster <[email protected]> wrote:
>
> Zhang Chen <[email protected]> writes:
>
> > On Wed, Jun 3, 2026 at 1:20 AM Markus Armbruster <[email protected]> wrote:
> >>
> >> Zhang Chen <[email protected]> writes:
> >>
> >> > Based on monitor ID tracking iothread users with holder.
> >> > Introduce the AioContext in the Monitor struct to avoid repeated calls to
> >> > iothread_get_aio_context()
> >>
> >> iothread_get_aio_context(iothread) returns iothread->ctx.  I doubt
> >> avoiding the call is worth the complexity yet another variable adds.
> >>
> >> >                            and ensure symmetrical ref/unref during
> >> > monitor lifecycle.
> >>
> >> What do you mean by that?
> >
> > As we discussed with Stefan before, the iothread_ref/unref need to
> > call in pairs, for example the virtio-blk. But the monitor implementation
> > is special, it have the monitor_suspend/resume with iothread.
> > So I try to introduce the mon->ctx to simplify it.
>
> I appreciate your attempt to simplify things.  I'm having difficulties
> seeing what exactly becomes simpler.  This is likely me being dense.
> Can you explain it to me real slow, perhaps with examples?

In the original design, a module (QOM object/monitor/block node) call
the iothread_ref() means it will use the iothread to do some jobs.
And will call the iothread_unref() when a module does not touch the iothread.
For example the virtio-blk in this series [PATCH V8 09/15].

For the monitor, the monitor_suspend/resume just want to get the context,
It's not an action of never touching the iothread or ctx.
But would it be more appropriate to change it to
'iothread_unsafe_get_aio_context()'
for the monitor_suspend/resume?

Thanks
Chen


>
> [...]
>

Reply via email to