From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: "Fam Zheng" <fam@euphon.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jeff Cody" <codyprime@gmail.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org, "Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
"Juan Quintela" <quintela@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Yuval Shaia" <yuval.shaia@oracle.com>,
"Alex Williamson" <alex.williamson@redhat.com>,
"John Snow" <jsnow@redhat.com>,
"Richard Henderson" <rth@twiddle.net>,
"Kevin Wolf" <kwolf@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Max Reitz" <mreitz@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 04/17] ppc: Pass local error object pointer to error_append_hint()
Date: Wed, 18 Sep 2019 10:12:00 +1000 [thread overview]
Message-ID: <20190918001200.GB2440@umbus.fritz.box> (raw)
In-Reply-To: <156871565600.196432.9246692833113774428.stgit@bahia.lan>
[-- Attachment #1: Type: text/plain, Size: 5049 bytes --]
On Tue, Sep 17, 2019 at 12:20:56PM +0200, Greg Kurz wrote:
> Ensure that hints are added even if errp is &error_fatal or &error_abort.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> hw/ppc/mac_newworld.c | 7 +++++--
> hw/ppc/spapr.c | 7 +++++--
> hw/ppc/spapr_pci.c | 9 +++++----
> target/ppc/kvm.c | 13 +++++++++----
> 4 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index c5bbcc743352..aca8c40bf395 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -618,8 +618,11 @@ static void core99_set_via_config(Object *obj, const char *value, Error **errp)
> } else if (!strcmp(value, "pmu-adb")) {
> cms->via_config = CORE99_VIA_CONFIG_PMU_ADB;
> } else {
> - error_setg(errp, "Invalid via value");
> - error_append_hint(errp, "Valid values are cuda, pmu, pmu-adb.\n");
> + Error *local_err = NULL;
> +
> + error_setg(&local_err, "Invalid via value");
> + error_append_hint(&local_err, "Valid values are cuda, pmu, pmu-adb.\n");
> + error_propagate(errp, local_err);
> }
> }
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 08a2a5a77092..39d6f57d014e 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4337,10 +4337,13 @@ void spapr_set_vcpu_id(PowerPCCPU *cpu, int cpu_index, Error **errp)
> vcpu_id = spapr_vcpu_id(spapr, cpu_index);
>
> if (kvm_enabled() && !kvm_vcpu_id_is_valid(vcpu_id)) {
> - error_setg(errp, "Can't create CPU with id %d in KVM", vcpu_id);
> - error_append_hint(errp, "Adjust the number of cpus to %d "
> + Error *local_err = NULL;
> +
> + error_setg(&local_err, "Can't create CPU with id %d in KVM", vcpu_id);
> + error_append_hint(&local_err, "Adjust the number of cpus to %d "
> "or try to raise the number of threads per core\n",
> vcpu_id * ms->smp.threads / spapr->vsmt);
> + error_propagate(errp, local_err);
> return;
> }
>
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 7b71ad7c74f1..4b7e9a1c8666 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -1870,12 +1870,13 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
> if (spapr_pci_find_phb(spapr, sphb->buid)) {
> SpaprPhbState *s;
>
> - error_setg(errp, "PCI host bridges must have unique indexes");
> - error_append_hint(errp, "The following indexes are already in use:");
> + error_setg(&local_err, "PCI host bridges must have unique indexes");
> + error_append_hint(&local_err, "The following indexes are already in use:");
> QLIST_FOREACH(s, &spapr->phbs, list) {
> - error_append_hint(errp, " %d", s->index);
> + error_append_hint(&local_err, " %d", s->index);
> }
> - error_append_hint(errp, "\nTry another value for the index property\n");
> + error_append_hint(&local_err, "\nTry another value for the index property\n");
> + error_propagate(errp, local_err);
> return;
> }
>
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 8c5b1f25cc95..c6876b08c726 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -242,8 +242,11 @@ static void kvm_get_smmu_info(struct kvm_ppc_smmu_info *info, Error **errp)
> assert(kvm_state != NULL);
>
> if (!kvm_check_extension(kvm_state, KVM_CAP_PPC_GET_SMMU_INFO)) {
> - error_setg(errp, "KVM doesn't expose the MMU features it supports");
> - error_append_hint(errp, "Consider switching to a newer KVM\n");
> + Error *local_err = NULL;
> +
> + error_setg(&local_err, "KVM doesn't expose the MMU features it supports");
> + error_append_hint(&local_err, "Consider switching to a newer KVM\n");
> + error_propagate(errp, local_err);
> return;
> }
>
> @@ -2076,6 +2079,7 @@ void kvmppc_hint_smt_possible(Error **errp)
> int i;
> GString *g;
> char *s;
> + Error *local_err = NULL;
>
> assert(kvm_enabled());
> if (cap_ppc_smt_possible) {
> @@ -2086,12 +2090,13 @@ void kvmppc_hint_smt_possible(Error **errp)
> }
> }
> s = g_string_free(g, false);
> - error_append_hint(errp, "%s.\n", s);
> + error_append_hint(&local_err, "%s.\n", s);
> g_free(s);
> } else {
> - error_append_hint(errp,
> + error_append_hint(&local_err,
> "This KVM seems to be too old to support VSMT.\n");
> }
> + error_propagate(errp, local_err);
> }
>
>
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-09-18 0:15 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 10:20 [Qemu-devel] [PATCH 00/17] Fix usage of error_append_hint() Greg Kurz
2019-09-17 10:20 ` [Qemu-devel] [PATCH 01/17] error: Update error_append_hint()'s documentation Greg Kurz
2019-09-17 11:21 ` Cornelia Huck
2019-09-17 14:36 ` Eric Blake
2019-09-17 10:20 ` [Qemu-devel] [PATCH 02/17] block: Pass local error object pointer to error_append_hint() Greg Kurz
2019-09-17 13:25 ` Vladimir Sementsov-Ogievskiy
2019-09-17 15:37 ` Greg Kurz
2019-09-17 17:40 ` Vladimir Sementsov-Ogievskiy
2019-09-18 7:58 ` Greg Kurz
2019-09-18 10:17 ` Vladimir Sementsov-Ogievskiy
2019-09-17 14:39 ` Eric Blake
2019-09-17 14:46 ` Kevin Wolf
2019-09-17 16:40 ` Greg Kurz
2019-09-17 19:10 ` John Snow
2019-09-18 7:33 ` Kevin Wolf
2019-09-17 10:20 ` [Qemu-devel] [PATCH 03/17] char/spice: " Greg Kurz
2019-09-17 10:20 ` [Qemu-devel] [PATCH 04/17] ppc: " Greg Kurz
2019-09-18 0:12 ` David Gibson [this message]
2019-09-17 10:21 ` [Qemu-devel] [PATCH 05/17] arm: " Greg Kurz
2019-09-17 10:21 ` [Qemu-devel] [PATCH 06/17] vfio: " Greg Kurz
2019-09-17 11:26 ` Cornelia Huck
2019-09-17 10:21 ` [Qemu-devel] [PATCH 07/17] virtio-pci: " Greg Kurz
2019-09-17 10:21 ` [Qemu-devel] [PATCH 08/17] pcie_root_port: " Greg Kurz
2019-09-17 10:21 ` [Qemu-devel] [PATCH 09/17] hw/rdma: Fix missing conversion to rdma_error_report() Greg Kurz
2019-09-17 14:51 ` Yuval Shaia
2019-09-17 16:15 ` Greg Kurz
2019-09-17 10:21 ` [Qemu-devel] [PATCH 10/17] s390x/css: Pass local error object pointer to error_append_hint() Greg Kurz
2019-09-17 11:24 ` Cornelia Huck
2019-09-17 11:44 ` David Hildenbrand
2019-09-17 16:36 ` Greg Kurz
2019-09-18 10:26 ` Cornelia Huck
2019-09-18 17:46 ` Eric Blake
2019-09-19 8:50 ` Cornelia Huck
2019-09-17 10:21 ` [Qemu-devel] [PATCH 11/17] scsi: " Greg Kurz
2019-09-17 10:21 ` [Qemu-devel] [PATCH 12/17] migration: " Greg Kurz
2019-09-17 10:32 ` Dr. David Alan Gilbert
2019-09-17 10:21 ` [Qemu-devel] [PATCH 13/17] nbd: " Greg Kurz
2019-09-17 15:15 ` Eric Blake
2019-09-17 16:26 ` Greg Kurz
2019-09-17 10:21 ` [Qemu-devel] [PATCH 14/17] ccid-card-emul: " Greg Kurz
2019-09-17 10:22 ` [Qemu-devel] [PATCH 15/17] option: " Greg Kurz
2019-09-17 10:22 ` [Qemu-devel] [PATCH 16/17] socket: " Greg Kurz
2019-09-17 10:22 ` [Qemu-devel] [PATCH 17/17] checkpatch: Warn when errp is passed " Greg Kurz
2019-09-17 10:56 ` Philippe Mathieu-Daudé
2019-09-17 11:29 ` Cornelia Huck
2019-09-17 11:47 ` Greg Kurz
2019-09-17 11:00 ` [Qemu-devel] [PATCH 00/17] Fix usage of error_append_hint() Philippe Mathieu-Daudé
2019-09-17 11:45 ` Greg Kurz
2019-09-17 11:49 ` Daniel P. Berrangé
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=20190918001200.GB2440@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=codyprime@gmail.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=farman@linux.ibm.com \
--cc=groug@kaod.org \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@twiddle.net \
--cc=sundeep.lkml@gmail.com \
--cc=yuval.shaia@oracle.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).