All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 07/15] vfio: Report warnings with warn_report(), not error_printf()
Date: Thu, 18 Apr 2019 08:18:56 +0200	[thread overview]
Message-ID: <87a7gnrg33.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20190417160508.7b87d59a@x1.home> (Alex Williamson's message of "Wed, 17 Apr 2019 16:05:08 -0600")

Alex Williamson <alex.williamson@redhat.com> writes:

> On Wed, 17 Apr 2019 21:06:33 +0200
> Markus Armbruster <armbru@redhat.com> wrote:
>
>> Cc: Alex Williamson <alex.williamson@redhat.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  hw/vfio/pci.c | 19 +++++++++++++------
>>  1 file changed, 13 insertions(+), 6 deletions(-)
>> 
>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>> index 504019c458..0142819ea6 100644
>> --- a/hw/vfio/pci.c
>> +++ b/hw/vfio/pci.c
>> @@ -947,8 +947,10 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
>>      if (vdev->pdev.romfile || !vdev->pdev.rom_bar) {
>>          /* Since pci handles romfile, just print a message and return */
>>          if (vfio_blacklist_opt_rom(vdev) && vdev->pdev.romfile) {
>> -            error_printf("Warning : Device at %s is known to cause system instability issues during option rom execution. Proceeding anyway since user specified romfile\n",
>> -                         vdev->vbasedev.name);
>> +            warn_report("Device at %s is known to cause system instability"
>> +                        " issues during option rom execution",
>> +                        vdev->vbasedev.name);
>> +            error_printf("Proceeding anyway since user specified romfile\n");
>
> I'm confused, the original warning is "this device is know to have
> issues, proceeding because you asked me to".  Are we categorizing the
> first half as a warning and the latter as random uncategorized error
> spew?  Did an automated script chunk it this way because of the period
> and strict application of the "single phrase" specification of
> warn_report()?  If this is the recommended semantics, I'm not sure how
> I'd know to generate this myself for similar situations.  Should we
> instead try to express this in something acceptable as a single
> phrase?  Thanks,

This is an instance of the following error reporting pattern:

    concise error / warning message (one line, single phrase)
    additional information (free format)

We use error_report() / warn_report() for the former (this adds
decorations to the message), and error_printf() for the latter.

"git-grep -w error_printf" will lead you to other instances.  Recommend
to look with this series applied, because it removes misuses of
error_printf().

Particularly relevant instances are error_report_err() and
warn_report_err(): these print the error proper with error_report() /
warn_report_err(), and the hint, if any, with error_printf().

Clearer now?

  reply	other threads:[~2019-04-18  6:19 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 19:06 [Qemu-devel] [PATCH v3 00/15] Clean up use of error_printf() Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 01/15] qemu-img: Use error_vreport() in error_exit() Markus Armbruster
2019-04-17 19:06   ` Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 02/15] block/ssh: Do not report read/write/flush errors to the user Markus Armbruster
2019-04-17 19:06   ` Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 03/15] loader-fit: Wean off error_printf() Markus Armbruster
2019-04-17 19:06   ` Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 04/15] mips/boston: Report errors with error_report(), not error_printf() Markus Armbruster
2019-04-17 19:06   ` Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 05/15] pci: Report fatal " Markus Armbruster
2019-04-17 19:06   ` Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 06/15] hpet: Report warnings with warn_report(), " Markus Armbruster
2019-04-17 19:06   ` Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 07/15] vfio: " Markus Armbruster
2019-04-17 22:05   ` Alex Williamson
2019-04-18  6:18     ` Markus Armbruster [this message]
2019-04-18 16:36       ` Alex Williamson
2019-04-18 20:25         ` Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 08/15] s390x/kvm: " Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 09/15] vl: Make -machine $TYPE, help and -accel help print to stdout Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 10/15] monitor error: Make printf()-like functions return a value Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 11/15] qemu-print: New qemu_printf(), qemu_vprintf() etc Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 12/15] blockdev: Make -drive format=help print to stdout Markus Armbruster
2019-04-17 19:06   ` Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 13/15] char: Make -chardev help " Markus Armbruster
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 14/15] char-pty: Print "char device redirected" message " Markus Armbruster
2019-04-17 19:31   ` Eric Blake
2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 15/15] monitor: Simplify how -device/device_add print help Markus Armbruster

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=87a7gnrg33.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.williamson@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.