[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [RFC v5 024/126] error: auto propagated local_err
- To: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>, Vladimir Sementsov-Ogievskiy <vsementsov@xxxxxxxxxxxxx>
- From: Eric Blake <eblake@xxxxxxxxxx>
- Date: Fri, 8 Nov 2019 16:45:12 -0600
- Cc: Stefan Hajnoczi <stefanha@xxxxxxxxxx>, Jan Kiszka <jan.kiszka@xxxxxxxxxxx>, Hailiang Zhang <zhang.zhanghailiang@xxxxxxxxxx>, "open list:Block layer core" <qemu-block@xxxxxxxxxx>, Aleksandar Rikalo <arikalo@xxxxxxxxxxxx>, Halil Pasic <pasic@xxxxxxxxxxxxx>, Hervé Poussineau <hpoussin@xxxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>, Anthony Green <green@xxxxxxxxxxxxxx>, Laurent Vivier <lvivier@xxxxxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>, Xie Changlong <xiechanglong.d@xxxxxxxxx>, Peter Lieven <pl@xxxxxxx>, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx>, Beniamino Galvani <b.galvani@xxxxxxxxx>, Eric Auger <eric.auger@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>, Richard Henderson <rth@xxxxxxxxxxx>, Kevin Wolf <kwolf@xxxxxxxxxx>, Andrew Jeffery <andrew@xxxxxxxx>, Chris Wulff <crwulff@xxxxxxxxx>, Subbaraya Sundeep <sundeep.lkml@xxxxxxxxx>, Michael Walle <michael@xxxxxxxx>, "open list:sPAPR pseries" <qemu-ppc@xxxxxxxxxx>, Bastian Koppelmann <kbastian@xxxxxxxxxxxxxxxxxxxxx>, Igor Mammedov <imammedo@xxxxxxxxxx>, Fam Zheng <fam@xxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, sheepdog@xxxxxxxxxxxxxx, Matthew Rosato <mjrosato@xxxxxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, "Denis V. Lunev" <den@xxxxxxxxxx>, Hannes Reinecke <hare@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Gonglei \(Arei\)" <arei.gonglei@xxxxxxxxxx>, Liu Yuan <namei.unix@xxxxxxxxx>, Artyom Tarasenko <atar4qemu@xxxxxxxxx>, Thomas Huth <thuth@xxxxxxxxxx>, Amit Shah <amit@xxxxxxxxxx>, Stefan Weil <sw@xxxxxxxxxxx>, Greg Kurz <groug@xxxxxxxx>, Yuval Shaia <yuval.shaia@xxxxxxxxxx>, Qemu-s390x list <qemu-s390x@xxxxxxxxxx>, "open list:ARM" <qemu-arm@xxxxxxxxxx>, Peter Chubb <peter.chubb@xxxxxxxxxxxx>, Cédric Le Goater <clg@xxxxxxxx>, Stafford Horne <shorne@xxxxxxxxx>, qemu-riscv@xxxxxxxxxx, Cornelia Huck <cohuck@xxxxxxxxxx>, Aleksandar Markovic <amarkovic@xxxxxxxxxxxx>, Aurelien Jarno <aurelien@xxxxxxxxxxx>, Paul Burton <pburton@xxxxxxxxxxxx>, Sagar Karandikar <sagark@xxxxxxxxxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Guan Xuetao <gxt@xxxxxxxxxxxxxxx>, Juan Quintela <quintela@xxxxxxxxxx>, Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxx>, Joel Stanley <joel@xxxxxxxxx>, Antony Pavlov <antonynpavlov@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, integration@xxxxxxxxxxx, Laszlo Ersek <lersek@xxxxxxxxxx>, Andrew Baumann <Andrew.Baumann@xxxxxxxxxxxxx>, Max Reitz <mreitz@xxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, QEMU <qemu-devel@xxxxxxxxxx>, Vincenzo Maffione <v.maffione@xxxxxxxxx>, Marek Vasut <marex@xxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Alistair Francis <alistair@xxxxxxxxxxxxx>, Pavel Dovgalyuk <pavel.dovgaluk@xxxxxxxxx>, Giuseppe Lettieri <g.lettieri@xxxxxxxxxxxx>, Luigi Rizzo <rizzo@xxxxxxxxxxxx>, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>, Tony Krowiak <akrowiak@xxxxxxxxxxxxx>, Daniel P. Berrangé <berrange@xxxxxxxxxx>, Xiao Guangrong <xiaoguangrong.eric@xxxxxxxxx>, Pierre Morel <pmorel@xxxxxxxxxxxxx>, Wen Congyang <wencongyang2@xxxxxxxxxx>, Jean-Christophe Dubois <jcd@xxxxxxxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Stefan Berger <stefanb@xxxxxxxxxxxxx>
- Delivery-date: Fri, 08 Nov 2019 22:45:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 11/8/19 3:10 PM, Marc-André Lureau wrote:
+/*
+ * ERRP_AUTO_PROPAGATE
+ *
+ * This macro is created to be the first line of a function with Error **errp
+ * OUT parameter. It's needed only in cases where we want to use error_prepend,
+ * error_append_hint or dereference *errp. It's still safe (but useless) in
+ * other cases.
+ *
+ * If errp is NULL or points to error_fatal, it is rewritten to point to a
+ * local Error object, which will be automatically propagated to the original
+ * errp on function exit (see error_propagator_cleanup).
+ *
+ * After invocation of this macro it is always safe to dereference errp
+ * (as it's not NULL anymore) and to add information (by error_prepend or
+ * error_append_hint)
+ * (as, if it was error_fatal, we swapped it with a local_error to be
+ * propagated on cleanup).
Nice improvements. Minor drawback, the abort()/exit() will now take
place when going out of scope and running the cleanup instead of error
location. Not a big problem I guess.
Your assessment is not quite right:
Any abort() will happen at the leaf node (because we are no longer
wrapping thing into a local err and skipping error_propagate altogether
for &error_abort).
You are correct that any exit() will now happen during cleanup, but that
is an undetectable change (there is no stack trace present for
&error_fatal, so calling error_propagate at a later point in time does
not affect the observable end behavior).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|