Yes, that looks correct. Thanks!

- Marc

On Mon, Dec 15, 2025, 6:52 AM Paolo Bonzini <[email protected]> wrote:

> On 12/13/25 01:14, Marc Morcos wrote:
> > @@ -346,7 +347,15 @@ static void monitor_qapi_event_emit(QAPIEvent
> event, QDict *qdict)
> >           }
> >
> >           qmp_mon = container_of(mon, MonitorQMP, common);
> > -        if (qmp_mon->commands != &qmp_cap_negotiation_commands) {
> > +        do_send = false;
> > +
> > +        WITH_QEMU_LOCK_GUARD(&mon->mon_lock) {
> > +            if (qmp_mon->commands != &qmp_cap_negotiation_commands) {
> > +                do_send = true;
> > +            }
> > +        }
> > +
> > +        if (do_send) {
> >               qmp_send_response(qmp_mon, qdict);
> >           }
> >       }
>
> We cannot use WITH_QEMU_LOCK_GUARD with "continue" or "break" inside,
> but we can use QEMU_LOCK_GUARD:
>
> @@ -347,17 +346,13 @@ static void monitor_qapi_event_emit(QAPIEvent
> event, QDict *qdict)
>           }
>
>           qmp_mon = container_of(mon, MonitorQMP, common);
> -        do_send = false;
> -
> -        WITH_QEMU_LOCK_GUARD(&mon->mon_lock) {
> -            if (qmp_mon->commands != &qmp_cap_negotiation_commands) {
> -                do_send = true;
> +        {
> +            QEMU_LOCK_GUARD(&mon->mon_lock);
> +            if (qmp_mon->commands == &qmp_cap_negotiation_commands) {
> +                continue;
>               }
>           }
> -
> -        if (do_send) {
> -            qmp_send_response(qmp_mon, qdict);
> -        }
> +        qmp_send_response(qmp_mon, qdict);
>       }
>   }
>
>
> Let me know if this is okay for you!
>
> Paolo
>
>

Reply via email to