From: Eric Blake <eblake@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
sheepdog@lists.wpkg.org, kvm@vger.kernel.org,
"David Hildenbrand" <david@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Yuval Shaia" <yuval.shaia.ml@gmail.com>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Alistair Francis" <Alistair.Francis@wdc.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Huacai Chen" <chenhc@lemote.com>, "Jiri Slaby" <jslaby@suse.cz>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Alberto Garcia" <berto@igalia.com>,
"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Juan Quintela" <quintela@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
"Thomas Huth" <thuth@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Stefan Weil" <sw@weilnetz.de>, "Peter Lieven" <pl@kamp.de>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Paul Durrant" <paul@xen.org>,
"Anthony Perard" <anthony.perard@citrix.com>,
qemu-s390x@nongnu.org, qemu-arm@nongnu.org,
"Liu Yuan" <namei.unix@gmail.com>,
qemu-riscv@nongnu.org,
"Sunil Muthuswamy" <sunilmut@microsoft.com>,
"John Snow" <jsnow@redhat.com>,
"Hailiang Zhang" <zhang.zhanghailiang@huawei.com>,
"Richard Henderson" <rth@twiddle.net>,
"Kevin Wolf" <kwolf@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-block@nongnu.org,
"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
"Cornelia Huck" <cohuck@redhat.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Max Reitz" <mreitz@redhat.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
xen-devel@lists.xenproject.org,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH] qemu/atomic.h: prefix qemu_ to solve <stdatomic.h> collisions
Date: Mon, 21 Sep 2020 16:29:10 -0500 [thread overview]
Message-ID: <1ce94412-7a01-9208-31b1-76b7562c3843@redhat.com> (raw)
In-Reply-To: <20200921162346.188997-1-stefanha@redhat.com>
On 9/21/20 11:23 AM, Stefan Hajnoczi wrote:
> clang's C11 atomic_fetch_*() functions only take a C11 atomic type
> pointer argument. QEMU uses direct types (int, etc) and this causes a
> compiler error when a QEMU code calls these functions in a source file
> that also included <stdatomic.h> via a system header file:
>
> $ CC=clang CXX=clang++ ./configure ... && make
> ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
>
> Avoid using atomic_*() names in QEMU's atomic.h since that namespace is
> used by <stdatomic.h>. Prefix QEMU's APIs with qemu_ so that atomic.h
> and <stdatomic.h> can co-exist.
>
> This patch was generated using:
>
> $ git diff | grep -o '\<atomic_[a-z0-9_]\+' | sort -u >/tmp/changed_identifiers
Missing a step in the recipe: namely, you probably modified
include/qemu/atomic*.h prior to running 'git diff' (so that you actually
had input to feed to grep -o). But spelling it 'git diff HEAD^
include/qemu/atomic*.h | ...' does indeed give me a sane list of
identifiers that looks like what you touched in the rest of the patch.
> $ for identifier in $(</tmp/changed_identifiers64); do \
Also not quite the right recipe, based on the file name used in the line
above.
> sed -i "s%\<$identifier\>%qemu_$identifier%" $(git grep -l "\<$identifier\>") \
> done
>
Fortunately, running "git grep -c '\<atomic_[a-z0-9_]\+'" on the
pre-patch state of the tree gives me a list that is somewhat close to
yours, where the obvious difference in line counts is explained by:
> I manually fixed line-wrap issues and misaligned rST tables.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
First, focusing on the change summary:
> docs/devel/lockcnt.txt | 14 +-
> docs/devel/rcu.txt | 40 +--
> accel/tcg/atomic_template.h | 20 +-
> include/block/aio-wait.h | 4 +-
> include/block/aio.h | 8 +-
> include/exec/cpu_ldst.h | 2 +-
> include/exec/exec-all.h | 6 +-
> include/exec/log.h | 6 +-
> include/exec/memory.h | 2 +-
> include/exec/ram_addr.h | 27 +-
> include/exec/ramlist.h | 2 +-
> include/exec/tb-lookup.h | 4 +-
> include/hw/core/cpu.h | 2 +-
> include/qemu/atomic.h | 258 +++++++-------
> include/qemu/atomic128.h | 6 +-
These two are the most important for the sake of this patch; perhaps
it's worth a temporary override of your git orderfile if you have to
respin, to list them first?
> include/qemu/bitops.h | 2 +-
> include/qemu/coroutine.h | 2 +-
> include/qemu/log.h | 6 +-
> include/qemu/queue.h | 8 +-
> include/qemu/rcu.h | 10 +-
> include/qemu/rcu_queue.h | 103 +++---
Presumably, this and any other file with an odd number of changes was
due to a difference in lines after reformatting long lines.
> include/qemu/seqlock.h | 8 +-
...
> util/stats64.c | 34 +-
> docs/devel/atomics.rst | 326 +++++++++---------
> .../opensbi-riscv32-generic-fw_dynamic.elf | Bin 558668 -> 558698 bytes
> .../opensbi-riscv64-generic-fw_dynamic.elf | Bin 620424 -> 620454 bytes
Why are we regenerating .elf files in this patch? Is your change even
correct for those two files?
> scripts/kernel-doc | 2 +-
> tcg/aarch64/tcg-target.c.inc | 2 +-
> tcg/mips/tcg-target.c.inc | 2 +-
> tcg/ppc/tcg-target.c.inc | 6 +-
> tcg/sparc/tcg-target.c.inc | 5 +-
> 135 files changed, 1195 insertions(+), 1130 deletions(-)
I don't spot accel/tcg/atomic_common.c.inc in the list (which declares
functions such as atomic_trace_rmw_pre) - I guess that's intentional
based on how you tried to edit only the identifiers you touched in
include/qemu/atomic*.h.
For the rest of this patch, I only spot-checked in places, trusting the
mechanical nature of this patch, and not spotting anything wrong in the
places I checked. But the two .elf files worry me enough to withhold
R-b. At the same time, because it's big, it will probably be a source
of conflicts if we don't get it in soon, but can also be regenerated (if
your recipe is corrected) without too much difficulty. So I am in favor
of the idea.
> diff --git a/pc-bios/opensbi-riscv32-generic-fw_dynamic.elf b/pc-bios/opensbi-riscv32-generic-fw_dynamic.elf
> index eb9ebf5674d3953ab25de6bf4db134abe904eb20..35b80512446dcf5c49424ae90caacf3c579be1b5 100644
> GIT binary patch
> delta 98
> zcmX@pqx7mrsiB3jg{g(Pg=Gt?!4uZP)ZEhe?LdZ@5QIJ5?Hg+mgxS918!HgAZQt>Y
> ceSHN~X?i|K5fhYsvykI97nHrFhGPaN0Hp#a^8f$<
>
> delta 62
> zcmaFWqjaW6siB3jg{g(Pg=Gt?!ISN#Pguo-rU!guEowjhjTMO5wjck-zP@66bv{QC
> S)Amn=9Jjf)U#j7l!3h9Zj2qGb
>
> diff --git a/pc-bios/opensbi-riscv64-generic-fw_dynamic.elf b/pc-bios/opensbi-riscv64-generic-fw_dynamic.elf
> index 642a64e240d09b2ddb9fc12c74718ae8d386b9d3..9cf2cf23b747cb5be1d3389a0611d8697609c6f8 100644
> GIT binary patch
> delta 102
> zcmeBpue$8LYC{WS3sVbo3(FSPMGsgDQ*%q>w*wh6LJ;=!eV<s1Ak21y&#XYq2E^>!
> e4L)<s&w(mGAJ19D1Z6uWaUSP_vN>`&8@K>*RVYvZ
>
> delta 66
> zcmZ4XUbW-BYC{WS3sVbo3(FSPMGv+wf50juH2uUU)}nU%&#XYq2E^>!?LTwO&)NPs
> Up0kK)dsGtVajxxZxttAL0Np<vJ^%m!
>
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index 030b5c8691..9ec38a1bf1 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -1625,7 +1625,7 @@ sub dump_function($$) {
> # If you mess with these regexps, it's a good idea to check that
> # the following functions' documentation still comes out right:
> # - parport_register_device (function pointer parameters)
> - # - atomic_set (macro)
> + # - qemu_atomic_set (macro)
> # - pci_match_device, __copy_to_user (long return type)
Does the result of sphinx still look good, as mentioned in this comment?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-09-21 21:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 16:23 [PATCH] qemu/atomic.h: prefix qemu_ to solve <stdatomic.h> collisions Stefan Hajnoczi
2020-09-21 20:56 ` no-reply
2020-09-22 8:17 ` Stefan Hajnoczi
2020-09-22 8:33 ` Philippe Mathieu-Daudé
2020-09-21 21:29 ` Eric Blake [this message]
2020-09-22 9:05 ` Stefan Hajnoczi
2020-09-22 6:27 ` Paolo Bonzini
2020-09-22 6:45 ` David Hildenbrand
2020-09-22 6:56 ` Paolo Bonzini
2020-09-22 7:45 ` David Hildenbrand
2020-09-22 8:18 ` Daniel P. Berrangé
2020-09-23 9:14 ` Stefan Hajnoczi
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=1ce94412-7a01-9208-31b1-76b7562c3843@redhat.com \
--to=eblake@redhat.com \
--cc=Alistair.Francis@wdc.com \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=anthony.perard@citrix.com \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=berto@igalia.com \
--cc=borntraeger@de.ibm.com \
--cc=chenhc@lemote.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=fam@euphon.net \
--cc=jasowang@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=jslaby@suse.cz \
--cc=jsnow@redhat.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=laurent@vivier.eu \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=namei.unix@gmail.com \
--cc=palmer@dabbelt.com \
--cc=pasic@linux.ibm.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pl@kamp.de \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@twiddle.net \
--cc=sagark@eecs.berkeley.edu \
--cc=sheepdog@lists.wpkg.org \
--cc=sstabellini@kernel.org \
--cc=stefanha@redhat.com \
--cc=sunilmut@microsoft.com \
--cc=sw@weilnetz.de \
--cc=thuth@redhat.com \
--cc=xen-devel@lists.xenproject.org \
--cc=ysato@users.sourceforge.jp \
--cc=yuval.shaia.ml@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).