🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Chris M. Thomasson Sat, 21 Nov 2026 01:09
Re: Consequential RCU
#965
Author: Chris M. Thomasson
Date: Sat, 21 Nov 2026 01:09
63 lines
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads