lkml.org 
[lkml]   [2018]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC LKMM 3/7] EXP tools/memory-model: Add more LKMM limitations
> > > +	b.	The "unless" RMW operations are not currently modeled:
> > > + atomic_long_add_unless(), atomic_add_unless(),
> > > + atomic_inc_unless_negative(), and
> > > + atomic_dec_unless_positive(). These can be emulated
> > > + in litmus tests, for example, by using atomic_cmpxchg().
> >
> > There is a prototype atomic_add_unless(): with current herd7,
> >
> > $ cat atomic_add_unless.litmus
> > C atomic_add_unless
> >
> > {}
> >
> > P0(atomic_t *u, atomic_t *v)
> > {
> > int r0;
> > int r1;
> >
> > r0 = atomic_add_unless(u, 1, 2);
> > r1 = atomic_read(v);
> > }
> >
> > P1(atomic_t *u, atomic_t *v)
> > {
> > int r0;
> > int r1;
> >
> > r0 = atomic_add_unless(v, 1, 2);
> > r1 = atomic_read(u);
> > }
> >
> > exists (0:r1=0 /\ 1:r1=0)
> >
> > $ herd7 -conf linux-kernel.cfg atomic_add_unless.litmus
> > Test atomic_add_unless Allowed
> > States 3
> > 0:r1=0; 1:r1=1;
> > 0:r1=1; 1:r1=0;
> > 0:r1=1; 1:r1=1;
> > No
> > Witnesses
> > Positive: 0 Negative: 3
> > Condition exists (0:r1=0 /\ 1:r1=0)
> > Observation atomic_add_unless Never 0 3
> > Time atomic_add_unless 0.00
> > Hash=fa37a2359831690299e4cc394e45d966
> >
> > The last commit in the herdtools7 repo. related to this implementation
> > (AFAICT) is:
> >
> > 9523c340917b6a ("herd/linux: make atomic_add_unless a primitive, so as to yield more precise dependencies for the returned boolean.")
> >
> > but I can only vaguely remember those dependencies issues now :/ ...;
> > maybe we can now solve these issues? or should we change herd7 to re-
> > turn a warning? (Notice that this primitive is currently not exported
> > to the linux-kernel.def file.)
>
> Cool! It would be good to add this to the .def file once the underlying
> herd7 machinery is ready. And then I would update the documentation
> accordingly. Or happily accept a patch updating the documentation,
> as the case might be. ;-)

Fair enough, ;-) Please feel free to add:

Reviewed-by: Andrea Parri <andrea.parri@amarulasolutions.com>

Andrea

\
 
 \ /
  Last update: 2018-08-31 11:44    [W:0.082 / U:0.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site