[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3] qemu/atomic.h: rename atomic_ to qatomic_
- To: Stefan Hajnoczi <stefanha@xxxxxxxxxx>, qemu-devel@xxxxxxxxxx
- From: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
- Date: Wed, 23 Sep 2020 14:43:52 +0200
- Authentication-results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@xxxxxxxxxx
- Autocrypt: addr=philmd@xxxxxxxxxx; keydata= mQINBDXML8YBEADXCtUkDBKQvNsQA7sDpw6YLE/1tKHwm24A1au9Hfy/OFmkpzo+MD+dYc+7 bvnqWAeGweq2SDq8zbzFZ1gJBd6+e5v1a/UrTxvwBk51yEkadrpRbi+r2bDpTJwXc/uEtYAB GvsTZMtiQVA4kRID1KCdgLa3zztPLCj5H1VZhqZsiGvXa/nMIlhvacRXdbgllPPJ72cLUkXf z1Zu4AkEKpccZaJspmLWGSzGu6UTZ7UfVeR2Hcc2KI9oZB1qthmZ1+PZyGZ/Dy+z+zklC0xl XIpQPmnfy9+/1hj1LzJ+pe3HzEodtlVA+rdttSvA6nmHKIt8Ul6b/h1DFTmUT1lN1WbAGxmg CH1O26cz5nTrzdjoqC/b8PpZiT0kO5MKKgiu5S4PRIxW2+RA4H9nq7nztNZ1Y39bDpzwE5Sp bDHzd5owmLxMLZAINtCtQuRbSOcMjZlg4zohA9TQP9krGIk+qTR+H4CV22sWldSkVtsoTaA2 qNeSJhfHQY0TyQvFbqRsSNIe2gTDzzEQ8itsmdHHE/yzhcCVvlUzXhAT6pIN0OT+cdsTTfif MIcDboys92auTuJ7U+4jWF1+WUaJ8gDL69ThAsu7mGDBbm80P3vvUZ4fQM14NkxOnuGRrJxO qjWNJ2ZUxgyHAh5TCxMLKWZoL5hpnvx3dF3Ti9HW2dsUUWICSQARAQABtDJQaGlsaXBwZSBN YXRoaWV1LURhdWTDqSAoUGhpbCkgPHBoaWxtZEByZWRoYXQuY29tPokCVQQTAQgAPwIbDwYL CQgHAwIGFQgCCQoLBBYCAwECHgECF4AWIQSJweePYB7obIZ0lcuio/1u3q3A3gUCXsfWwAUJ KtymWgAKCRCio/1u3q3A3ircD/9Vjh3aFNJ3uF3hddeoFg1H038wZr/xi8/rX27M1Vj2j9VH 0B8Olp4KUQw/hyO6kUxqkoojmzRpmzvlpZ0cUiZJo2bQIWnvScyHxFCv33kHe+YEIqoJlaQc JfKYlbCoubz+02E2A6bFD9+BvCY0LBbEj5POwyKGiDMjHKCGuzSuDRbCn0Mz4kCa7nFMF5Jv piC+JemRdiBd6102ThqgIsyGEBXuf1sy0QIVyXgaqr9O2b/0VoXpQId7yY7OJuYYxs7kQoXI 6WzSMpmuXGkmfxOgbc/L6YbzB0JOriX0iRClxu4dEUg8Bs2pNnr6huY2Ft+qb41RzCJvvMyu gS32LfN0bTZ6Qm2A8ayMtUQgnwZDSO23OKgQWZVglGliY3ezHZ6lVwC24Vjkmq/2yBSLakZE 6DZUjZzCW1nvtRK05ebyK6tofRsx8xB8pL/kcBb9nCuh70aLR+5cmE41X4O+MVJbwfP5s/RW 9BFSL3qgXuXso/3XuWTQjJJGgKhB6xXjMmb1J4q/h5IuVV4juv1Fem9sfmyrh+Wi5V1IzKI7 RPJ3KVb937eBgSENk53P0gUorwzUcO+ASEo3Z1cBKkJSPigDbeEjVfXQMzNt0oDRzpQqH2vp apo2jHnidWt8BsckuWZpxcZ9+/9obQ55DyVQHGiTN39hkETy3Emdnz1JVHTU0Q==
- Cc: Fam Zheng <fam@xxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, sheepdog@xxxxxxxxxxxxxx, Matthew Rosato <mjrosato@xxxxxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Yuval Shaia <yuval.shaia.ml@xxxxxxxxx>, Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, Alistair Francis <Alistair.Francis@xxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Huacai Chen <chenhc@xxxxxxxxxx>, Eric Blake <eblake@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Alberto Garcia <berto@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, Juan Quintela <quintela@xxxxxxxxxx>, Jiri Slaby <jslaby@xxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>, Halil Pasic <pasic@xxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxx>, Aleksandar Markovic <aleksandar.qemu.devel@xxxxxxxxx>, Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>, Liu Yuan <namei.unix@xxxxxxxxx>, Richard Henderson <rth@xxxxxxxxxxx>, Thomas Huth <thuth@xxxxxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>, Stefan Weil <sw@xxxxxxxxxxx>, Peter Lieven <pl@xxxxxxx>, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx>, qemu-s390x@xxxxxxxxxx, qemu-arm@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, qemu-riscv@xxxxxxxxxx, Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>, John Snow <jsnow@xxxxxxxxxx>, Hailiang Zhang <zhang.zhanghailiang@xxxxxxxxxx>, Kevin Wolf <kwolf@xxxxxxxxxx>, Daniel P. Berrangé <berrange@xxxxxxxxxx>, qemu-block@xxxxxxxxxx, Bastian Koppelmann <kbastian@xxxxxxxxxxxxxxxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, Laurent Vivier <laurent@xxxxxxxxx>, Max Reitz <mreitz@xxxxxxxxxx>, Sagar Karandikar <sagark@xxxxxxxxxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Aleksandar Rikalo <aleksandar.rikalo@xxxxxxxxxx>, Aurelien Jarno <aurelien@xxxxxxxxxxx>
- Delivery-date: Wed, 23 Sep 2020 12:44:13 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 9/23/20 12:56 PM, 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@xxxxxxxxxx>
Reviewed using 'git-diff --color-words'.
Reviewed-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
> ---
> v3:
> * Use qatomic_ instead of atomic_ [Paolo]
> * The diff of my manual fixups is available here:
> https://vmsplice.net/~stefan/atomic-namespace-pre-fixups-v3.diff
> - Dropping #ifndef qatomic_fetch_add in atomic.h
> - atomic_##X(haddr, val) glue macros not caught by grep
> - Keep atomic_add-bench name
> - C preprocessor backslash-newline ('\') column alignment
> - Line wrapping
> v2:
> * The diff of my manual fixups is available here:
> https://vmsplice.net/~stefan/atomic-namespace-pre-fixups.diff
> - Dropping #ifndef qemu_atomic_fetch_add in atomic.h
> - atomic_##X(haddr, val) glue macros not caught by grep
> - Keep atomic_add-bench name
> - C preprocessor backslash-newline ('\') column alignment
> - Line wrapping
> * Use grep -I to avoid accidentally modifying binary files (RISC-V
> OpenSBI ELFs) [Eric Blake]
> * Tweak .gitorder to show atomic.h changes first [Eric Blake]
> * Update grep commands in commit description so reviewers can reproduce
> mechanical changes [Eric Blake]
> ---
|