Re: [RESEND PATCH V10 06/15] monitor: Update tracking iothread users with holder
Zhang Chen <[email protected]> Thu, 6 Aug 2026 09:58:43 +0800
| Newsgroups | gmane.comp.emulators.qemu |
|---|---|
| Message-ID | <CAK3tnvKp3E3t94tbO4Jcxqq9m0TL1cwd_h333g9SzLjmqktUJA@mail.gmail.com> |
On Mon, Aug 3, 2026 at 12:39 PM Markus Armbruster <[email protected]> wrote: > > Zhang Chen <[email protected]> writes: > > > On Fri, Jul 31, 2026, 3:23 PM Markus Armbruster <[email protected]> wrote: > > > >> Zhang Chen <[email protected]> writes: > >> > >> > On Tue, Jul 21, 2026 at 8:33 PM Markus Armbruster <[email protected]> > >> wrote: > >> >> > >> >> Zhang Chen <[email protected]> writes: > >> >> > >> >> > Based on monitor QOM path tracking iothread users with holder. > >> >> > Introduce the AioContext in the Monitor struct to avoid repeated calls to > >> >> > iothread_get_aio_context() and ensure symmetrical ref/unref during > >> >> > monitor lifecycle. > >> >> > > >> >> > Signed-off-by: Zhang Chen <[email protected]> > >> >> > >> >> Why are repeated calls bad? > >> >> > >> >> How would symmetry be lost? > >> >> > >> > > >> > OK, will add detailed comments like this in the next version: > >> > > >> > Avoid repeated calls: Under the holder tracking model, fetching the > >> > AioContext increments the IOThread refcount and registers holder metadata. > >> > Dynamically querying it in helper functions (e.g., suspend, BH scheduling) > >> > leads to redundant refcount churn. > >> > >> Right here, we still have > >> > >> AioContext *iothread_get_aio_context(IOThread *iothread) > >> { > >> return iothread->ctx; > >> } > >> > >> and complicating code to avoid additional calls feels dubious. > >> > >> PATCH 14 changes it to > >> > >> AioContext *iothread_get_aio_context(IOThread *iothread, > >> const IOThreadHolder *holder) > >> { > >> /* Add IOThreadHolder to the list */ > >> iothread_ref(iothread, holder); > >> > >> return iothread->ctx; > >> } > >> > >> Are you making this change in preparation of PATCH 14? > >> > > > > > > Yes, following Stefan's earlier suggestion allows for lifecycle management > > to be completed with minimal disruption. > > The commit message is problematic, because it's written as if PATCH 14 > was already applied. Please adjust it. Something like "A subsequent > patch will make repeated calls ... undesirable." Same for symmetry. > OK, will update in the next version. Thanks Chen > [...] >