Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

UNIX is many things to many people, but it's never been everything to anybody.


devel / comp.arch / Re: My older asm...

SubjectAuthor
* My older asm...Chris M. Thomasson
`* Re: My older asm...MitchAlsup
 +- Re: My older asm...Chris M. Thomasson
 `* Re: My older asm...Chris M. Thomasson
  `* Re: My older asm...MitchAlsup
   `* Re: My older asm...Chris M. Thomasson
    `* Re: My older asm...MitchAlsup
     +* Re: My older asm...Chris M. Thomasson
     |+* Re: My older asm...MitchAlsup
     ||`- Re: My older asm...Chris M. Thomasson
     |`* Re: My older asm...Chris M. Thomasson
     | `* Re: My older asm...MitchAlsup
     |  +- Re: My older asm...Chris M. Thomasson
     |  `- Re: My older asm...Chris M. Thomasson
     `* Re: My older asm...Chris M. Thomasson
      `* Re: My older asm...MitchAlsup
       `* Re: My older asm...Chris M. Thomasson
        `* Re: My older asm...MitchAlsup
         +- Re: My older asm...Chris M. Thomasson
         +* Re: My older asm...Chris M. Thomasson
         |`* Re: My older asm...MitchAlsup
         | `* Re: My older asm...Chris M. Thomasson
         |  `* Re: My older asm...MitchAlsup
         |   `- Re: My older asm...Chris M. Thomasson
         `* Re: My older asm...Chris M. Thomasson
          +* Re: My older asm...MitchAlsup
          |`* Re: My older asm...Chris M. Thomasson
          | `* Re: My older asm...MitchAlsup
          |  +- Re: My older asm...Chris M. Thomasson
          |  +* Re: My older asm...Chris M. Thomasson
          |  |`- Re: My older asm...Chris M. Thomasson
          |  `- Re: My older asm...MitchAlsup
          `* Re: My older asm...MitchAlsup
           `* Re: My older asm...Scott Lurndal
            +* Re: My older asm...MitchAlsup
            |`- Re: My older asm...David Brown
            `* Re: My older asm...Chris M. Thomasson
             +* Re: My older asm...MitchAlsup
             |`* Re: My older asm...Chris M. Thomasson
             | +* Re: My older asm...MitchAlsup
             | |`* Re: My older asm...Chris M. Thomasson
             | | `* Re: My older asm...MitchAlsup
             | |  `* Re: My older asm...Chris M. Thomasson
             | |   `* Re: My older asm...MitchAlsup
             | |    `* Re: My older asm...Chris M. Thomasson
             | |     `- Re: My older asm...Chris M. Thomasson
             | `- Re: My older asm...Chris M. Thomasson
             `- Re: My older asm...Chris M. Thomasson

Pages:12
Re: My older asm...

<ul0rd9$23m8p$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35588&group=comp.arch#35588

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Fri, 8 Dec 2023 20:45:28 -0800
Organization: A noiseless patient Spider
Lines: 173
Message-ID: <ul0rd9$23m8p$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<200a7ac3a01378cd13b3357ea61199bb@news.novabbs.com>
<ul0kpn$22svf$2@dont-email.me>
<a3a45fffa1a5d9bfc7aa321538ce67b9@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 9 Dec 2023 04:45:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6a7c294c6cac304dd766112d523acc79";
logging-data="2218265"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19chyPfh+ARd1Y56CIgsARsT2HuXWD0FYg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Usy3qspjtLyJctL61Bl1RVXVxlA=
Content-Language: en-US
In-Reply-To: <a3a45fffa1a5d9bfc7aa321538ce67b9@news.novabbs.com>
 by: Chris M. Thomasson - Sat, 9 Dec 2023 04:45 UTC

On 12/8/2023 8:25 PM, MitchAlsup wrote:
> Chris M. Thomasson wrote:
>
>> On 12/8/2023 2:59 PM, MitchAlsup wrote:
>>> Chris M. Thomasson wrote:
>>>
>>>> On 12/6/2023 7:01 AM, MitchAlsup wrote:
>>>>>
>>>> How about this, C11:
>>>> ____________________________
>>>> #include <stdio.h>
>>>> #include <stdlib.h>
>>>> #include <assert.h>
>>>> #include <stdatomic.h>
>>>
>>>
>>>> struct ct_node
>>>> {
>>>>      struct ct_node* m_next;
>>>> };
>>>
>>>
>>>> int
>>>> main(void)
>>>> {
>>>>      printf("ct_c_atomic_test...nn");
>>>>      fflush(stdout);
>>>
>>>>      {
>>>>          _Atomic(struct ct_node*) shared = NULL;
>>>
>>>>          struct ct_node local = { NULL };
>>>
>>>>          struct ct_node* result_0 = atomic_exchange(&shared, &local);
>>>
>>>>          assert(!result_0);
>>>
>>>>          struct ct_node* result_1 = atomic_exchange(&shared, NULL);
>>>
>>>>          assert(result_1 == &local);
>>>>      }
>>>
>>>>      printf("completed!nn");
>>>
>>>>      return 0;
>>>> }
>>>> ____________________________
>>>
>>>> ?
>>>
>>>
>>> It should be approximately::
>>>
>>> main:
>>>      ENTER        R0,R0,#16
>>>      LEA        R1,#"ct_c_atomic_test...nn"    //
>>> printf("ct_c_atomic_test...nn");
>>>      CALL        printf
>>>      MOV        R1,#1            // fflush(stdout);
>>>      CALL        fflush
>>>
>>>      MOV        R2,#0            // shared       = NULL;    //
>>> pointer = 0; ?!?
>>>      ST        R2,[SP,8]        // local.m_next = NULL;
>>>                          // for the life of me I can't see why the
>>>                          // below code does not just SIGSEGV.
>>> //..............................................// But I ignore
>>> that.....
>
>> Actually, I am wondering why you "seem" think that it would have any
>> chance of SIGSEGV? The atomic exchanges are legit, all the memory
>> references are legit, no problem. Akin to, pseudo-code:
>> _________________
>> atomic<word*> shared = nullptr;
>> word local = 123;
>> word* x = shared.exchange(&local);
>> assert(x == nullptr);
>> word* y = shared.exchange(nullptr);
>> assert(y == &local);
>> _________________
>
> Why does _Atomic(struct ct_node*) shared = NULL; not set the shared
> pointer to zero (NULL) ?? Apparently you are setting something at where
> it is pointing to NULL; so how does shared get to be a pointer to
> something ??
>
>> Iirc, keep in mind that default membar is seq_cst in C/C++11. Unless I
>> foobar'ed it, it looks fine to me. :^)
>
>
>>>      ADD        R5,SP,#8        // &local;
>>>      LD        R3,[R2].lock        // atomic_exchange(&shared
>>>      ST        R5,[R2].lock        // atomic_exchange(&shared  =
>>> &local);
>>> //    ST        R3,[SP,8]        // local = atomic_exchange();    //
>>> dead
>>>
>>>      BEQ0        R3,assert1        // assert(!result_0);
>>>
>>>                          // NULL = atomic_exchange(); is dead
>>>      LD        R3,[R2].lock        // atomic_exchange(&shared
>>>      ST        #0,[R2].lock        // atomic_exchange(&shared  =  NULL);
>>>                          // R4 = result_1
>>>
>>>                          // R5 already has &[sp+8]
>>>      CMP        R4,R3,R5        // assert(result_1 == &local);
>>>                          // last use R5, R3, R2
>>>      BEQ        R4,assert2
>>>
>>>      LEA        R1,#"completed!nn"    // printf("completed!nn");
>>>      CALL        printf
>>>      MOV        R1,#0            // return 0;
>>>      EXIT        R0,R0,#16
>
>
>> Ahhh! I need to examine this. Fwiw, MSVC has C11 atomic, but no
>> threads. What fun! ;^o
>
> You will find My 66000 ATOMICs to be a lot thinner that competing ISAs.
>
> I looked at ARM ASM for this and ARM has converted the LD.lock;ST.lock
> into a test-and-test-and-set loop. esm has automagic looping if there
> is no interference check (BI), so::
>
>      LD        R3,[R2].lock
> // long number of cycles achieving sequential consistency and the value
> // to be delivered to a register
>      ST        R5,[R2[.lock    ---   // must fail
>                                   |   // automagically
>      LD        R3,[r2].lock  <----/   // try again
> // fewer cycles
>      ST        R5,[R2[.lock           // greater chance of success
>
> If interference is detected making ST.lock unperformable, then control
> reverts to the LD.lock. Now, we are already sequentially consistent
> so the LD is performed and made visible externally with intent to write.
>
> Oh, and BTW: this adds no state that across context switches--all
> context switches cause the event to fail and control reverts to the
> control point prior to context switching.
>
> If you really do want test-and-test-and-set functionality::
>
> Label:
>      LD        R3,[R2]
>      BC        some_condition,R3,Label
>      LD        R3,[R2].lock
>      ST        R5,[R2[.lock
>
>
>> Afaict, PellesC has full C11 atomics, threads and membars.

First of all, think of a simple atomic exchange, ala RMW, LOCK XCHG wrt
x86, fine... The atomic shared thing here is the word*:

word* shared = nullptr;

Okay, the shared pointer is equal to nullptr.

Lets create a local word:

word local = 123;

This local word is equal to 123.

Lets LOCK XCHG them:

word* previous = atomic_exchange(&shared, &local);

previous better damn well equal nullptr, and shared better be a pointer
to local!

See?

Re: My older asm...

<ul12ui$24go6$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35590&group=comp.arch#35590

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.niel.me!news.gegeweb.eu!gegeweb.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Fri, 8 Dec 2023 22:54:09 -0800
Organization: A noiseless patient Spider
Lines: 167
Message-ID: <ul12ui$24go6$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<200a7ac3a01378cd13b3357ea61199bb@news.novabbs.com>
<ul0kpn$22svf$2@dont-email.me>
<a3a45fffa1a5d9bfc7aa321538ce67b9@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 9 Dec 2023 06:54:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6a7c294c6cac304dd766112d523acc79";
logging-data="2245382"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YR/JJXvT097D2ZKpRUnpVguWNYM9fDQI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ufSm0getIod1ayw4bzMiSaVyG6o=
Content-Language: en-US
In-Reply-To: <a3a45fffa1a5d9bfc7aa321538ce67b9@news.novabbs.com>
 by: Chris M. Thomasson - Sat, 9 Dec 2023 06:54 UTC

On 12/8/2023 8:25 PM, MitchAlsup wrote:
> Chris M. Thomasson wrote:
>
>> On 12/8/2023 2:59 PM, MitchAlsup wrote:
>>> Chris M. Thomasson wrote:
>>>
>>>> On 12/6/2023 7:01 AM, MitchAlsup wrote:
>>>>>
>>>> How about this, C11:
>>>> ____________________________
>>>> #include <stdio.h>
>>>> #include <stdlib.h>
>>>> #include <assert.h>
>>>> #include <stdatomic.h>
>>>
>>>
>>>> struct ct_node
>>>> {
>>>>      struct ct_node* m_next;
>>>> };
>>>
>>>
>>>> int
>>>> main(void)
>>>> {
>>>>      printf("ct_c_atomic_test...nn");
>>>>      fflush(stdout);
>>>
>>>>      {
>>>>          _Atomic(struct ct_node*) shared = NULL;
>>>
>>>>          struct ct_node local = { NULL };
>>>
>>>>          struct ct_node* result_0 = atomic_exchange(&shared, &local);
>>>
>>>>          assert(!result_0);
>>>
>>>>          struct ct_node* result_1 = atomic_exchange(&shared, NULL);
>>>
>>>>          assert(result_1 == &local);
>>>>      }
>>>
>>>>      printf("completed!nn");
>>>
>>>>      return 0;
>>>> }
>>>> ____________________________
>>>
>>>> ?
>>>
>>>
>>> It should be approximately::
>>>
>>> main:
>>>      ENTER        R0,R0,#16
>>>      LEA        R1,#"ct_c_atomic_test...nn"    //
>>> printf("ct_c_atomic_test...nn");
>>>      CALL        printf
>>>      MOV        R1,#1            // fflush(stdout);
>>>      CALL        fflush
>>>
>>>      MOV        R2,#0            // shared       = NULL;    //
>>> pointer = 0; ?!?
>>>      ST        R2,[SP,8]        // local.m_next = NULL;
>>>                          // for the life of me I can't see why the
>>>                          // below code does not just SIGSEGV.
>>> //..............................................// But I ignore
>>> that.....
>
>> Actually, I am wondering why you "seem" think that it would have any
>> chance of SIGSEGV? The atomic exchanges are legit, all the memory
>> references are legit, no problem. Akin to, pseudo-code:
>> _________________
>> atomic<word*> shared = nullptr;
>> word local = 123;
>> word* x = shared.exchange(&local);
>> assert(x == nullptr);
>> word* y = shared.exchange(nullptr);
>> assert(y == &local);
>> _________________
>
> Why does _Atomic(struct ct_node*) shared = NULL; not set the shared
> pointer to zero (NULL) ?? Apparently you are setting something at where
> it is pointing to NULL; so how does shared get to be a pointer to
> something ??
>
>> Iirc, keep in mind that default membar is seq_cst in C/C++11. Unless I
>> foobar'ed it, it looks fine to me. :^)
>
>
>>>      ADD        R5,SP,#8        // &local;
>>>      LD        R3,[R2].lock        // atomic_exchange(&shared
>>>      ST        R5,[R2].lock        // atomic_exchange(&shared  =

Humm... Okay, lets start small here... How would you code up
atomic_exchange all by itself, as a standalone function?

say an atomic type would be say, word*:

So, atomic_exchange would be:

word* atomic_exchange(word**, word*)

as a prototype where atomic_exchange is analogous to the RMW in x86 aka
LOCK XCHG. What would that function alone look like in your system?

>>> &local);
>>> //    ST        R3,[SP,8]        // local = atomic_exchange();    //
>>> dead
>>>
>>>      BEQ0        R3,assert1        // assert(!result_0);
>>>
>>>                          // NULL = atomic_exchange(); is dead
>>>      LD        R3,[R2].lock        // atomic_exchange(&shared
>>>      ST        #0,[R2].lock        // atomic_exchange(&shared  =  NULL);
>>>                          // R4 = result_1
>>>
>>>                          // R5 already has &[sp+8]
>>>      CMP        R4,R3,R5        // assert(result_1 == &local);
>>>                          // last use R5, R3, R2
>>>      BEQ        R4,assert2
>>>
>>>      LEA        R1,#"completed!nn"    // printf("completed!nn");
>>>      CALL        printf
>>>      MOV        R1,#0            // return 0;
>>>      EXIT        R0,R0,#16
>
>
>> Ahhh! I need to examine this. Fwiw, MSVC has C11 atomic, but no
>> threads. What fun! ;^o
>
> You will find My 66000 ATOMICs to be a lot thinner that competing ISAs.
>
> I looked at ARM ASM for this and ARM has converted the LD.lock;ST.lock
> into a test-and-test-and-set loop. esm has automagic looping if there
> is no interference check (BI), so::
>
>      LD        R3,[R2].lock
> // long number of cycles achieving sequential consistency and the value
> // to be delivered to a register
>      ST        R5,[R2[.lock    ---   // must fail
>                                   |   // automagically
>      LD        R3,[r2].lock  <----/   // try again
> // fewer cycles
>      ST        R5,[R2[.lock           // greater chance of success
>
> If interference is detected making ST.lock unperformable, then control
> reverts to the LD.lock. Now, we are already sequentially consistent
> so the LD is performed and made visible externally with intent to write.
>
> Oh, and BTW: this adds no state that across context switches--all
> context switches cause the event to fail and control reverts to the
> control point prior to context switching.
>
> If you really do want test-and-test-and-set functionality::
>
> Label:
>      LD        R3,[R2]
>      BC        some_condition,R3,Label
>      LD        R3,[R2].lock
>      ST        R5,[R2[.lock
>
>
>> Afaict, PellesC has full C11 atomics, threads and membars.

Re: My older asm...

<ul138d$24go6$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35591&group=comp.arch#35591

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Fri, 8 Dec 2023 22:59:24 -0800
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <ul138d$24go6$2@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<200a7ac3a01378cd13b3357ea61199bb@news.novabbs.com>
<ul0kpn$22svf$2@dont-email.me>
<a3a45fffa1a5d9bfc7aa321538ce67b9@news.novabbs.com>
<ul12ui$24go6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 9 Dec 2023 06:59:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6a7c294c6cac304dd766112d523acc79";
logging-data="2245382"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HfJsFQMh2Q/S262ugHGVzzmdfigXSdas="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:YHy9QLAXOm1nhfKTPU1RNBrwy+8=
Content-Language: en-US
In-Reply-To: <ul12ui$24go6$1@dont-email.me>
 by: Chris M. Thomasson - Sat, 9 Dec 2023 06:59 UTC

On 12/8/2023 10:54 PM, Chris M. Thomasson wrote:
> On 12/8/2023 8:25 PM, MitchAlsup wrote:
>> Chris M. Thomasson wrote:
[...]

Code up the function atomic_exchange, then my code works in your system
as is. That is one easy way to start... ;^)

Re: My older asm...

<23fba3be17ace619e18f31b6db632cc1@news.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35615&group=comp.arch#35615

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!.POSTED!not-for-mail
From: mitchalsup@aol.com (MitchAlsup)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Sat, 9 Dec 2023 22:12:14 +0000
Organization: novaBBS
Message-ID: <23fba3be17ace619e18f31b6db632cc1@news.novabbs.com>
References: <ukh485$2o9j8$1@dont-email.me> <d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com> <ukm9mk$3psll$1@dont-email.me> <c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com> <uko3ts$d3uq$1@dont-email.me> <66615d1bbbede14f0f631be2edce46c1@news.novabbs.com> <ukof2k$el2l$3@dont-email.me> <b640f72952e7f89acccd592ff0546f95@news.novabbs.com> <ukomlg$jgsk$1@dont-email.me> <d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com> <uku1o3$1k0ki$1@dont-email.me> <200a7ac3a01378cd13b3357ea61199bb@news.novabbs.com> <ul0kpn$22svf$2@dont-email.me> <a3a45fffa1a5d9bfc7aa321538ce67b9@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="3598234"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on novalink.us
X-Rslight-Site: $2y$10$yQdniCnmX0cL9hXixTJd2emPfxzl3cR5EiLWABZLFO0js8uqDbAHu
X-Rslight-Posting-User: 7e9c45bcd6d4757c5904fbe9a694742e6f8aa949
 by: MitchAlsup - Sat, 9 Dec 2023 22:12 UTC

MitchAlsup wrote:

> Chris M. Thomasson wrote:

Having written::

>     LD        R3,[R2].lock
> // long number of cycles achieving sequential consistency and the value
> // to be delivered to a register
> ST R5,[R2[.lock --- // must fail
> | // automagically
> LD R3,[r2].lock <----/ // try again
> // fewer cycles
> ST R5,[R2[.lock // greater chance of success

It occurs to me that the magic control transfer to LD.lock arrives
with the notion the previous ATOMIC event has failed and that this
second execution of LD.lock should simply wait for the cache line
{as if performing a LD without the .lock and without the attempt to
obtain write permission, and when the cache line arrives, chase it
with a Coherent Invalidate:: performing the test-and-test-and-set
paradigm without actually encoding the paradigm in instructions}.

This should eliminate most of the desire for test-and-test-and-set
explicitly in the instruction stream.

> If you really do want test-and-test-and-set functionality::

> Label:
>     LD        R3,[R2]
>     BC some_condition,R3,Label
>     LD        R3,[R2].lock
> ST R5,[R2[.lock

Re: My older asm...

<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35639&group=comp.arch#35639

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!.POSTED!not-for-mail
From: mitchalsup@aol.com (MitchAlsup)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Sun, 10 Dec 2023 17:04:48 +0000
Organization: novaBBS
Message-ID: <cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
References: <ukh485$2o9j8$1@dont-email.me> <d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com> <ukm9mk$3psll$1@dont-email.me> <c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com> <uko3ts$d3uq$1@dont-email.me> <66615d1bbbede14f0f631be2edce46c1@news.novabbs.com> <ukof2k$el2l$3@dont-email.me> <b640f72952e7f89acccd592ff0546f95@news.novabbs.com> <ukomlg$jgsk$1@dont-email.me> <d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com> <uku1o3$1k0ki$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="3682476"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on novalink.us
X-Rslight-Posting-User: 7e9c45bcd6d4757c5904fbe9a694742e6f8aa949
X-Rslight-Site: $2y$10$XQqAwjYT1r6uc5wOWIui1OTY9iDnWBoqHb.4JDdCUJxyNLfyKELk6
 by: MitchAlsup - Sun, 10 Dec 2023 17:04 UTC

Chris M. Thomasson wrote:

>

> How about this, C11:
> ____________________________
> #include <stdio.h>
> #include <stdlib.h>
> #include <assert.h>
> #include <stdatomic.h>

Can you provide a reference to stdatomic.h that discusses how the functions are
supposed to work at the HW level rather than at the SW level.

Re: My older asm...

<bVodN.4192$6ePe.1084@fx42.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35652&group=comp.arch#35652

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx42.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: My older asm...
Newsgroups: comp.arch
References: <ukh485$2o9j8$1@dont-email.me> <d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com> <ukm9mk$3psll$1@dont-email.me> <c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com> <uko3ts$d3uq$1@dont-email.me> <66615d1bbbede14f0f631be2edce46c1@news.novabbs.com> <ukof2k$el2l$3@dont-email.me> <b640f72952e7f89acccd592ff0546f95@news.novabbs.com> <ukomlg$jgsk$1@dont-email.me> <d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com> <uku1o3$1k0ki$1@dont-email.me> <cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
Lines: 26
Message-ID: <bVodN.4192$6ePe.1084@fx42.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sun, 10 Dec 2023 20:08:39 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sun, 10 Dec 2023 20:08:39 GMT
X-Received-Bytes: 1760
 by: Scott Lurndal - Sun, 10 Dec 2023 20:08 UTC

mitchalsup@aol.com (MitchAlsup) writes:
>Chris M. Thomasson wrote:
>
>>
>
>> How about this, C11:
>> ____________________________
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <assert.h>
>> #include <stdatomic.h>
>
>Can you provide a reference to stdatomic.h that discusses how the functions are
>supposed to work at the HW level rather than at the SW level.

As I understand it, such a reference doesn't exist. The C++ standard
simply defines the guarantees the application can expect from the
implementation (compiler + OS).

The C11/C++11 Standard language version is here:

https://en.cppreference.com/w/cpp/header/stdatomic.h

GCC's version:

https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

Re: My older asm...

<ac000dae3a5f008e6e3ce9194021065f@news.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35661&group=comp.arch#35661

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!.POSTED!not-for-mail
From: mitchalsup@aol.com (MitchAlsup)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Sun, 10 Dec 2023 22:58:28 +0000
Organization: novaBBS
Message-ID: <ac000dae3a5f008e6e3ce9194021065f@news.novabbs.com>
References: <ukh485$2o9j8$1@dont-email.me> <d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com> <ukm9mk$3psll$1@dont-email.me> <c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com> <uko3ts$d3uq$1@dont-email.me> <66615d1bbbede14f0f631be2edce46c1@news.novabbs.com> <ukof2k$el2l$3@dont-email.me> <b640f72952e7f89acccd592ff0546f95@news.novabbs.com> <ukomlg$jgsk$1@dont-email.me> <d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com> <uku1o3$1k0ki$1@dont-email.me> <cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com> <bVodN.4192$6ePe.1084@fx42.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="3709804"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Site: $2y$10$WnIq7F2Z36bqPDyEk0qFFev8l.tSZ31SqbZmF319MLFuQe6y858by
X-Rslight-Posting-User: 7e9c45bcd6d4757c5904fbe9a694742e6f8aa949
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on novalink.us
 by: MitchAlsup - Sun, 10 Dec 2023 22:58 UTC

Scott Lurndal wrote:

> mitchalsup@aol.com (MitchAlsup) writes:
>>Chris M. Thomasson wrote:
>>
>>>
>>
>>> How about this, C11:
>>> ____________________________
>>> #include <stdio.h>
>>> #include <stdlib.h>
>>> #include <assert.h>
>>> #include <stdatomic.h>
>>
>>Can you provide a reference to stdatomic.h that discusses how the functions are
>>supposed to work at the HW level rather than at the SW level.

> As I understand it, such a reference doesn't exist. The C++ standard
> simply defines the guarantees the application can expect from the
> implementation (compiler + OS).

> The C11/C++11 Standard language version is here:

> https://en.cppreference.com/w/cpp/header/stdatomic.h

> GCC's version:

> https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

This one is much better.

Re: My older asm...

<ul5kc0$2s1vm$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35662&group=comp.arch#35662

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Sun, 10 Dec 2023 16:15:58 -0800
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <ul5kc0$2s1vm$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
<bVodN.4192$6ePe.1084@fx42.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 11 Dec 2023 00:16:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f85488f35b589dd6d4f770d631a69169";
logging-data="3016694"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lrSwXPBOVJymn9tLv0gIV9k4aJhgFC+I="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:nj4qHDzlmeuzKvk8BHvBuexQuzE=
Content-Language: en-US
In-Reply-To: <bVodN.4192$6ePe.1084@fx42.iad>
 by: Chris M. Thomasson - Mon, 11 Dec 2023 00:15 UTC

On 12/10/2023 12:08 PM, Scott Lurndal wrote:
> mitchalsup@aol.com (MitchAlsup) writes:
>> Chris M. Thomasson wrote:
>>
>>>
>>
>>> How about this, C11:
>>> ____________________________
>>> #include <stdio.h>
>>> #include <stdlib.h>
>>> #include <assert.h>
>>> #include <stdatomic.h>
>>
>> Can you provide a reference to stdatomic.h that discusses how the functions are
>> supposed to work at the HW level rather than at the SW level.
>
> As I understand it, such a reference doesn't exist.

I think so. An atomic exchange can be implemented with an atomic RMW
exchange (LOCK XCHG), CAS (cmpxchg), or even LL/SC.

> The C++ standard
> simply defines the guarantees the application can expect from the
> implementation (compiler + OS).
>
> The C11/C++11 Standard language version is here:
>
> https://en.cppreference.com/w/cpp/header/stdatomic.h
>
> GCC's version:
>
> https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

Re: My older asm...

<12141d3c2157bdfa471976b35586fb91@news.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35664&group=comp.arch#35664

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!.POSTED!not-for-mail
From: mitchalsup@aol.com (MitchAlsup)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Mon, 11 Dec 2023 00:30:57 +0000
Organization: novaBBS
Message-ID: <12141d3c2157bdfa471976b35586fb91@news.novabbs.com>
References: <ukh485$2o9j8$1@dont-email.me> <d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com> <ukm9mk$3psll$1@dont-email.me> <c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com> <uko3ts$d3uq$1@dont-email.me> <66615d1bbbede14f0f631be2edce46c1@news.novabbs.com> <ukof2k$el2l$3@dont-email.me> <b640f72952e7f89acccd592ff0546f95@news.novabbs.com> <ukomlg$jgsk$1@dont-email.me> <d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com> <uku1o3$1k0ki$1@dont-email.me> <cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com> <bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="3715820"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Site: $2y$10$ycoHKgRNIyp.5OHds4wnW.6suTw2UJNQElYiq1PcGUA2PnAeYsHli
X-Rslight-Posting-User: 7e9c45bcd6d4757c5904fbe9a694742e6f8aa949
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on novalink.us
 by: MitchAlsup - Mon, 11 Dec 2023 00:30 UTC

Chris M. Thomasson wrote:

> On 12/10/2023 12:08 PM, Scott Lurndal wrote:
>> mitchalsup@aol.com (MitchAlsup) writes:
>>> Chris M. Thomasson wrote:
>>>
>>>>
>>>
>>>> How about this, C11:
>>>> ____________________________
>>>> #include <stdio.h>
>>>> #include <stdlib.h>
>>>> #include <assert.h>
>>>> #include <stdatomic.h>
>>>
>>> Can you provide a reference to stdatomic.h that discusses how the functions are
>>> supposed to work at the HW level rather than at the SW level.
>>
>> As I understand it, such a reference doesn't exist.

> I think so. An atomic exchange can be implemented with an atomic RMW
> exchange (LOCK XCHG), CAS (cmpxchg), or even LL/SC.

More like::

An Atomic Exchange has to reach a point of sequential consistency (which
may entail a MEMBAR on machines with relaxed memory ordering) before
the address of the exchanged container is made visible to the system.
The exchange is performed in such a way that the stored value is visible
to the system prior to any other access to that container is made visible
to the system (this may also require an MEMBAR on systems with relaxed
memory orderings.)

>> The C++ standard
>> simply defines the guarantees the application can expect from the
>> implementation (compiler + OS).
>>
>> The C11/C++11 Standard language version is here:
>>
>> https://en.cppreference.com/w/cpp/header/stdatomic.h
>>
>> GCC's version:
>>
>> https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

Re: My older asm...

<ul5m7u$2sd1v$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35665&group=comp.arch#35665

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Sun, 10 Dec 2023 16:47:56 -0800
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <ul5m7u$2sd1v$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
<bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 11 Dec 2023 00:47:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f85488f35b589dd6d4f770d631a69169";
logging-data="3028031"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UT+nb4Ssyp186ZwsluTWvhKGR1Oo81/w="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:0Qnvg531N9M4aFAlzwrGUtYLbRo=
Content-Language: en-US
In-Reply-To: <ul5kc0$2s1vm$1@dont-email.me>
 by: Chris M. Thomasson - Mon, 11 Dec 2023 00:47 UTC

On 12/10/2023 4:15 PM, Chris M. Thomasson wrote:
> On 12/10/2023 12:08 PM, Scott Lurndal wrote:
>> mitchalsup@aol.com (MitchAlsup) writes:
>>> Chris M. Thomasson wrote:
>>>
>>>>
>>>
>>>> How about this, C11:
>>>> ____________________________
>>>> #include <stdio.h>
>>>> #include <stdlib.h>
>>>> #include <assert.h>
>>>> #include <stdatomic.h>
>>>
>>> Can you provide a reference to stdatomic.h that discusses how the
>>> functions are
>>> supposed to work at the HW level rather than at the SW level.
>>
>> As I understand it, such a reference doesn't exist.
>
> I think so. An atomic exchange can be implemented with an atomic RMW
> exchange (LOCK XCHG), CAS (cmpxchg), or even LL/SC.
[...]

Also, fwiw, atomic exchange can be implemented using various hashed
locking schemes. This would require is_lock_free to return false:

https://cplusplus.com/reference/atomic/atomic/is_lock_free/

Re: My older asm...

<ul5md6$2sd1v$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35666&group=comp.arch#35666

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Sun, 10 Dec 2023 16:50:45 -0800
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <ul5md6$2sd1v$2@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
<bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me>
<12141d3c2157bdfa471976b35586fb91@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 11 Dec 2023 00:50:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f85488f35b589dd6d4f770d631a69169";
logging-data="3028031"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fphT/McZuahubFMdZezjmq0wxkXHl82c="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Qp/rWOFlmQ76gBKuki/KtkQSMNA=
In-Reply-To: <12141d3c2157bdfa471976b35586fb91@news.novabbs.com>
Content-Language: en-US
 by: Chris M. Thomasson - Mon, 11 Dec 2023 00:50 UTC

On 12/10/2023 4:30 PM, MitchAlsup wrote:
> Chris M. Thomasson wrote:
>
>> On 12/10/2023 12:08 PM, Scott Lurndal wrote:
>>> mitchalsup@aol.com (MitchAlsup) writes:
>>>> Chris M. Thomasson wrote:
>>>>
>>>>>
>>>>
>>>>> How about this, C11:
>>>>> ____________________________
>>>>> #include <stdio.h>
>>>>> #include <stdlib.h>
>>>>> #include <assert.h>
>>>>> #include <stdatomic.h>
>>>>
>>>> Can you provide a reference to stdatomic.h that discusses how the
>>>> functions are
>>>> supposed to work at the HW level rather than at the SW level.
>>>
>>> As I understand it, such a reference doesn't exist.
>
>> I think so. An atomic exchange can be implemented with an atomic RMW
>> exchange (LOCK XCHG), CAS (cmpxchg), or even LL/SC.
>
> More like::
>
> An Atomic Exchange has to reach a point of sequential consistency (which
> may entail a MEMBAR on machines with relaxed memory ordering) before
> the address of the exchanged container is made visible to the system.

Not really... Atomic exchange can be implemented in relaxed form wrt no
memory barriers in sight. Just as long as it does its job, an atomic
swap. On the SPARC I had to decorate atomic exchange with the correct
membars to get the job done. The weakest I could get away with...

> The exchange is performed in such a way that the stored value is visible
> to the system prior to any other access to that container is made visible
> to the system (this may also require an MEMBAR on systems with relaxed
> memory orderings.)

>
>>> The C++ standard
>>> simply defines the guarantees the application can expect from the
>>> implementation (compiler + OS).
>>>
>>> The C11/C++11 Standard language version is here:
>>>
>>> https://en.cppreference.com/w/cpp/header/stdatomic.h
>>>
>>> GCC's version:
>>>
>>> https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

Re: My older asm...

<0b4d710a65c113e7c9e5e594fc6767a8@news.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35667&group=comp.arch#35667

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!.POSTED!not-for-mail
From: mitchalsup@aol.com (MitchAlsup)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Mon, 11 Dec 2023 01:20:49 +0000
Organization: novaBBS
Message-ID: <0b4d710a65c113e7c9e5e594fc6767a8@news.novabbs.com>
References: <ukh485$2o9j8$1@dont-email.me> <d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com> <ukm9mk$3psll$1@dont-email.me> <c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com> <uko3ts$d3uq$1@dont-email.me> <66615d1bbbede14f0f631be2edce46c1@news.novabbs.com> <ukof2k$el2l$3@dont-email.me> <b640f72952e7f89acccd592ff0546f95@news.novabbs.com> <ukomlg$jgsk$1@dont-email.me> <d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com> <uku1o3$1k0ki$1@dont-email.me> <cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com> <bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me> <12141d3c2157bdfa471976b35586fb91@news.novabbs.com> <ul5md6$2sd1v$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="3719349"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Site: $2y$10$xiOXK7ookeUk2tEAALl7D.9nJ6PHt.cfQxEywK07KqfGhme25lsw6
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on novalink.us
X-Rslight-Posting-User: 7e9c45bcd6d4757c5904fbe9a694742e6f8aa949
 by: MitchAlsup - Mon, 11 Dec 2023 01:20 UTC

Chris M. Thomasson wrote:

> On 12/10/2023 4:30 PM, MitchAlsup wrote:
>> Chris M. Thomasson wrote:
>>
>>> On 12/10/2023 12:08 PM, Scott Lurndal wrote:
>>>> mitchalsup@aol.com (MitchAlsup) writes:
>>>>> Chris M. Thomasson wrote:
>>>>>
>>>>>>
>>>>>
>>>>>> How about this, C11:
>>>>>> ____________________________
>>>>>> #include <stdio.h>
>>>>>> #include <stdlib.h>
>>>>>> #include <assert.h>
>>>>>> #include <stdatomic.h>
>>>>>
>>>>> Can you provide a reference to stdatomic.h that discusses how the
>>>>> functions are
>>>>> supposed to work at the HW level rather than at the SW level.
>>>>
>>>> As I understand it, such a reference doesn't exist.
>>
>>> I think so. An atomic exchange can be implemented with an atomic RMW
>>> exchange (LOCK XCHG), CAS (cmpxchg), or even LL/SC.
>>
>> More like::
>>
>> An Atomic Exchange has to reach a point of sequential consistency (which
>> may entail a MEMBAR on machines with relaxed memory ordering) before
>> the address of the exchanged container is made visible to the system.

> Not really... Atomic exchange can be implemented in relaxed form wrt no
> memory barriers in sight. Just as long as it does its job, an atomic
> swap. On the SPARC I had to decorate atomic exchange with the correct
> membars to get the job done. The weakest I could get away with...

Ok, then write the paragraph I tried to write with sufficient detail that
a CPU designer, who knows nothing of software, can read but cannot misunderstand.
Fit all necessary sequencing, barriers, timing, ... needed such that any CPU
sequence designer will achieve a successful atomic_exchange over all his
(or her !) designs.

>> The exchange is performed in such a way that the stored value is visible
>> to the system prior to any other access to that container is made visible
>> to the system (this may also require an MEMBAR on systems with relaxed
>> memory orderings.)

>>
>>>> The C++ standard
>>>> simply defines the guarantees the application can expect from the
>>>> implementation (compiler + OS).
>>>>
>>>> The C11/C++11 Standard language version is here:
>>>>
>>>> https://en.cppreference.com/w/cpp/header/stdatomic.h
>>>>
>>>> GCC's version:
>>>>
>>>> https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

Re: My older asm...

<ul5o6u$2smnm$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35668&group=comp.arch#35668

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Sun, 10 Dec 2023 17:21:33 -0800
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <ul5o6u$2smnm$2@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
<bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me>
<12141d3c2157bdfa471976b35586fb91@news.novabbs.com>
<ul5md6$2sd1v$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 11 Dec 2023 01:21:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f85488f35b589dd6d4f770d631a69169";
logging-data="3037942"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19V22kR9fhMQppZvgRqyHskXuDh+nDFulo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:1rDOAYXQx5S4wdHnWuARPkNh+1E=
Content-Language: en-US
In-Reply-To: <ul5md6$2sd1v$2@dont-email.me>
 by: Chris M. Thomasson - Mon, 11 Dec 2023 01:21 UTC

On 12/10/2023 4:50 PM, Chris M. Thomasson wrote:
> On 12/10/2023 4:30 PM, MitchAlsup wrote:
>> Chris M. Thomasson wrote:
>>
>>> On 12/10/2023 12:08 PM, Scott Lurndal wrote:
>>>> mitchalsup@aol.com (MitchAlsup) writes:
>>>>> Chris M. Thomasson wrote:
>>>>>
>>>>>>
>>>>>
>>>>>> How about this, C11:
>>>>>> ____________________________
>>>>>> #include <stdio.h>
>>>>>> #include <stdlib.h>
>>>>>> #include <assert.h>
>>>>>> #include <stdatomic.h>
>>>>>
>>>>> Can you provide a reference to stdatomic.h that discusses how the
>>>>> functions are
>>>>> supposed to work at the HW level rather than at the SW level.
>>>>
>>>> As I understand it, such a reference doesn't exist.
>>
>>> I think so. An atomic exchange can be implemented with an atomic RMW
>>> exchange (LOCK XCHG), CAS (cmpxchg), or even LL/SC.
>>
>> More like::
>>
>> An Atomic Exchange has to reach a point of sequential consistency (which
>> may entail a MEMBAR on machines with relaxed memory ordering) before
>> the address of the exchanged container is made visible to the system.
>
> Not really... Atomic exchange can be implemented in relaxed form wrt no
> memory barriers in sight. Just as long as it does its job, an atomic
> swap. On the SPARC I had to decorate atomic exchange with the correct
> membars to get the job done.

I should say I had to use the most relaxed membar scheme I could wrt the
requirements of the lock/wait free algorithm I was working with,
creating, ect... naked atomic exchange is a real thing. Naked in the
sense of no implied membars!

> The weakest I could get away with...
>
>
>
>
>> The exchange is performed in such a way that the stored value is visible
>> to the system prior to any other access to that container is made visible
>> to the system (this may also require an MEMBAR on systems with relaxed
>> memory orderings.)
>
>
>
>
>>
>>>> The C++ standard
>>>> simply defines the guarantees the application can expect from the
>>>> implementation (compiler + OS).
>>>>
>>>> The C11/C++11 Standard language version is here:
>>>>
>>>> https://en.cppreference.com/w/cpp/header/stdatomic.h
>>>>
>>>> GCC's version:
>>>>
>>>> https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
>

Re: My older asm...

<ul5q0k$2ss4e$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35669&group=comp.arch#35669

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Sun, 10 Dec 2023 17:52:19 -0800
Organization: A noiseless patient Spider
Lines: 98
Message-ID: <ul5q0k$2ss4e$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
<bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me>
<12141d3c2157bdfa471976b35586fb91@news.novabbs.com>
<ul5md6$2sd1v$2@dont-email.me>
<0b4d710a65c113e7c9e5e594fc6767a8@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 11 Dec 2023 01:52:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f85488f35b589dd6d4f770d631a69169";
logging-data="3043470"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/aJ32byHk0huHgDQoYRxcrqDc0tCuIuBU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:jvfMN6Fe5hlZWbXJXQqFcv8SvgQ=
Content-Language: en-US
In-Reply-To: <0b4d710a65c113e7c9e5e594fc6767a8@news.novabbs.com>
 by: Chris M. Thomasson - Mon, 11 Dec 2023 01:52 UTC

On 12/10/2023 5:20 PM, MitchAlsup wrote:
> Chris M. Thomasson wrote:
>
>> On 12/10/2023 4:30 PM, MitchAlsup wrote:
>>> Chris M. Thomasson wrote:
>>>
>>>> On 12/10/2023 12:08 PM, Scott Lurndal wrote:
>>>>> mitchalsup@aol.com (MitchAlsup) writes:
>>>>>> Chris M. Thomasson wrote:
>>>>>>
>>>>>>>
>>>>>>
>>>>>>> How about this, C11:
>>>>>>> ____________________________
>>>>>>> #include <stdio.h>
>>>>>>> #include <stdlib.h>
>>>>>>> #include <assert.h>
>>>>>>> #include <stdatomic.h>
>>>>>>
>>>>>> Can you provide a reference to stdatomic.h that discusses how the
>>>>>> functions are
>>>>>> supposed to work at the HW level rather than at the SW level.
>>>>>
>>>>> As I understand it, such a reference doesn't exist.
>>>
>>>> I think so. An atomic exchange can be implemented with an atomic RMW
>>>> exchange (LOCK XCHG), CAS (cmpxchg), or even LL/SC.
>>>
>>> More like::
>>>
>>> An Atomic Exchange has to reach a point of sequential consistency (which
>>> may entail a MEMBAR on machines with relaxed memory ordering) before
>>> the address of the exchanged container is made visible to the system.
>
>> Not really... Atomic exchange can be implemented in relaxed form wrt
>> no memory barriers in sight. Just as long as it does its job, an
>> atomic swap. On the SPARC I had to decorate atomic exchange with the
>> correct membars to get the job done. The weakest I could get away with...
>
> Ok, then write the paragraph I tried to write with sufficient detail that
> a CPU designer, who knows nothing of software, can read but cannot
> misunderstand.
> Fit all necessary sequencing, barriers, timing, ... needed such that any
> CPU
> sequence designer will achieve a successful atomic_exchange over all his
> (or her !) designs.
>
>>> The exchange is performed in such a way that the stored value is visible
>>> to the system prior to any other access to that container is made
>>> visible
>>> to the system (this may also require an MEMBAR on systems with relaxed
>>> memory orderings.)

Think of different ways to implement LOCK XCHG. Two come to mind, a
pessimistic lock based scheme, ala intel, or a more opportunistic method
akin to LL/SC?

lock based version, pseudo code typed in the newsreader, hope I did not
make a damn mistake:
______________________________
word*
atomic_exchange(
word** origin,
word* xchg
){
hash_lock(origin);

// RMW
word* original = *origin;
*origin = xchg;

hash_unlock(origin);

return original;
} ______________________________

That is one way to do it using a hashed locking scheme.

>
>
>
>
>>>
>>>>> The C++ standard
>>>>> simply defines the guarantees the application can expect from the
>>>>> implementation (compiler + OS).
>>>>>
>>>>> The C11/C++11 Standard language version is here:
>>>>>
>>>>> https://en.cppreference.com/w/cpp/header/stdatomic.h
>>>>>
>>>>> GCC's version:
>>>>>
>>>>> https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

Re: My older asm...

<ul6jjv$33r6g$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35675&group=comp.arch#35675

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Mon, 11 Dec 2023 10:09:18 +0100
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <ul6jjv$33r6g$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
<bVodN.4192$6ePe.1084@fx42.iad>
<ac000dae3a5f008e6e3ce9194021065f@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Dec 2023 09:09:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0053e6c971fc74cbc6c57cd130b61b3a";
logging-data="3271888"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ds7Y+PjqVwu9e111dCJgVzQ/3z9JuWy4="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:wnx9e0jca0BZRtccxyPqRIFnIOc=
Content-Language: en-GB
In-Reply-To: <ac000dae3a5f008e6e3ce9194021065f@news.novabbs.com>
 by: David Brown - Mon, 11 Dec 2023 09:09 UTC

On 10/12/2023 23:58, MitchAlsup wrote:
> Scott Lurndal wrote:
>
>> mitchalsup@aol.com (MitchAlsup) writes:
>>> Chris M. Thomasson wrote:
>>>
>>>>
>>>
>>>> How about this, C11:
>>>> ____________________________
>>>> #include <stdio.h>
>>>> #include <stdlib.h>
>>>> #include <assert.h>
>>>> #include <stdatomic.h>
>>>
>>> Can you provide a reference to stdatomic.h that discusses how the
>>> functions are
>>> supposed to work at the HW level rather than at the SW level.
>
>> As I understand it, such a reference doesn't exist.   The C++ standard
>> simply defines the guarantees the application can expect from the
>> implementation (compiler + OS).
>
>> The C11/C++11 Standard language version is here:
>
>> https://en.cppreference.com/w/cpp/header/stdatomic.h
>
>> GCC's version:
>
>> https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
>
> This one is much better.

Other links that might be of use or interest from gcc include:

<https://gcc.gnu.org/wiki/MemoryModel>
<https://gcc.gnu.org/wiki/Atomic/GCCMM>
<https://gcc.gnu.org/wiki/Atomic/C11>
<https://gcc.gnu.org/wiki/Atomic>
<https://gcc.gnu.org/wiki/Atomic/GCCMM/Optimizations>

<https://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html>

Re: My older asm...

<0d8c6e4956f3b43c4eb91dd8c20620a0@news.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35745&group=comp.arch#35745

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!.POSTED!not-for-mail
From: mitchalsup@aol.com (MitchAlsup)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Thu, 14 Dec 2023 20:55:35 +0000
Organization: novaBBS
Message-ID: <0d8c6e4956f3b43c4eb91dd8c20620a0@news.novabbs.com>
References: <ukh485$2o9j8$1@dont-email.me> <d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com> <ukm9mk$3psll$1@dont-email.me> <c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com> <uko3ts$d3uq$1@dont-email.me> <66615d1bbbede14f0f631be2edce46c1@news.novabbs.com> <ukof2k$el2l$3@dont-email.me> <b640f72952e7f89acccd592ff0546f95@news.novabbs.com> <ukomlg$jgsk$1@dont-email.me> <d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com> <uku1o3$1k0ki$1@dont-email.me> <cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com> <bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me> <12141d3c2157bdfa471976b35586fb91@news.novabbs.com> <ul5md6$2sd1v$2@dont-email.me> <0b4d710a65c113e7c9e5e594fc6767a8@news.novabbs.com> <ul5q0k$2ss4e$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="4125769"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Site: $2y$10$z9PplW0yycIN93QkGfIm1ui39xxxRCsMpcgOLlFEQhNDwY64Nx5ge
X-Rslight-Posting-User: 7e9c45bcd6d4757c5904fbe9a694742e6f8aa949
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on novalink.us
 by: MitchAlsup - Thu, 14 Dec 2023 20:55 UTC

Chris M. Thomasson wrote:

> On 12/10/2023 5:20 PM, MitchAlsup wrote:
>>
> ______________________________
> word*
> atomic_exchange(
> word** origin,
> word* xchg
> ){
> hash_lock(origin);

> // RMW
> word* original = *origin;
> *origin = xchg;

> hash_unlock(origin);

> return original;
> }
> ______________________________

As written, and assuming hash_lock() and hash_unlock are function calls
that guarentee the atomicity of the exchange::

atomic_exchange:
ENTER R28,R0,#24
MOV R30,R1
MOV R29,R2

CALL hash_lock

LD R28,[R30]
ST R29,[R30

MOV R1,R30
CALL hash_unlock

MOV R1,R28
EXIT R28,R0,#24

But I suspect that hash_{[un]lock} is not a function call but a macro
that offsets into the structure and performs a LL while un performs
the SC. Here is an example where we do not even use the value in the
addressed memory container, but simply monitor the cache line for
interference; In which case we get::

atomic_exchange:
PRE #19,[R1+lock].lock

LD R3,[R1]
ST R2,[R1]

PUSH #3,[R1+lock].lock

MOV R1,R3
RET

If interference is detected, control automagically reverts to PRE
#19 specifies Write permission and L1 cache.

The PUSH #3 does not change the value in the location, just releases
the lock and leaves the line in L1 cache. Interference is detected
when some other resource requests write permission {and is at higher
priority}.

Let us see how interference plays out::

atomic_exchange:

PRE #19,[R1+lock].lock // control-point = .
LD R3,[R1]
ST R2,[R1]
{ repeat
PUSH #3,[R1+lock].lock -fails----
| // IP = control-point
PRE #19,[R1+lock].lock -arrives-/

LD R3,[R1]
ST R2,[R1]
} any numbers of times
PUSH #3,[R1+lock].lock -succ----
|
MOV R1,R3 -arrives-/
RET
_____________________________________________________________________

By majority vote, the .lock notation is being retired and the Lock
designation is obtained by concattenating an L on the end of the
memory reference nmemonic::

LDmem Rd,[Rb...].lock
becomes:
LDmemL Rd,[Rb...]
etcetera.

Re: My older asm...

<ulgdko$1kf4i$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35747&group=comp.arch#35747

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Thu, 14 Dec 2023 18:28:39 -0800
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <ulgdko$1kf4i$2@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
<bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me>
<12141d3c2157bdfa471976b35586fb91@news.novabbs.com>
<ul5md6$2sd1v$2@dont-email.me>
<0b4d710a65c113e7c9e5e594fc6767a8@news.novabbs.com>
<ul5q0k$2ss4e$1@dont-email.me>
<0d8c6e4956f3b43c4eb91dd8c20620a0@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 15 Dec 2023 02:28:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="513d149cab1ad625e0aa2a5d5251a9a6";
logging-data="1719442"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18TqwcqV9E+aE2szqdtPOxuEp61oRVOjoM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:dQ10Gids+vvzUIVZMQD37+L4kdo=
In-Reply-To: <0d8c6e4956f3b43c4eb91dd8c20620a0@news.novabbs.com>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 15 Dec 2023 02:28 UTC

On 12/14/2023 12:55 PM, MitchAlsup wrote:
> Chris M. Thomasson wrote:
>
>> On 12/10/2023 5:20 PM, MitchAlsup wrote:
>>>
>> ______________________________
>> word*
>> atomic_exchange(
>>    word** origin,
>>    word* xchg
>> ){
>>     hash_lock(origin);
>
>>       // RMW
>>       word* original = *origin;
>>       *origin = xchg;
>
>>     hash_unlock(origin);
>
>>     return original;
>> }
>> ______________________________
>
> As written, and assuming hash_lock() and hash_unlock are function calls
> that guarentee the atomicity of the exchange::
[...]

Fwiw, my example of atomic exchange using locking is taking into account
one of my previous experiments that hashes addresses into indexes into a
mutex table. The mutex table is completely separated from the user logic.

https://groups.google.com/g/comp.lang.c++/c/sV4WC_cBb9Q/m/5JRwvhpVCAAJ
(read all)

This is one way to implement C++ atomics using locks! This would require
me to report that the impl is not lock-free vis is_lock_free and some
other places.

Now, this is a locked version. The wait free version on x86 would be
LOCK XCHG.

Re: My older asm...

<5fa1a1a99167e355a78c465111f5e323@news.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35750&group=comp.arch#35750

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!.POSTED!not-for-mail
From: mitchalsup@aol.com (MitchAlsup)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Fri, 15 Dec 2023 04:15:21 +0000
Organization: novaBBS
Message-ID: <5fa1a1a99167e355a78c465111f5e323@news.novabbs.com>
References: <ukh485$2o9j8$1@dont-email.me> <d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com> <ukm9mk$3psll$1@dont-email.me> <c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com> <uko3ts$d3uq$1@dont-email.me> <66615d1bbbede14f0f631be2edce46c1@news.novabbs.com> <ukof2k$el2l$3@dont-email.me> <b640f72952e7f89acccd592ff0546f95@news.novabbs.com> <ukomlg$jgsk$1@dont-email.me> <d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com> <uku1o3$1k0ki$1@dont-email.me> <cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com> <bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me> <12141d3c2157bdfa471976b35586fb91@news.novabbs.com> <ul5md6$2sd1v$2@dont-email.me> <0b4d710a65c113e7c9e5e594fc6767a8@news.novabbs.com> <ul5q0k$2ss4e$1@dont-email.me> <0d8c6e4956f3b43c4eb91dd8c20620a0@news.novabbs.com> <ulgdko$1kf4i$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="4155266"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Posting-User: 7e9c45bcd6d4757c5904fbe9a694742e6f8aa949
X-Rslight-Site: $2y$10$tecorRcDTQDPs0cCzNS4z.dkfyWec53bhGEATfdmBl4GmJ.RNS.HC
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on novalink.us
 by: MitchAlsup - Fri, 15 Dec 2023 04:15 UTC

Chris M. Thomasson wrote:

> On 12/14/2023 12:55 PM, MitchAlsup wrote:
>> Chris M. Thomasson wrote:
>>
>>> On 12/10/2023 5:20 PM, MitchAlsup wrote:
>>>>
>>> ______________________________
>>> word*
>>> atomic_exchange(
>>>    word** origin,
>>>    word* xchg
>>> ){
>>>     hash_lock(origin);
>>
>>>       // RMW
>>>       word* original = *origin;
>>>       *origin = xchg;
>>
>>>     hash_unlock(origin);
>>
>>>     return original;
>>> }
>>> ______________________________
>>
>> As written, and assuming hash_lock() and hash_unlock are function calls
>> that guarentee the atomicity of the exchange::
> [...]

> Fwiw, my example of atomic exchange using locking is taking into account
> one of my previous experiments that hashes addresses into indexes into a
> mutex table. The mutex table is completely separated from the user logic.

> https://groups.google.com/g/comp.lang.c++/c/sV4WC_cBb9Q/m/5JRwvhpVCAAJ
> (read all)

> This is one way to implement C++ atomics using locks! This would require
> me to report that the impl is not lock-free vis is_lock_free and some
> other places.

So would you assign the # define ATOMIC_BOOL_LOCK_FREE a 1 (sometimes lock
free) or 2 (always lock free) or 0 (not lock free)

> Now, this is a locked version. The wait free version on x86 would be
> LOCK XCHG.

Re: My older asm...

<ulgmdi$1pc5c$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35751&group=comp.arch#35751

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Thu, 14 Dec 2023 20:58:24 -0800
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <ulgmdi$1pc5c$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
<bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me>
<12141d3c2157bdfa471976b35586fb91@news.novabbs.com>
<ul5md6$2sd1v$2@dont-email.me>
<0b4d710a65c113e7c9e5e594fc6767a8@news.novabbs.com>
<ul5q0k$2ss4e$1@dont-email.me>
<0d8c6e4956f3b43c4eb91dd8c20620a0@news.novabbs.com>
<ulgdko$1kf4i$2@dont-email.me>
<5fa1a1a99167e355a78c465111f5e323@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 15 Dec 2023 04:58:26 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="513d149cab1ad625e0aa2a5d5251a9a6";
logging-data="1880236"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+E9GehgjI1fyuSDLZY+PRkQwgz7dqeKVo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Gk0Nu6WctfyQ86kELM3GxfYdDuI=
In-Reply-To: <5fa1a1a99167e355a78c465111f5e323@news.novabbs.com>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 15 Dec 2023 04:58 UTC

On 12/14/2023 8:15 PM, MitchAlsup wrote:
> Chris M. Thomasson wrote:
>
>> On 12/14/2023 12:55 PM, MitchAlsup wrote:
>>> Chris M. Thomasson wrote:
>>>
>>>> On 12/10/2023 5:20 PM, MitchAlsup wrote:
>>>>>
>>>> ______________________________
>>>> word*
>>>> atomic_exchange(
>>>>    word** origin,
>>>>    word* xchg
>>>> ){
>>>>     hash_lock(origin);
>>>
>>>>       // RMW
>>>>       word* original = *origin;
>>>>       *origin = xchg;
>>>
>>>>     hash_unlock(origin);
>>>
>>>>     return original;
>>>> }
>>>> ______________________________
>>>
>>> As written, and assuming hash_lock() and hash_unlock are function calls
>>> that guarentee the atomicity of the exchange::
>> [...]
>
>> Fwiw, my example of atomic exchange using locking is taking into
>> account one of my previous experiments that hashes addresses into
>> indexes into a mutex table. The mutex table is completely separated
>> from the user logic.
>
>> https://groups.google.com/g/comp.lang.c++/c/sV4WC_cBb9Q/m/5JRwvhpVCAAJ
>> (read all)
>
>> This is one way to implement C++ atomics using locks! This would
>> require me to report that the impl is not lock-free vis is_lock_free
>> and some other places.
>
> So would you assign the # define ATOMIC_BOOL_LOCK_FREE a 1 (sometimes
> lock free) or 2 (always lock free) or 0 (not lock free)

Good question Mitch! :^)

I would simply have to set it to 0 simply because it is using one my
hash locking schemes wrt the context, it is not lock-free. Sometimes
lock-free can be potentially an "adaptive" lock-free algo, that strives
to be lock-free but can "choose" to block in the kernel during certain
times... The lock-free has its mind set on trying to avoid the kernel.
However, since it can potentially hit a path that goes into a kernel
wait, well, sometimes lock-free can be in order.... This would be
sometimes lock-free. However, if you want to use it in a signal handler,
it better damn well be 100% lock-free, at least! Wait-free fine, ect...

>
>> Now, this is a locked version. The wait free version on x86 would be
>> LOCK XCHG.

Re: My older asm...

<ulgmf2$1pfi7$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35752&group=comp.arch#35752

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Thu, 14 Dec 2023 20:59:12 -0800
Organization: A noiseless patient Spider
Lines: 69
Message-ID: <ulgmf2$1pfi7$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<uku1o3$1k0ki$1@dont-email.me>
<cc353bff9be3d7fb6c9f8404f1a31248@news.novabbs.com>
<bVodN.4192$6ePe.1084@fx42.iad> <ul5kc0$2s1vm$1@dont-email.me>
<12141d3c2157bdfa471976b35586fb91@news.novabbs.com>
<ul5md6$2sd1v$2@dont-email.me>
<0b4d710a65c113e7c9e5e594fc6767a8@news.novabbs.com>
<ul5q0k$2ss4e$1@dont-email.me>
<0d8c6e4956f3b43c4eb91dd8c20620a0@news.novabbs.com>
<ulgdko$1kf4i$2@dont-email.me>
<5fa1a1a99167e355a78c465111f5e323@news.novabbs.com>
<ulgmdi$1pc5c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 15 Dec 2023 04:59:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="513d149cab1ad625e0aa2a5d5251a9a6";
logging-data="1883719"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dJuCzl9B7Uu89yEU1LrhbB+Tr/0j/vpU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:sbkgBn7kHcBUaoc76Ue7o6C6iN0=
Content-Language: en-US
In-Reply-To: <ulgmdi$1pc5c$1@dont-email.me>
 by: Chris M. Thomasson - Fri, 15 Dec 2023 04:59 UTC

On 12/14/2023 8:58 PM, Chris M. Thomasson wrote:
> On 12/14/2023 8:15 PM, MitchAlsup wrote:
>> Chris M. Thomasson wrote:
>>
>>> On 12/14/2023 12:55 PM, MitchAlsup wrote:
>>>> Chris M. Thomasson wrote:
>>>>
>>>>> On 12/10/2023 5:20 PM, MitchAlsup wrote:
>>>>>>
>>>>> ______________________________
>>>>> word*
>>>>> atomic_exchange(
>>>>>    word** origin,
>>>>>    word* xchg
>>>>> ){
>>>>>     hash_lock(origin);
>>>>
>>>>>       // RMW
>>>>>       word* original = *origin;
>>>>>       *origin = xchg;
>>>>
>>>>>     hash_unlock(origin);
>>>>
>>>>>     return original;
>>>>> }
>>>>> ______________________________
>>>>
>>>> As written, and assuming hash_lock() and hash_unlock are function calls
>>>> that guarentee the atomicity of the exchange::
>>> [...]
>>
>>> Fwiw, my example of atomic exchange using locking is taking into
>>> account one of my previous experiments that hashes addresses into
>>> indexes into a mutex table. The mutex table is completely separated
>>> from the user logic.
>>
>>> https://groups.google.com/g/comp.lang.c++/c/sV4WC_cBb9Q/m/5JRwvhpVCAAJ
>>> (read all)
>>
>>> This is one way to implement C++ atomics using locks! This would
>>> require me to report that the impl is not lock-free vis is_lock_free
>>> and some other places.
>>
>> So would you assign the # define ATOMIC_BOOL_LOCK_FREE a 1 (sometimes
>> lock free) or 2 (always lock free) or 0 (not lock free)
>
> Good question Mitch! :^)
>
> I would simply have to set it to 0 simply because it is using one my
> hash locking schemes wrt the context, it is not lock-free. Sometimes
> lock-free can be potentially an "adaptive" lock-free algo, that strives
> to be lock-free but can "choose" to block in the kernel during certain
> times... The lock-free has its mind set on trying to avoid the kernel.
> However, since it can potentially hit a path that goes into a kernel
> wait, well, sometimes lock-free can be in order.... This would be
> sometimes lock-free. However, if you want to use it in a signal handler,
> it better damn well be 100% lock-free, at least! Wait-free fine, ect...
>
>>
>>> Now, this is a locked version. The wait free version on x86 would be
>>> LOCK XCHG.
>

Striving for lock/wait-free instead of blocking in the kernel! Well, I
got my set on that!

https://youtu.be/6ZwjdGSqO0k

:^)

Re: My older asm...

<ulgp8o$1pia0$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35753&group=comp.arch#35753

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Thu, 14 Dec 2023 21:47:03 -0800
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <ulgp8o$1pia0$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<ukr8nu$103hq$1@dont-email.me>
<631b41c8a19abfa0961117b8a29b5969@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 15 Dec 2023 05:47:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="513d149cab1ad625e0aa2a5d5251a9a6";
logging-data="1886528"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ls50APknRLFzqGjnO7EoudSdaDoO43qU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:+LBjDbFchQZu2/XZEZ9WHKXIDBE=
In-Reply-To: <631b41c8a19abfa0961117b8a29b5969@news.novabbs.com>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 15 Dec 2023 05:47 UTC

On 12/6/2023 7:29 PM, MitchAlsup wrote:
> Chris M. Thomasson wrote:
>
>> On 12/6/2023 7:01 AM, MitchAlsup wrote:
>>> Chris M. Thomasson wrote:
>>>
>>>> On 12/5/2023 6:21 PM, MitchAlsup wrote:
>>>>> Chris M. Thomasson wrote:
>>>>>
>>>>>> On 12/5/2023 3:25 PM, MitchAlsup wrote:
>>>>>>> Chris M. Thomasson wrote:
>>>>>> [...]
>>>>>>> I have a 99% functional C compiler that runs many Fortran
>>>>>>> programs, but
>>>>>>> C++ is a way bigger language {constructors, destructors,
>>>>>>> try-throw-catch,
>>>>>>> their version of ATOMICs, threading, .....}
>>>>>
>>>>>> A C11 compiler that knows about membars and atomics? Fwiw, check
>>>>>> this out:
>>>>>
>>>>> Where does it mention a My 66000 ISA target ?? That is the only ISA
>>>>> I am
>>>>> spending time in.........
>>>>>
>>>>>> http://www.smorgasbordet.com/pellesc
>>>>>
>>>>>> [...]
>>>
>>>> I was just wondering if your C compiler handles C11? If so, that
>>>> would be great!!!!
>>>
>>>
>>> It handles whatever the current CLANG front end handles.
>
>> A proposal?
>> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0233r5.pdf :^)
>
> Under 2.3. Pros and Cons
> <snip>
> The main disadvantage of the hazard pointers method is that each
> traversal incurs a store-load
> memory order fence, when using the method's basic form (without blocking
> or using system
> support such as sys_membarrier()).
>
> The transition from {sequential to causal*} consistency appears to take
> place at the
> subsequent memory reference . There are 2 cases to
> consider::
> a) ST.lock remains in the execution window
> b) ST.lock has retired
[...]

It's that damn Store to Load memory order requirement. There are ways
around it wrt current arch's, dec alpha aside for a moment... I
mentioned one of them in this thread.

Re: My older asm...

<d0bfe838f9f97065ab3f0ab992909353@news.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35764&group=comp.arch#35764

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!.POSTED!not-for-mail
From: mitchalsup@aol.com (MitchAlsup)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Fri, 15 Dec 2023 17:15:54 +0000
Organization: novaBBS
Message-ID: <d0bfe838f9f97065ab3f0ab992909353@news.novabbs.com>
References: <ukh485$2o9j8$1@dont-email.me> <d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com> <ukm9mk$3psll$1@dont-email.me> <c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com> <uko3ts$d3uq$1@dont-email.me> <66615d1bbbede14f0f631be2edce46c1@news.novabbs.com> <ukof2k$el2l$3@dont-email.me> <b640f72952e7f89acccd592ff0546f95@news.novabbs.com> <ukomlg$jgsk$1@dont-email.me> <d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com> <ukr8nu$103hq$1@dont-email.me> <631b41c8a19abfa0961117b8a29b5969@news.novabbs.com> <ulgp8o$1pia0$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="20795"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Site: $2y$10$IOgCJWfK.cMPsfX76xnFjONfLl1W4faIz.4LvIyBCPHHMAkvXDPI.
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on novalink.us
X-Rslight-Posting-User: 7e9c45bcd6d4757c5904fbe9a694742e6f8aa949
 by: MitchAlsup - Fri, 15 Dec 2023 17:15 UTC

Chris M. Thomasson wrote:

> On 12/6/2023 7:29 PM, MitchAlsup wrote:
>>
>> The main disadvantage of the hazard pointers method is that each
>> traversal incurs a store-load
>> memory order fence, when using the method's basic form (without blocking
>> or using system
>> support such as sys_membarrier()).
>>
>> The transition from {sequential to causal*} consistency appears to take
>> place at the
>> subsequent memory reference . There are 2 cases to
>> consider::
>> a) ST.lock remains in the execution window
>> b) ST.lock has retired
> [...]

> It's that damn Store to Load memory order requirement. There are ways
> around it wrt current arch's, dec alpha aside for a moment... I
> mentioned one of them in this thread.

I learned very early, that getting ATOMICs right is vastly more important
than making them fast. And getting memory order done properly is paramount.

Re: My older asm...

<uliqep$23u4c$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=35776&group=comp.arch#35776

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: My older asm...
Date: Fri, 15 Dec 2023 16:19:36 -0800
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <uliqep$23u4c$1@dont-email.me>
References: <ukh485$2o9j8$1@dont-email.me>
<d3ae3a410f42f8981ede4e18a0f22091@news.novabbs.com>
<ukm9mk$3psll$1@dont-email.me>
<c59dd7a9f4f781d574d2ca1cf1f73a98@news.novabbs.com>
<uko3ts$d3uq$1@dont-email.me>
<66615d1bbbede14f0f631be2edce46c1@news.novabbs.com>
<ukof2k$el2l$3@dont-email.me>
<b640f72952e7f89acccd592ff0546f95@news.novabbs.com>
<ukomlg$jgsk$1@dont-email.me>
<d1aa8a2d20fcbd794a146d7995c66d4a@news.novabbs.com>
<ukr8nu$103hq$1@dont-email.me>
<631b41c8a19abfa0961117b8a29b5969@news.novabbs.com>
<ulgp8o$1pia0$1@dont-email.me>
<d0bfe838f9f97065ab3f0ab992909353@news.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 16 Dec 2023 00:19:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="49bb54b42fc97bd6e5f86e48351b9531";
logging-data="2226316"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hB2+Bj9CEPeqqfF/sPDpWQxFY3nfGwTE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:SnmsKF1/UJGyhpR5WLT35M2ER6Q=
In-Reply-To: <d0bfe838f9f97065ab3f0ab992909353@news.novabbs.com>
Content-Language: en-US
 by: Chris M. Thomasson - Sat, 16 Dec 2023 00:19 UTC

On 12/15/2023 9:15 AM, MitchAlsup wrote:
> Chris M. Thomasson wrote:
>
>> On 12/6/2023 7:29 PM, MitchAlsup wrote:
>>>
>>> The main disadvantage of the hazard pointers method is that each
>>> traversal incurs a store-load
>>> memory order fence, when using the method's basic form (without
>>> blocking or using system
>>> support such as sys_membarrier()).
>>>
>>> The transition from {sequential to causal*} consistency appears to
>>> take place at the
>>> subsequent memory reference . There are 2 cases to
>>> consider::
>>> a) ST.lock remains in the execution window
>>> b) ST.lock has retired
>> [...]
>
>> It's that damn Store to Load memory order requirement. There are ways
>> around it wrt current arch's, dec alpha aside for a moment... I
>> mentioned one of them in this thread.
>
>
> I learned very early, that getting ATOMICs right is vastly more important
> than making them fast. And getting memory order done properly is paramount.

Yup. Getting the atomics right is first on the list, indeed. Wrt memory
order, I usually make everything std::memory_order_seq_cst first! Okay,
get it working... Now, lets ponder on and experiment with trying to
reduce the memory order to its weakest point before things no longer
work... Fwiw, there are some tools out there that be fairly beneficial.
One of them was written by one of my friends from way back over on
comp.programming.threads:

https://github.com/dvyukov/relacy

This is pretty nice, well, according to me. :^)

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor