On Wed, May 24, 2023 at 02:51:50PM +0200, David Marchand wrote: > On Mon, Mar 27, 2023 at 4:30 PM Tyler Retzlaff > <roret...@linux.microsoft.com> wrote: > > > > Replace the use of __sync_<op>_and_fetch and __sync_fetch_and_<op> atomics > > with GCC C11 memory model __atomic builtins. > > > > This series contributes to converging on standard atomics in 23.11 but is > > kept separate as there may be sensitivity to converting from __sync to the > > C11 memory model builtins. > > - Looking at the patches, I thought the conversion was rather straightforward. > But this mention about "sensitivity" stopped me from merging. > Did I miss some risk with the changes of this series? > > > > > > Tyler Retzlaff (3): > > bus/vmbus: use C11 memory model GCC builtin atomics > > crypto/ccp: use C11 memory model GCC builtin atomics > > eal: use C11 memory model GCC builtin atomics > > > > drivers/bus/vmbus/vmbus_channel.c | 2 +- > > drivers/crypto/ccp/ccp_dev.c | 6 ++++-- > > lib/eal/include/generic/rte_atomic.h | 32 ++++++++++++++++---------------- > > 3 files changed, 21 insertions(+), 19 deletions(-) > > > - I noticed that the vhost library has been providing an internal > wrapper for some __sync atomic with older GCC. > Some details are in the commitlog c16915b87109 ("vhost: improve dirty > pages logging performance"). > > Could it affect the existing legacy API performance?
Yes. gcc documents that you can replace __sync_<op> with __atomic_<op> using SEQ_CST ordering. When the __atomic_<op> builtins were initially introduced they generated sub-optimal (you can interpret as slower) codegen relative to the existing __sync_<op> builtins which was fixed in later gcc releases. I do not know the actual version of gcc, but the commit you reference indicates GCC_VERSION < 70100 is that boundary. I (perhaps incorrectly) assumed that if the CI performance tests didn't indicate a regression that the replacement of the remaining and minimal use of the legacy API would have negligable impact. If this is a bad assumption or there are concerns, I could update the series to do the conditional __sync vs __atomic throughout. Let me know how you'd like to proceed. Thanks! > > -- > David Marchand