From: Cole Robinson <crobinso@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 5/6] error: Remove redundant error_printf_unless_qmp
Date: Fri, 21 Mar 2014 19:41:53 -0400 [thread overview]
Message-ID: <532CCE41.9000807@redhat.com> (raw)
In-Reply-To: <87iorj7q39.fsf@blackfin.pond.sub.org>
On 03/12/2014 04:56 AM, Markus Armbruster wrote:
> Cole Robinson <crobinso@redhat.com> writes:
>
>> error_printf is just a wrapper around monitor_printf, which already
>> drops the requested output if cur_mon is qmp.
>
> Since commit 74ee59a:
>
> monitor: drop unused monitor debug code
>
> In the old QMP days, this code was used to find out QMP commands that
> might be calling monitor_printf() down its call chain.
>
> This is almost impossible to happen today, because the qapi converted
> commands don't even have a monitor object. Besides, it's been more than
> a year since I used this last time.
>
> Let's just drop it.
>
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>
> I gave my R-by then, but I'm no longer sure it was a sensible move.
> Attempting to print in QMP context is as much a sign of trouble as it
> ever was. I hate sweeping signs of trouble under the carpet. If misuse
> is really "almost impossible", then we should assert() it is, and fix
> the bugs caught by it.
>
> I can see error_printf() / error_printf_unless_qmp() used in a couple of
> ways:
>
> 1. Print hints after qerror_report(), with error_printf_unless_qmp()
>
> qerror_report() is a transitional interface to help with converting
> existing HMP commands to QMP. It should not be used elsewhere.
>
> We suppress the hints in QMP, because the QMP wire format doesn't
> provide for hints.
>
> We can't add hints to an error when using error_set(), because that
> API lacks support for hints. Pity.
>
> Examples: see your patch below.
>
> 2. Print hints after error_report(), with error_printf()
>
> Use of error_report() in QMP context is a sign of trouble just like
> any other non-JSON output to the monitor.
>
> error_printf() rather than error_printf_unless_qmp(), because the
> latter explicitly signals intent "skip this in QMP", while the former
> signals "QMP should not happen".
>
> The difference in intent is what makes me wary of this patch.
>
> Example: vfio_pci_load_rom().
>
> 3. Ordinary output in code shared between command line and HMP, with
> error_printf()
>
> error_printf() was pressed into use as convenient "print to monitor
> in HMP context, else to tty" function. Inappropriate, because it
> prints to stderr rather than stdout.
>
> Examples: many help texts under is_help_option().
>
> 4. Warnings, with error_printf()
>
> I figure these should use error_report() instead.
>
> Examples: block/ssh.c, hw/misc/vfio.c, ...
Thanks, I didn't think about any of that. I'll drop this patch
- Cole
next prev parent reply other threads:[~2014-03-21 23:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 23:15 [Qemu-devel] [PATCH 0/6] error: Misc cleanups and improvements Cole Robinson
2014-03-11 23:15 ` [Qemu-devel] [PATCH 1/6] slirp: Remove default_mon usage Cole Robinson
2014-03-12 7:22 ` Jan Kiszka
2014-03-12 13:06 ` Luiz Capitulino
2014-03-22 18:27 ` Andreas Färber
2014-03-22 21:36 ` Cole Robinson
2014-03-12 8:13 ` Markus Armbruster
2014-03-12 13:22 ` Cole Robinson
2014-03-12 14:45 ` Markus Armbruster
2014-03-11 23:15 ` [Qemu-devel] [PATCH 2/6] vnc: " Cole Robinson
2014-03-12 7:35 ` Gerd Hoffmann
2014-03-22 20:14 ` Andreas Färber
2014-03-11 23:15 ` [Qemu-devel] [PATCH 3/6] error: Privatize error_print_loc Cole Robinson
2014-03-22 20:04 ` Andreas Färber
2014-03-11 23:15 ` [Qemu-devel] [PATCH 4/6] monitor: Remove unused monitor_print_filename Cole Robinson
2014-03-22 20:06 ` Andreas Färber
2014-03-22 21:44 ` Cole Robinson
2014-03-24 13:09 ` Luiz Capitulino
2014-03-24 13:46 ` Andreas Färber
2014-03-26 13:46 ` Markus Armbruster
2014-03-11 23:15 ` [Qemu-devel] [PATCH 5/6] error: Remove redundant error_printf_unless_qmp Cole Robinson
2014-03-12 8:56 ` Markus Armbruster
2014-03-21 23:41 ` Cole Robinson [this message]
2014-03-11 23:15 ` [Qemu-devel] [PATCH 6/6] error: Print error_report() to stderr if using qmp Cole Robinson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=532CCE41.9000807@redhat.com \
--to=crobinso@redhat.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.