Article View: comp.lang.c++
Article #965Re: Consequential RCU
From: Chris M. Thomasson
Date: Sat, 21 Nov 2026 01:09
Date: Sat, 21 Nov 2026 01:09
63 lines
5057 bytes
5057 bytes
On 10/3/2026 5:22 AM, David Brown wrote: > On 02/10/2026 20:11, Chris M. Thomasson wrote: >> On 9/30/2026 12:54 AM, David Brown wrote: >>> On 30/09/2026 01:30, Chris M. Thomasson wrote: >>>> On 9/28/2026 11:40 PM, David Brown wrote: >>> >>>>> gcc inline assembly is a /much/ better solution here. It's okay if >>>>> you don't know how to write it - and it is certainly okay if you >>>>> did not know how to do so a decade ago. But you should understand >>>>> why it is better, and then decide if you are going to learn about it. >>>>> >>>>> (Of course for this particular case, if you can persuade the gcc C+ >>>>> + library folk to make their standard cas16 lock-free, then using >>>>> the standard function is best.) >>>> Difficult to totally disagree with that David. Shit. Its my own >>>> personal problem with the syntax of GCC inline asm. I am a bit >>>> scared of it. Sigh. Clobbers what? When and where? cdecl for the ABI >>>> and externally assembled functions are fine for me, LTO aside for a >>>> moment, can be bad do not go into my asm! BUT. Again. Shit. Its a >>>> personal problem wrt me saying inline bad! Sorry! >>>> >>> >>> Not knowing the syntax for gcc inline assembly is not a "problem" as >>> such - most C programmers never need it. It is just a strong >>> recommendation that /if/ you want to write assembly code, then your >>> results would be much improved by using inline assembly format rather >>> than external assembly functions. And you are already familiar with >>> the hard part, the actual assembly. So don't look at this as a >>> problem of any sort - look at it as a fun, challenging and useful new >>> direction for your existing skills and interests. >>> >>>> Also, if C++ gains a LOCK CMPXCHG16B for a double word, two >>>> contiguous 64 bit words on a 64 bit machine, well GOOD! Show me. I >>>> have had some experiences with it trying to tell me its not lock free. >>> >>> The C++ standard library supports 16 byte compare-and-exchange. The >>> gcc implementation of that library does not use that instruction, and >>> thus does not support lock-free 16 byte compare-and-exchange. C++ >>> has supported this since C++11 - this is a QOI issue, not a language >>> or standard library issue. File an issue on the gcc bugzilla - >>> that's how you get progress (or how we will learn if there are good >>> reasons not to use it.) >>> >> >> I first need to show why its a qoi to begin with. If the arch supports >> a single instruction for a double word atomic rmw op (DWCAS), it >> should be using that instruction. And! it needs to report it as always >> lock-free. Then the user has all the info they need for a fallback to >> asm. Then show a bunch of examples where its needed. But that should >> not be all that hard. Say okay, if the C/C++ does not make this atomic >> RMW lock- free on an arch that supports it, then its useless for >> anything lock- free on said arch. ASM to the rescue? > > The inline asm certainly gives you a way to get efficient use of the > instruction before it is in the toolchain implementation. But the > toolchain implementation is the best long-term solution. So do both - > use the inline asm yourself while encouraging gcc to implement it in > their library for the future. > > Agreed. I need to get past my inline scary shit path. Damnit Chris! Break out of it.
Technical Details
Message-ID:
<11dqr05$3mg9d$2@dont-email.me>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<118f4vv$3plsv$1@dont-email.me> <118mrl9$2j5vk$1@dont-email.me> <118os9o$36ell$1@dont-email.me> <118pp3b$3hhhe$2@dont-email.me> <118r96b$3ubta$1@dont-email.me> <119486r$33haq$1@dont-email.me> <11954k8$3b7ne$1@dont-email.me> <119eqg6$2p6s6$1@dont-email.me> <119fmgv$316ju$2@dont-email.me> <119hhni$3oib4$1@dont-email.me> <119if7r$3vj3j$1@dont-email.me> <119os4f$2bmlo$1@dont-email.me> <119qs1q$306a9$2@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c++ Subject: Re: Consequential RCU Date: Fri, 20 Nov 2026 17:09:24 -0800 Organization: A noiseless patient Spider Lines: 63 Message-ID: <11dqr05$3mg9d$2@dont-email.me> References: <118f4vv$3plsv$1@dont-email.me> <118mrl9$2j5vk$1@dont-email.me> <118os9o$36ell$1@dont-email.me> <118pp3b$3hhhe$2@dont-email.me> <118r96b$3ubta$1@dont-email.me> <119486r$33haq$1@dont-email.me> <11954k8$3b7ne$1@dont-email.me> <119eqg6$2p6s6$1@dont-email.me> <119fmgv$316ju$2@dont-email.me> <119hhni$3oib4$1@dont-email.me> <119if7r$3vj3j$1@dont-email.me> <119os4f$2bmlo$1@dont-email.me> <119qs1q$306a9$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 21 Nov 2026 01:09:26 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3883309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zNUFHbEuTF0SMPEHtUr7ON/upP+b0wmM="; posting-host="693562abaf6a81ac59b0dad544e916f8" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:T8+6uKUrrTHwaoeCmDyPf5DnSWA= sha256:yQFIbw8JMINOne/TJK6b36apl8CsnfLKw64avrAd1K0= sha1:JamD1Rd1HywUb0p0bMO0uilTGhw= sha256:zzabjG9c990SzTHRIu1Kms35eXmJ+FLqVPdPi9+0B5I= Content-Language: en-US In-Reply-To: <119qs1q$306a9$2@dont-email.me>