Re: [Qemu-devel] [PATCH 03/31] cpus hw target: Use warn_report() & friends to report warnings
Markus Armbruster writes: > Calling error_report() in a function that takes an Error ** argument > is suspicious. Convert a few that are actually warnings to > warn_report(). > > While there, split a warning consisting of multiple sentences to > conform to conventions spelled out in warn_report()'s contract. > > Cc: Alex Bennée > Cc: Mark Cave-Ayland > Cc: Alex Williamson > Cc: Fam Zheng > Cc: Wei Huang > Cc: David Gibson > Signed-off-by: Markus Armbruster Reviewed-by: Alex Bennée > --- > cpus.c | 8 > hw/display/cg3.c| 2 +- > hw/display/tcx.c| 2 +- > hw/misc/ivshmem.c | 4 ++-- > hw/net/virtio-net.c | 8 > hw/virtio/virtio-pci.c | 4 ++-- > target/i386/cpu.c | 17 + > target/ppc/translate_init.inc.c | 4 ++-- > 8 files changed, 25 insertions(+), 24 deletions(-) > > diff --git a/cpus.c b/cpus.c > index 361678e459..7804071872 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -211,12 +211,12 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp) > error_setg(errp, "No MTTCG when icount is enabled"); > } else { > #ifndef TARGET_SUPPORTS_MTTCG > -error_report("Guest not yet converted to MTTCG - " > - "you may get unexpected results"); > +warn_report("Guest not yet converted to MTTCG - " > +"you may get unexpected results"); > #endif > if (!check_tcg_memory_orders_compatible()) { > -error_report("Guest expects a stronger memory ordering " > - "than the host provides"); > +warn_report("Guest expects a stronger memory ordering " > +"than the host provides"); > error_printf("This may cause strange/hard to debug > errors\n"); > } > mttcg_enabled = true; > diff --git a/hw/display/cg3.c b/hw/display/cg3.c > index 1c199ab369..e50d97e48c 100644 > --- a/hw/display/cg3.c > +++ b/hw/display/cg3.c > @@ -307,7 +307,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp) > ret = load_image_mr(fcode_filename, &s->rom); > g_free(fcode_filename); > if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { > -error_report("cg3: could not load prom '%s'", CG3_ROM_FILE); > +warn_report("cg3: could not load prom '%s'", CG3_ROM_FILE); > } > } > > diff --git a/hw/display/tcx.c b/hw/display/tcx.c > index b2786ee8d0..66f2459226 100644 > --- a/hw/display/tcx.c > +++ b/hw/display/tcx.c > @@ -823,7 +823,7 @@ static void tcx_realizefn(DeviceState *dev, Error **errp) > ret = load_image_mr(fcode_filename, &s->rom); > g_free(fcode_filename); > if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { > -error_report("tcx: could not load prom '%s'", TCX_ROM_FILE); > +warn_report("tcx: could not load prom '%s'", TCX_ROM_FILE); > } > } > > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > index 6febbabcaa..4794518b2c 100644 > --- a/hw/misc/ivshmem.c > +++ b/hw/misc/ivshmem.c > @@ -1292,8 +1292,8 @@ static void ivshmem_realize(PCIDevice *dev, Error > **errp) > IVShmemState *s = IVSHMEM_COMMON(dev); > > if (!qtest_enabled()) { > -error_report("ivshmem is deprecated, please use ivshmem-plain" > - " or ivshmem-doorbell instead"); > +warn_report("ivshmem is deprecated, please use ivshmem-plain" > +" or ivshmem-doorbell instead"); > } > > if (qemu_chr_fe_backend_connected(&s->server_chr) + !!s->shmobj != 1) { > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index 4bdd5b8532..385b1a03e9 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -2020,10 +2020,10 @@ static void virtio_net_device_realize(DeviceState > *dev, Error **errp) > > if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer") > && strcmp(n->net_conf.tx, "bh")) { > -error_report("virtio-net: " > - "Unknown option tx=%s, valid options: \"timer\" \"bh\"", > - n->net_conf.tx); > -error_report("Defaulting to \"bh\""); > +warn_report("virtio-net: " > +"Unknown option tx=%s, valid options: \"timer\" \"bh\"", > +n->net_conf.tx); > +error_printf("Defaulting to \"bh\""); > } > > n->net_conf.tx_queue_size = MIN(virtio_net_max_tx_queue_size(n), > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c > index 3a01fe90f0..a954799267 100644 > --- a/hw/virtio/virtio-pci.c > +++ b/hw/virtio/virtio-pci.c > @@ -1683,8 +1683,8 @@ static void virtio_pci_device_plugged(DeviceState *d, > Error **errp) > if (err) { > /* Notice when a system that supports MSIx can't initialize it */
Re: [Qemu-devel] [PATCH 03/31] cpus hw target: Use warn_report() & friends to report warnings
On Mon, Oct 08, 2018 at 07:30:57PM +0200, Markus Armbruster wrote: > Calling error_report() in a function that takes an Error ** argument > is suspicious. Convert a few that are actually warnings to > warn_report(). > > While there, split a warning consisting of multiple sentences to > conform to conventions spelled out in warn_report()'s contract. > > Cc: Alex Bennée > Cc: Mark Cave-Ayland > Cc: Alex Williamson > Cc: Fam Zheng > Cc: Wei Huang > Cc: David Gibson > Signed-off-by: Markus Armbruster ppc part Acked-by: David Gibson > --- > cpus.c | 8 > hw/display/cg3.c| 2 +- > hw/display/tcx.c| 2 +- > hw/misc/ivshmem.c | 4 ++-- > hw/net/virtio-net.c | 8 > hw/virtio/virtio-pci.c | 4 ++-- > target/i386/cpu.c | 17 + > target/ppc/translate_init.inc.c | 4 ++-- > 8 files changed, 25 insertions(+), 24 deletions(-) > > diff --git a/cpus.c b/cpus.c > index 361678e459..7804071872 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -211,12 +211,12 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp) > error_setg(errp, "No MTTCG when icount is enabled"); > } else { > #ifndef TARGET_SUPPORTS_MTTCG > -error_report("Guest not yet converted to MTTCG - " > - "you may get unexpected results"); > +warn_report("Guest not yet converted to MTTCG - " > +"you may get unexpected results"); > #endif > if (!check_tcg_memory_orders_compatible()) { > -error_report("Guest expects a stronger memory ordering " > - "than the host provides"); > +warn_report("Guest expects a stronger memory ordering " > +"than the host provides"); > error_printf("This may cause strange/hard to debug > errors\n"); > } > mttcg_enabled = true; > diff --git a/hw/display/cg3.c b/hw/display/cg3.c > index 1c199ab369..e50d97e48c 100644 > --- a/hw/display/cg3.c > +++ b/hw/display/cg3.c > @@ -307,7 +307,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp) > ret = load_image_mr(fcode_filename, &s->rom); > g_free(fcode_filename); > if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { > -error_report("cg3: could not load prom '%s'", CG3_ROM_FILE); > +warn_report("cg3: could not load prom '%s'", CG3_ROM_FILE); > } > } > > diff --git a/hw/display/tcx.c b/hw/display/tcx.c > index b2786ee8d0..66f2459226 100644 > --- a/hw/display/tcx.c > +++ b/hw/display/tcx.c > @@ -823,7 +823,7 @@ static void tcx_realizefn(DeviceState *dev, Error **errp) > ret = load_image_mr(fcode_filename, &s->rom); > g_free(fcode_filename); > if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { > -error_report("tcx: could not load prom '%s'", TCX_ROM_FILE); > +warn_report("tcx: could not load prom '%s'", TCX_ROM_FILE); > } > } > > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > index 6febbabcaa..4794518b2c 100644 > --- a/hw/misc/ivshmem.c > +++ b/hw/misc/ivshmem.c > @@ -1292,8 +1292,8 @@ static void ivshmem_realize(PCIDevice *dev, Error > **errp) > IVShmemState *s = IVSHMEM_COMMON(dev); > > if (!qtest_enabled()) { > -error_report("ivshmem is deprecated, please use ivshmem-plain" > - " or ivshmem-doorbell instead"); > +warn_report("ivshmem is deprecated, please use ivshmem-plain" > +" or ivshmem-doorbell instead"); > } > > if (qemu_chr_fe_backend_connected(&s->server_chr) + !!s->shmobj != 1) { > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index 4bdd5b8532..385b1a03e9 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -2020,10 +2020,10 @@ static void virtio_net_device_realize(DeviceState > *dev, Error **errp) > > if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer") > && strcmp(n->net_conf.tx, "bh")) { > -error_report("virtio-net: " > - "Unknown option tx=%s, valid options: \"timer\" \"bh\"", > - n->net_conf.tx); > -error_report("Defaulting to \"bh\""); > +warn_report("virtio-net: " > +"Unknown option tx=%s, valid options: \"timer\" \"bh\"", > +n->net_conf.tx); > +error_printf("Defaulting to \"bh\""); > } > > n->net_conf.tx_queue_size = MIN(virtio_net_max_tx_queue_size(n), > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c > index 3a01fe90f0..a954799267 100644 > --- a/hw/virtio/virtio-pci.c > +++ b/hw/virtio/virtio-pci.c > @@ -1683,8 +1683,8 @@ static void virtio_pci_device_plugged(DeviceState *d, > Error **errp) > if (err) { > /* Noti
[Qemu-devel] [PATCH 03/31] cpus hw target: Use warn_report() & friends to report warnings
Calling error_report() in a function that takes an Error ** argument is suspicious. Convert a few that are actually warnings to warn_report(). While there, split a warning consisting of multiple sentences to conform to conventions spelled out in warn_report()'s contract. Cc: Alex Bennée Cc: Mark Cave-Ayland Cc: Alex Williamson Cc: Fam Zheng Cc: Wei Huang Cc: David Gibson Signed-off-by: Markus Armbruster --- cpus.c | 8 hw/display/cg3.c| 2 +- hw/display/tcx.c| 2 +- hw/misc/ivshmem.c | 4 ++-- hw/net/virtio-net.c | 8 hw/virtio/virtio-pci.c | 4 ++-- target/i386/cpu.c | 17 + target/ppc/translate_init.inc.c | 4 ++-- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/cpus.c b/cpus.c index 361678e459..7804071872 100644 --- a/cpus.c +++ b/cpus.c @@ -211,12 +211,12 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp) error_setg(errp, "No MTTCG when icount is enabled"); } else { #ifndef TARGET_SUPPORTS_MTTCG -error_report("Guest not yet converted to MTTCG - " - "you may get unexpected results"); +warn_report("Guest not yet converted to MTTCG - " +"you may get unexpected results"); #endif if (!check_tcg_memory_orders_compatible()) { -error_report("Guest expects a stronger memory ordering " - "than the host provides"); +warn_report("Guest expects a stronger memory ordering " +"than the host provides"); error_printf("This may cause strange/hard to debug errors\n"); } mttcg_enabled = true; diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 1c199ab369..e50d97e48c 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -307,7 +307,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp) ret = load_image_mr(fcode_filename, &s->rom); g_free(fcode_filename); if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { -error_report("cg3: could not load prom '%s'", CG3_ROM_FILE); +warn_report("cg3: could not load prom '%s'", CG3_ROM_FILE); } } diff --git a/hw/display/tcx.c b/hw/display/tcx.c index b2786ee8d0..66f2459226 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -823,7 +823,7 @@ static void tcx_realizefn(DeviceState *dev, Error **errp) ret = load_image_mr(fcode_filename, &s->rom); g_free(fcode_filename); if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { -error_report("tcx: could not load prom '%s'", TCX_ROM_FILE); +warn_report("tcx: could not load prom '%s'", TCX_ROM_FILE); } } diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 6febbabcaa..4794518b2c 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -1292,8 +1292,8 @@ static void ivshmem_realize(PCIDevice *dev, Error **errp) IVShmemState *s = IVSHMEM_COMMON(dev); if (!qtest_enabled()) { -error_report("ivshmem is deprecated, please use ivshmem-plain" - " or ivshmem-doorbell instead"); +warn_report("ivshmem is deprecated, please use ivshmem-plain" +" or ivshmem-doorbell instead"); } if (qemu_chr_fe_backend_connected(&s->server_chr) + !!s->shmobj != 1) { diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 4bdd5b8532..385b1a03e9 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2020,10 +2020,10 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer") && strcmp(n->net_conf.tx, "bh")) { -error_report("virtio-net: " - "Unknown option tx=%s, valid options: \"timer\" \"bh\"", - n->net_conf.tx); -error_report("Defaulting to \"bh\""); +warn_report("virtio-net: " +"Unknown option tx=%s, valid options: \"timer\" \"bh\"", +n->net_conf.tx); +error_printf("Defaulting to \"bh\""); } n->net_conf.tx_queue_size = MIN(virtio_net_max_tx_queue_size(n), diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 3a01fe90f0..a954799267 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1683,8 +1683,8 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) if (err) { /* Notice when a system that supports MSIx can't initialize it */ if (err != -ENOTSUP) { -error_report("unable to init msix vectors to %" PRIu32, - proxy->nvectors); +warn_report("unable to init msix vectors to %" PRIu32, +proxy->nvectors);