qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Eric Blake <eblake@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "stefanha@redhat.com" <stefanha@redhat.com>,
	"codyprime@gmail.com" <codyprime@gmail.com>,
	"jan.kiszka@siemens.com" <jan.kiszka@siemens.com>,
	"berto@igalia.com" <berto@igalia.com>,
	"zhang.zhanghailiang@huawei.com" <zhang.zhanghailiang@huawei.com>,
	"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
	"arikalo@wavecomp.com" <arikalo@wavecomp.com>,
	"pasic@linux.ibm.com" <pasic@linux.ibm.com>,
	"hpoussin@reactos.org" <hpoussin@reactos.org>,
	"anthony.perard@citrix.com" <anthony.perard@citrix.com>,
	"samuel.thibault@ens-lyon.org" <samuel.thibault@ens-lyon.org>,
	"philmd@redhat.com" <philmd@redhat.com>,
	"green@moxielogic.com" <green@moxielogic.com>,
	"lvivier@redhat.com" <lvivier@redhat.com>,
	"ehabkost@redhat.com" <ehabkost@redhat.com>,
	"xiechanglong.d@gmail.com" <xiechanglong.d@gmail.com>,
	"pl@kamp.de" <pl@kamp.de>,
	"dgilbert@redhat.com" <dgilbert@redhat.com>,
	"b.galvani@gmail.com" <b.galvani@gmail.com>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
	"ronniesahlberg@gmail.com" <ronniesahlberg@gmail.com>,
	"jsnow@redhat.com" <jsnow@redhat.com>,
	"rth@twiddle.net" <rth@twiddle.net>,
	"kwolf@redhat.com" <kwolf@redhat.com>,
	"andrew@aj.id.au" <andrew@aj.id.au>,
	"crwulff@gmail.com" <crwulff@gmail.com>,
	"sundeep.lkml@gmail.com" <sundeep.lkml@gmail.com>,
	"michael@walle.cc" <michael@walle.cc>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	"kbastian@mail.uni-paderborn.de" <kbastian@mail.uni-paderborn.de>,
	"imammedo@redhat.com" <imammedo@redhat.com>,
	"fam@euphon.net" <fam@euphon.net>,
	"peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"sheepdog@lists.wpkg.org" <sheepdog@lists.wpkg.org>,
	"david@redhat.com" <david@redhat.com>,
	"palmer@sifive.com" <palmer@sifive.com>,
	"thuth@redhat.com" <thuth@redhat.com>,
	"jcmvbkbc@gmail.com" <jcmvbkbc@gmail.com>,
	"hare@suse.com" <hare@suse.com>,
	"sstabellini@kernel.org" <sstabellini@kernel.org>,
	"arei.gonglei@huawei.com" <arei.gonglei@huawei.com>,
	"namei.unix@gmail.com" <namei.unix@gmail.com>,
	"atar4qemu@gmail.com" <atar4qemu@gmail.com>,
	"farman@linux.ibm.com" <farman@linux.ibm.com>,
	"amit@kernel.org" <amit@kernel.org>,
	"sw@weilnetz.de" <sw@weilnetz.de>,
	"groug@kaod.org" <groug@kaod.org>,
	"qemu-s390x@nongnu.org" <qemu-s390x@nongnu.org>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"peter.chubb@nicta.com.au" <peter.chubb@nicta.com.au>,
	"clg@kaod.org" <clg@kaod.org>,
	"shorne@gmail.com" <shorne@gmail.com>,
	"qemu-riscv@nongnu.org" <qemu-riscv@nongnu.org>,
	"cohuck@redhat.com" <cohuck@redhat.com>,
	"amarkovic@wavecomp.com" <amarkovic@wavecomp.com>,
	"aurelien@aurel32.net" <aurelien@aurel32.net>,
	"pburton@wavecomp.com" <pburton@wavecomp.com>,
	"sagark@eecs.berkeley.edu" <sagark@eecs.berkeley.edu>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"kraxel@redhat.com" <kraxel@redhat.com>,
	"edgar.iglesias@gmail.com" <edgar.iglesias@gmail.com>,
	"gxt@mprc.pku.edu.cn" <gxt@mprc.pku.edu.cn>,
	"ari@tuxera.com" <ari@tuxera.com>,
	"quintela@redhat.com" <quintela@redhat.com>,
	"mdroth@linux.vnet.ibm.com" <mdroth@linux.vnet.ibm.com>,
	"lersek@redhat.com" <lersek@redhat.com>,
	"borntraeger@de.ibm.com" <borntraeger@de.ibm.com>,
	"antonynpavlov@gmail.com" <antonynpavlov@gmail.com>,
	"dillaman@redhat.com" <dillaman@redhat.com>,
	"joel@jms.id.au" <joel@jms.id.au>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"integration@gluster.org" <integration@gluster.org>,
	"rjones@redhat.com" <rjones@redhat.com>,
	"Andrew.Baumann@microsoft.com" <Andrew.Baumann@microsoft.com>,
	"mreitz@redhat.com" <mreitz@redhat.com>,
	"walling@linux.ibm.com" <walling@linux.ibm.com>,
	Denis Lunev <den@virtuozzo.com>,
	"mst@redhat.com" <mst@redhat.com>,
	"mark.cave-ayland@ilande.co.uk" <mark.cave-ayland@ilande.co.uk>,
	"v.maffione@gmail.com" <v.maffione@gmail.com>,
	"marex@denx.de" <marex@denx.de>,
	"armbru@redhat.com" <armbru@redhat.com>,
	"marcandre.lureau@redhat.com" <marcandre.lureau@redhat.com>,
	"alistair@alistair23.me" <alistair@alistair23.me>,
	"paul.durrant@citrix.com" <paul.durrant@citrix.com>,
	"pavel.dovgaluk@ispras.ru" <pavel.dovgaluk@ispras.ru>,
	"g.lettieri@iet.unipi.it" <g.lettieri@iet.unipi.it>,
	"rizzo@iet.unipi.it" <rizzo@iet.unipi.it>,
	"david@gibson.dropbear.id.au" <david@gibson.dropbear.id.au>,
	"akrowiak@linux.ibm.com" <akrowiak@linux.ibm.com>,
	"berrange@redhat.com" <berrange@redhat.com>,
	"xiaoguangrong.eric@gmail.com" <xiaoguangrong.eric@gmail.com>,
	"pmorel@linux.ibm.com" <pmorel@linux.ibm.com>,
	"wencongyang2@huawei.com" <wencongyang2@huawei.com>,
	"jcd@tribudubois.net" <jcd@tribudubois.net>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"stefanb@linux.ibm.com" <stefanb@linux.ibm.com>
Subject: Re: [RFC v2 0/9] error: auto propagated local_err
Date: Tue, 24 Sep 2019 14:12:27 +0000	[thread overview]
Message-ID: <84c9e5dd-3e0f-94e1-5da1-2c7baa594bf1@virtuozzo.com> (raw)
In-Reply-To: <d1527fdc-b5e8-093a-9206-6f7ceeece2ac@redhat.com>

23.09.2019 22:47, Eric Blake wrote:
> On 9/23/19 11:12 AM, Vladimir Sementsov-Ogievskiy wrote:
>> Hi all!
>>
>> Here is a proposal of auto propagation for local_err, to not call
>> error_propagate on every exit point, when we deal with local_err.
>>
>> It also fixes two issues:
>> 1. Fix issue with error_fatal & error_append_hint: user can't see these
>> hints, because exit() happens in error_setg earlier than hint is
>> appended. [Reported by Greg Kurz]
>>
>> 2. Fix issue with error_abort & error_propagate: when we wrap
>> error_abort by local_err+error_propagate, resulting coredump will
>> refer to error_propagate and not to the place where error happened.
>> (the macro itself don't fix the issue, but it allows to [3.] drop all
> 
> doesn't
> 
>> local_err+error_propagate pattern, which will definitely fix the issue)
>> [Reported by Kevin Wolf]
>>
>> It's still an RFC, due to the following reasons:
>>
>> 1. I'm new to coccinella, so I failed to do the following pattern:
>>
>>   <...
>> - goto out;
>> + return;
>>   ...>
>> - out:
>> - error_propagate(errp, local_err)
>>
>> So, here is compilation fix 08.. Who can help with it? If nobody, 08 is
>> to be merged to 07 by hand.
> 
> I'm not sure either; but I agree that if we can't figure out how to make
> Coccinelle do quite what we want, that we are better off squashing in
> compile fixes.
> 
> Also, while I like Coccinelle for automating the conversion, it's harder
> to get everyone to run it; it would be nice if we could also figure out
> a patch to scripts/checkpatch.pl that for any instance of 'Error
> **errp)\n{\n' not followed by either } or the new macro, we flag that as
> a checkpatch warning or error.
> 
>>
>> 2. Question about using new macro in empty stub functions - see 09
> 
> It would be nice if we could exempt empty functions - no need to use the
> macro if there is no function body otherwise.  I'm not sure if
> Coccinelle can do that filtering during the conversion, or if we clean
> up by hand after the fact.
> 
>>
>> 3. What to do with huge auto-generated commit 07? Should I split it
>> per-maintainer or per-subsystem, or leave it as-is?
> 
> It's big. I'd split it into multiple patches (and reduce the cc - except
> for the cover letter, the rest of the patches can be limited to the
> actual maintainer/subsystem affected rather than everyone involved
> anywhere else in the series. With the current large cc, anyone that
> replies gets several mail bounces about "too many recipients").  It may
> be easier to split along directory boundaries than by maintainer
> boundaries.  Markus has applied large tree-wide Coccinelle cleanups
> before, maybe he has some advice.


If split by subsystem it would be 200+ patches:
git diff --name-only | while read f; do scripts/get_maintainer.pl -f $f --subsystem --no-rolestats 2>/dev/null | grep -v @ | head -1; done | sort | uniq | wc -l
205


Try to look at larger subsystem:
git diff --name-only | while read f; do scripts/get_maintainer.pl -f $f --subsystem --no-rolestats 2>/dev/null | grep -v @ | tail -2 | head -1; done | sort | uniq | wc -l
139

still too many.. Or is it OK?


> 
>>
>> 4. Also, checkpatch has some complains about 07 patch:
>>    - using tabs.. (hmm exactly stubs functions..)
>>    - empty ifs
>>    Again, I don't see any ways to fix it other that by hand and merge to
>>    07..
> 
> Hand cleanups for formatting or compilation fixes to Coccinelle's work
> is not an uncommon issue after large patches; thankfully it's also not
> very difficult (and surprisingly needed in very few places compared to
> how much actually gets touched).
> 
>>
>> ==================
>>
>> Also, if we decide, that this all is too huge, here is plan B:
>>
>> 1. apply 01
>> 2. fix only functions that don't use local_err and use
>> error_append_hint, by just invocation of new macro at function start -
>> it will substitute Greg's series with no pain.
>> 3[optional]. Do full update for some subsystems, for example, only for
>> block* and nbd*
> 
> Even if we go with plan B, it's still worth checking in a Coccinelle
> script that we can periodically run to make sure we aren't missing out
> on the use of the macro where it is needed.
> 
>>
>> Vladimir Sementsov-Ogievskiy (9):
>>    error: auto propagated local_err
>>    qapi/error: add (Error **errp) cleaning APIs
>>    errp: rename errp to errp_in where it is IN-argument
>>    hw/core/loader-fit: fix freeing errp in fit_load_fdt
>>    net/net: fix local variable shadowing in net_client_init
>>    scripts: add coccinelle script to use auto propagated errp
>>    Use auto-propagated errp
>>    fix-compilation: empty goto
>>    fix-compilation: includes
>>
>>   include/hw/pci-host/spapr.h                   |   2 +
>>   include/monitor/hmp.h                         |   2 +-
>>   include/qapi/error.h                          |  61 ++++-
>>   target/ppc/kvm_ppc.h                          |   3 +
>>   target/s390x/cpu_models.h                     |   3 +
>>   ui/vnc.h                                      |   2 +-
> 
>>   vl.c                                          |  13 +-
>>   scripts/coccinelle/auto-propagated-errp.cocci |  82 +++++++
>>   319 files changed, 2729 insertions(+), 4245 deletions(-)
>>   create mode 100644 scripts/coccinelle/auto-propagated-errp.cocci
> 
> The diffstat is huge, but promising.
> 


-- 
Best regards,
Vladimir

  reply	other threads:[~2019-09-24 15:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-23 16:12 [RFC v2 0/9] error: auto propagated local_err Vladimir Sementsov-Ogievskiy
2019-09-23 16:12 ` [RFC v2 1/9] " Vladimir Sementsov-Ogievskiy
2019-09-23 19:58   ` Eric Blake
2019-09-23 16:12 ` [RFC v2 2/9] qapi/error: add (Error **errp) cleaning APIs Vladimir Sementsov-Ogievskiy
2019-09-23 18:39   ` Eric Blake
2019-09-23 16:12 ` [RFC v2 3/9] errp: rename errp to errp_in where it is IN-argument Vladimir Sementsov-Ogievskiy
2019-09-23 18:35   ` Eric Blake
2019-09-23 16:12 ` [RFC v2 4/9] hw/core/loader-fit: fix freeing errp in fit_load_fdt Vladimir Sementsov-Ogievskiy
2019-09-23 18:41   ` Eric Blake
2019-09-23 16:12 ` [RFC v2 5/9] net/net: fix local variable shadowing in net_client_init Vladimir Sementsov-Ogievskiy
2019-09-23 18:44   ` Eric Blake
2019-09-23 16:12 ` [RFC v2 6/9] scripts: add coccinelle script to use auto propagated errp Vladimir Sementsov-Ogievskiy
2019-09-23 20:05   ` Eric Blake
2019-09-23 21:29     ` Eric Blake
2019-09-24 10:35       ` Vladimir Sementsov-Ogievskiy
2019-09-23 16:12 ` [RFC v2 8/9] fix-compilation: empty goto Vladimir Sementsov-Ogievskiy
2019-09-23 16:12 ` [RFC v2 9/9] fix-compilation: includes Vladimir Sementsov-Ogievskiy
2019-09-23 19:47 ` [RFC v2 0/9] error: auto propagated local_err Eric Blake
2019-09-24 14:12   ` Vladimir Sementsov-Ogievskiy [this message]
2019-09-24 15:28     ` Eric Blake
2019-09-24 15:44       ` Vladimir Sementsov-Ogievskiy
2019-09-24 15:46         ` Vladimir Sementsov-Ogievskiy
2019-09-24 15:49           ` Vladimir Sementsov-Ogievskiy
2019-09-24 16:10             ` Vladimir Sementsov-Ogievskiy
     [not found] ` <20190923161231.22028-8-vsementsov@virtuozzo.com>
2019-09-23 20:30   ` [RFC v2 7/9] Use auto-propagated errp Eric Blake
2019-09-24  7:54     ` Vladimir Sementsov-Ogievskiy

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=84c9e5dd-3e0f-94e1-5da1-2c7baa594bf1@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=Andrew.Baumann@microsoft.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=alistair@alistair23.me \
    --cc=amarkovic@wavecomp.com \
    --cc=amit@kernel.org \
    --cc=andrew@aj.id.au \
    --cc=anthony.perard@citrix.com \
    --cc=antonynpavlov@gmail.com \
    --cc=arei.gonglei@huawei.com \
    --cc=ari@tuxera.com \
    --cc=arikalo@wavecomp.com \
    --cc=armbru@redhat.com \
    --cc=atar4qemu@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=b.galvani@gmail.com \
    --cc=berrange@redhat.com \
    --cc=berto@igalia.com \
    --cc=borntraeger@de.ibm.com \
    --cc=clg@kaod.org \
    --cc=codyprime@gmail.com \
    --cc=cohuck@redhat.com \
    --cc=crwulff@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=den@virtuozzo.com \
    --cc=dgilbert@redhat.com \
    --cc=dillaman@redhat.com \
    --cc=eblake@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=fam@euphon.net \
    --cc=farman@linux.ibm.com \
    --cc=g.lettieri@iet.unipi.it \
    --cc=green@moxielogic.com \
    --cc=groug@kaod.org \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=hare@suse.com \
    --cc=hpoussin@reactos.org \
    --cc=imammedo@redhat.com \
    --cc=integration@gluster.org \
    --cc=jan.kiszka@siemens.com \
    --cc=jasowang@redhat.com \
    --cc=jcd@tribudubois.net \
    --cc=jcmvbkbc@gmail.com \
    --cc=joel@jms.id.au \
    --cc=jsnow@redhat.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lersek@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marex@denx.de \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=michael@walle.cc \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=namei.unix@gmail.com \
    --cc=palmer@sifive.com \
    --cc=pasic@linux.ibm.com \
    --cc=paul.durrant@citrix.com \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=pburton@wavecomp.com \
    --cc=peter.chubb@nicta.com.au \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=pl@kamp.de \
    --cc=pmorel@linux.ibm.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rizzo@iet.unipi.it \
    --cc=rjones@redhat.com \
    --cc=ronniesahlberg@gmail.com \
    --cc=rth@twiddle.net \
    --cc=sagark@eecs.berkeley.edu \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=sheepdog@lists.wpkg.org \
    --cc=shorne@gmail.com \
    --cc=sstabellini@kernel.org \
    --cc=stefanb@linux.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=sundeep.lkml@gmail.com \
    --cc=sw@weilnetz.de \
    --cc=thuth@redhat.com \
    --cc=v.maffione@gmail.com \
    --cc=walling@linux.ibm.com \
    --cc=wencongyang2@huawei.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xiaoguangrong.eric@gmail.com \
    --cc=xiechanglong.d@gmail.com \
    --cc=zhang.zhanghailiang@huawei.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).