Re: [PATCH 1/2] ring-buffer: Replace rb_time_cmpxchg() with rb_time_cmp_and_update()

From: Steven Rostedt
Date: Mon Dec 18 2023 - 13:41:51 EST


On Mon, 18 Dec 2023 10:15:31 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> Basically I broke it into:
>
> 1. Remove workaround exposure from the main logic. (this patch)
> 2. Remove the workaround. (next patch).
>
> >
> > Isn't this part actual change?
>
> This part is abstracted out from the main logic. Which is why I made this
> patch.
>
> >
> > > static bool rb_time_cmp_and_update(rb_time_t *t, u64 expect, u64 set)
> > > {
> > > - return rb_time_cmpxchg(t, expect, set);
> > > +#ifdef RB_TIME_32
> > > + return expect == READ_ONCE(t->time);
>
> And I need to make a v2 as the above is wrong. It should have been:
>
> return expect == local64_read(&t->time);


My v2 version will also make 64 bit not guaranteed to update on return of
true. Which adds even more reason to separate out the two.

-- Steve