Re: [RESEND PATCH V10 06/15] monitor: Update tracking iothread users with holder
Zhang Chen <[email protected]>
| Newsgroups | gmane.comp.emulators.qemu |
|---|---|
| Message-ID | <CAK3tnv+UMEsZTR12iY74sD42m5nNhYEtyF58QxVoG-JAeUZHcw@mail.gmail.com> |
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. Ensure lifecycle symmetry: Storing AioContext in mon->ctx establishes a strict 1-to-1 lifecycle pairing: a single iothread_ref_and_get_aio_context() in monitor_complete() matched by a single iothread_put_aio_context() in monitor_cleanup(). Thanks Chen