[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 13/13] qemu/atomic.h: rename atomic_ to qatomic_
From: |
Andrew Jones |
Subject: |
Re: [PULL 13/13] qemu/atomic.h: rename atomic_ to qatomic_ |
Date: |
Wed, 30 Sep 2020 17:28:05 +0200 |
On Wed, Sep 23, 2020 at 05:10:31PM +0100, 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 'q' so that atomic.h
> and <stdatomic.h> can co-exist. I checked /usr/include on my machine and
> searched GitHub for existing "qatomic_" users but there seem to be none.
>
> This patch was generated using:
>
> $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \
> sort -u >/tmp/changed_identifiers
> $ for identifier in $(</tmp/changed_identifiers); do
> sed -i "s%\<$identifier\>%q$identifier%g" \
> $(git grep -I -l "\<$identifier\>")
> done
>
> I manually fixed line-wrap issues and misaligned rST tables.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
> Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
> ---
> include/qemu/atomic.h | 248 +++++++++---------
> docs/devel/lockcnt.txt | 8 +-
> docs/devel/rcu.txt | 34 +--
> 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 | 26 +-
> include/exec/ramlist.h | 2 +-
> include/exec/tb-lookup.h | 4 +-
> include/hw/core/cpu.h | 2 +-
> include/qemu/atomic128.h | 6 +-
> include/qemu/bitops.h | 2 +-
> include/qemu/coroutine.h | 2 +-
> include/qemu/log.h | 6 +-
> include/qemu/queue.h | 7 +-
> include/qemu/rcu.h | 10 +-
> include/qemu/rcu_queue.h | 100 +++----
> include/qemu/seqlock.h | 8 +-
> include/qemu/stats64.h | 28 +-
> include/qemu/thread.h | 24 +-
> .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h | 14 +-
Hi Stefan,
pvrdma_ring.h is an update-linux-headers.sh file. When running the
script again we lose the atomic_ to qatomic_ renaming. I've hacked
the script by adding
-e 's/\batomic_read/qatomic_read/g;s/\batomic_set/qatomic_set/g'
to the cp_portable() sed command, but only considering the two
qatomic_ functions currently used is obviously not a complete
solution.
Any ideas?
Thanks,
drew
- [PULL 02/13] libvhost-user: handle endianness as mandated by the spec, (continued)
- [PULL 02/13] libvhost-user: handle endianness as mandated by the spec, Stefan Hajnoczi, 2020/09/23
- [PULL 04/13] util/iov: add iov_discard_undo(), Stefan Hajnoczi, 2020/09/23
- [PULL 06/13] virtio-crypto: don't modify elem->in/out_sg, Stefan Hajnoczi, 2020/09/23
- [PULL 07/13] docs/system: clarify deprecation schedule, Stefan Hajnoczi, 2020/09/23
- [PULL 05/13] virtio-blk: undo destructive iov_discard_*() operations, Stefan Hajnoczi, 2020/09/23
- [PULL 08/13] gitmodules: switch to qemu.org qboot mirror, Stefan Hajnoczi, 2020/09/23
- [PULL 11/13] fdmon-poll: reset npfd when upgrading to fdmon-epoll, Stefan Hajnoczi, 2020/09/23
- [PULL 10/13] gitmodules: add qemu.org vbootrom submodule, Stefan Hajnoczi, 2020/09/23
- [PULL 12/13] tests: add test-fdmon-epoll, Stefan Hajnoczi, 2020/09/23
- [PULL 13/13] qemu/atomic.h: rename atomic_ to qatomic_, Stefan Hajnoczi, 2020/09/23
- Re: [PULL 13/13] qemu/atomic.h: rename atomic_ to qatomic_,
Andrew Jones <=
- [PULL 09/13] gitmodules: switch to qemu.org meson mirror, Stefan Hajnoczi, 2020/09/23
- Re: [PULL 00/13] Block patches, no-reply, 2020/09/23
- Re: [PULL 00/13] Block patches, Peter Maydell, 2020/09/25