lkml.org 
[lkml]   [2024]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH memory-model 2/4] Documentation/litmus-tests: Demonstrate unordered failing cmpxchg


    Am 5/6/2024 um 9:21 PM schrieb Alan Stern:
    > On Mon, May 06, 2024 at 11:00:42AM -0700, Paul E. McKenney wrote:
    >> On Mon, May 06, 2024 at 06:30:45PM +0200, Jonas Oberhauser wrote:
    >>> Am 5/6/2024 um 12:05 PM schrieb Jonas Oberhauser:
    >>>> Am 5/2/2024 um 1:21 AM schrieb Paul E. McKenney:
    >>>>> This commit adds four litmus tests showing that a failing cmpxchg()
    >>>>> operation is unordered unless followed by an smp_mb__after_atomic()
    >>>>> operation.
    >>>>
    >>>> So far, my understanding was that all RMW operations without suffix
    >>>> (xchg(), cmpxchg(), ...) will be interpreted as F[Mb];...;F[Mb].
    >
    > It's more accurate to say that RMW operations without a suffix that
    > return a value will be interpreted that way. So for example,
    > atomic_inc() doesn't imply any ordering, because it doesn't return a
    > value.
    >

    I see, thanks.

    >>>> barriers explicitlyinside the cat model, instead of relying on implicit
    >>>> conversions internal to herd.
    >
    > Don't the annotations in linux-kernel.def and linux-kernel.bell (like
    > "noreturn") already make this explicit?

    Not that I'm aware. All I can see there is that according to .bell RMW
    don't have an mb mode, but according to .def they do.

    How this mb disappears between parsing the code (.def) and interpreting
    it (.bell) is totally implicit. Including how noreturn affects this
    disappeareance.

    In fact most tool developers that support LKMM (Viktor, Hernan, and Luc)
    were at least once confused about it. And I think they read those files
    more carefully than I.

    https://github.com/herd/herdtools7/issues/384#issuecomment-1132859904

    Note that while there's no explicit annotation of noreturn in the .def
    file, at least I can guess based on context that it should be annotated
    on all the functions that don't have _return and for which also a
    version with _return exists.


    have fun,
    jonas


    \
     
     \ /
      Last update: 2024-05-27 18:17    [W:4.858 / U:0.396 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site