From: Eduardo Habkost <ehabkost@redhat.com>
To: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-devel@nongnu.org, alistair23@gmail.com,
philippe@mathieu-daude.net, berrange@redhat.com,
armbru@redhat.com, Jeff Cody <jcody@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>, Peter Lieven <pl@kamp.de>,
Josh Durgin <jdurgin@redhat.com>,
"Richard W.M. Jones" <rjones@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Richard Henderson <rth@twiddle.net>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Greg Kurz <groug@kaod.org>, Rob Herring <robh@kernel.org>,
Peter Maydell <peter.maydell@linaro.org>,
Peter Chubb <peter.chubb@nicta.com.au>,
Marcel Apfelbaum <marcel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>,
Alexander Graf <agraf@suse.de>, Gerd Hoffmann <kraxel@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Cornelia Huck <cohuck@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v1 3/6] Convert error_report() to warn_report()
Date: Fri, 7 Jul 2017 09:06:00 -0300 [thread overview]
Message-ID: <20170707120600.GQ12152@localhost.localdomain> (raw)
In-Reply-To: <0a1d5638543965d532284bdc6fce391cf9f509d0.1499381754.git.alistair.francis@xilinx.com>
On Thu, Jul 06, 2017 at 04:49:44PM -0700, Alistair Francis wrote:
> Convert all uses of error_report("[Ww]arning:"... to use warn_report()
> instead. This helps standardise on a single method of printing warnings
> to the user.
>
> All of the warnings were found using this regex expression:
> error_report.*[Ww]arning:
> and replaced with:
> warn_report("
>
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> Suggested-by: Thomas Huth <thuth@redhat.com>
I have reviewed the changes in: */i386/*, qdev-properties.c,
vl.c, and tests/test-qdev-global-props.c. They look good, except
for kvm_arch_init_vcpu() below.
There are also a few places below where we could improve the
error messages in a follow-up patch (or in a new version of this
patch if you prefer).
[...]
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 5464977424..6b7bade183 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2766,17 +2766,17 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
> ACPI_BUILD_ALIGN_SIZE);
> if (tables_blob->len > legacy_table_size) {
> /* Should happen only with PCI bridges and -M pc-i440fx-2.0. */
> - error_report("Warning: migration may not work.");
> + warn_report("migration may not work.");
I suggest removing the period.
Adding a justification to why migration may not work is a good
idea, too. We could copy the messages below (replacing "64k"
with legacy_table_size).
> }
> g_array_set_size(tables_blob, legacy_table_size);
> } else {
> /* Make sure we have a buffer in case we need to resize the tables. */
> if (tables_blob->len > ACPI_BUILD_TABLE_SIZE / 2) {
> /* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */
> - error_report("Warning: ACPI tables are larger than 64k.");
> - error_report("Warning: migration may not work.");
> - error_report("Warning: please remove CPUs, NUMA nodes, "
> - "memory slots or PCI bridges.");
> + warn_report("ACPI tables are larger than 64k.");
> + warn_report("migration may not work.");
> + warn_report("please remove CPUs, NUMA nodes, "
> + "memory slots or PCI bridges.");
I was going to suggest removing the periods here, but I'm not
sure because we have multiple full sentences.
However, if we are going to keep full sentences, I believe we
should use uppercase letters.
> }
> acpi_align_size(tables_blob, ACPI_BUILD_TABLE_SIZE);
> }
> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> index 9f2615cbe0..33e20cb3e8 100644
> --- a/hw/i386/kvm/pci-assign.c
> +++ b/hw/i386/kvm/pci-assign.c
> @@ -1353,9 +1353,9 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
> PCI_CAP_ID_EXP);
> return -EINVAL;
> } else if (size != 0x3c) {
> - error_report("WARNING, %s: PCIe cap-id 0x%x has "
> - "non-standard size 0x%x; std size should be 0x3c",
> - __func__, PCI_CAP_ID_EXP, size);
> + warn_report("%s: PCIe cap-id 0x%x has "
> + "non-standard size 0x%x; std size should be 0x3c",
> + __func__, PCI_CAP_ID_EXP, size);
> }
> } else if (version == 0) {
> uint16_t vid, did;
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 224fe58fe7..58f8a4f4a5 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -381,8 +381,8 @@ ISADevice *pc_find_fdc0(void)
> }
>
> if (state.multiple) {
> - error_report("warning: multiple floppy disk controllers with "
> - "iobase=0x3f0 have been found");
> + warn_report("multiple floppy disk controllers with "
> + "iobase=0x3f0 have been found");
> error_printf("the one being picked for CMOS setup might not reflect "
> "your intent\n");
The error_printf() on the second line could use warn_report() for
consistency? In either case, the "\n" needs to be removed.
> }
> @@ -1310,7 +1310,7 @@ void pc_acpi_init(const char *default_dsdt)
>
> filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, default_dsdt);
> if (filename == NULL) {
> - fprintf(stderr, "WARNING: failed to find %s\n", default_dsdt);
> + warn_report("failed to find %s", default_dsdt);
> } else {
> QemuOpts *opts = qemu_opts_create(qemu_find_opts("acpi"), NULL, 0,
> &error_abort);
> @@ -2087,9 +2087,9 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v,
> }
>
> if (value < (1ULL << 20)) {
> - error_report("Warning: small max_ram_below_4g(%"PRIu64
> - ") less than 1M. BIOS may not work..",
> - value);
> + warn_report("small max_ram_below_4g(%"PRIu64
> + ") less than 1M. BIOS may not work..",
> + value);
I suggest removing the "..", adding a space before "(", and
possibly removing the word "small".
Maybe we could use the same "<fact>; <possible consequence>."
pattern from the other messages below? e.g.:
warn_report("max_ram_below_4g(%" PRIu64 ") is less than 1M; "
"BIOS may not work.", value);
> }
>
> pcms->max_ram_below_4g = value;
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 22dbef64c6..11b4336a42 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -131,10 +131,10 @@ static void pc_init1(MachineState *machine,
> lowmem = 0xc0000000;
> }
> if (lowmem & ((1ULL << 30) - 1)) {
> - error_report("Warning: Large machine and max_ram_below_4g "
> - "(%" PRIu64 ") not a multiple of 1G; "
> - "possible bad performance.",
> - pcms->max_ram_below_4g);
> + warn_report("Large machine and max_ram_below_4g "
> + "(%" PRIu64 ") not a multiple of 1G; "
> + "possible bad performance.",
> + pcms->max_ram_below_4g);
> }
> }
> }
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 8f696b7cb6..1653a47f0a 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -101,9 +101,9 @@ static void pc_q35_init(MachineState *machine)
> lowmem = pcms->max_ram_below_4g;
> if (machine->ram_size - lowmem > lowmem &&
> lowmem & ((1ULL << 30) - 1)) {
> - error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
> - ") not a multiple of 1G; possible bad performance.",
> - pcms->max_ram_below_4g);
> + warn_report("Large machine and max_ram_below_4g(%"PRIu64
> + ") not a multiple of 1G; possible bad performance.",
> + pcms->max_ram_below_4g);
I suggest a space before "(".
> }
> }
>
[...]
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index f84a49d366..3b29f5a758 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -600,10 +600,10 @@ static int kvm_arch_set_tsc_khz(CPUState *cs)
> kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ) :
> -ENOTSUP;
> if (cur_freq <= 0 || cur_freq != env->tsc_khz) {
> - error_report("warning: TSC frequency mismatch between "
> - "VM (%" PRId64 " kHz) and host (%d kHz), "
> - "and TSC scaling unavailable",
> - env->tsc_khz, cur_freq);
> + warn_report("TSC frequency mismatch between "
> + "VM (%" PRId64 " kHz) and host (%d kHz), "
> + "and TSC scaling unavailable",
> + env->tsc_khz, cur_freq);
> return r;
> }
> }
> @@ -919,7 +919,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
> error_report("kvm: LMCE not supported");
> return -ENOTSUP;
> }
> - error_report("warning: Unsupported MCG_CAP bits: 0x%" PRIx64,
> + warn_report(" Unsupported MCG_CAP bits: 0x%" PRIx64,
> unsupported_caps);
Extra whitespace here.
> }
>
[...]
--
Eduardo
next prev parent reply other threads:[~2017-07-07 12:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 23:49 [Qemu-devel] [PATCH v1 0/6] Implement a warning_report function Alistair Francis
2017-07-06 23:49 ` [Qemu-devel] [PATCH v1 1/6] util/qemu-error: Rename error_print_loc() to be more generic Alistair Francis
2017-07-06 23:49 ` [Qemu-devel] [PATCH v1 2/6] error: Functions to report warnings and informational messages Alistair Francis
2017-07-07 12:59 ` Markus Armbruster
2017-07-07 17:10 ` Alistair Francis
2017-07-06 23:49 ` [Qemu-devel] [PATCH v1 3/6] Convert error_report() to warn_report() Alistair Francis
2017-07-07 0:14 ` Peter.Chubb
2017-07-07 17:19 ` Alistair Francis
2017-07-10 8:06 ` Markus Armbruster
2017-07-10 12:02 ` Philippe Mathieu-Daudé
2017-07-07 1:09 ` David Gibson
2017-07-07 6:33 ` Thomas Huth
2017-07-07 11:58 ` Eduardo Habkost
2017-07-07 12:07 ` Thomas Huth
2017-07-07 6:33 ` Greg Kurz
2017-07-07 8:29 ` Cornelia Huck
2017-07-07 12:06 ` Eduardo Habkost [this message]
2017-07-07 17:39 ` Alistair Francis
2017-07-07 12:32 ` Stefan Hajnoczi
2017-07-07 12:48 ` Markus Armbruster
2017-07-07 17:30 ` Alistair Francis
2017-07-10 7:49 ` Marcel Apfelbaum
2017-07-06 23:49 ` [Qemu-devel] [PATCH v1 4/6] char-socket: Report TCP socket waiting as information Alistair Francis
2017-07-07 11:32 ` Philippe Mathieu-Daudé
2017-07-06 23:49 ` [Qemu-devel] [PATCH v1 5/6] error: Implement the warn and free Error functions Alistair Francis
2017-07-06 23:49 ` [Qemu-devel] [PATCH v1 6/6] Convert error_report*_err() to warn_report*_err() Alistair Francis
2017-07-07 11:41 ` Philippe Mathieu-Daudé
2017-07-07 12:07 ` Eduardo Habkost
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=20170707120600.GQ12152@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=agraf@suse.de \
--cc=alistair.francis@xilinx.com \
--cc=alistair23@gmail.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=crosthwaite.peter@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=imammedo@redhat.com \
--cc=jasowang@redhat.com \
--cc=jcody@redhat.com \
--cc=jdurgin@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcel@redhat.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.chubb@nicta.com.au \
--cc=peter.maydell@linaro.org \
--cc=philippe@mathieu-daude.net \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=robh@kernel.org \
--cc=ronniesahlberg@gmail.com \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).