qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] target/i386: Revert monitor_puts() in do_inject_x86_mce()


From: Peter Maydell
Subject: Re: [PATCH v2] target/i386: Revert monitor_puts() in do_inject_x86_mce()
Date: Wed, 20 Mar 2024 14:04:42 +0000

On Wed, 20 Mar 2024 at 13:03, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Wed, Mar 20, 2024 at 04:36:40PM +0800, Tao Su wrote:
> > monitor_puts() doesn't check the monitor pointer, but do_inject_x86_mce()
> > may have a parameter with NULL monitor pointer. Revert monitor_puts() in
> > do_inject_x86_mce() to fix, then the fact that we send the same message to
> > monitor and log is again more obvious.
>
> Yikes, why do we have such a horrible trap-door in our
> monitor output APIs.
>
> Isn't the right fix here to make 'monitor_puts' check for
> NULL & be a no-op, in the same way 'monitor_printf' does,
> so the APIs have consistent behaviour.

The other difference between monitor_puts(mon, s) and
monitor_printf(mon, "%s", s)
is that the latter will return an error if the monitor is QMP, whereas
the former will go ahead and print the message anyway. That one is
awkward to resolve, because the mechanism the QMP monitor uses to
print the JSON in qmp_send_response() is to call monitor_puts()...

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]