Re: [RESEND PATCH V10 06/15] monitor: Update tracking iothread users with holder

Markus Armbruster <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
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.

[...]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.