Thread (33 messages) 33 messages, 5 authors, 2021-03-05

Re: XDP socket rings, and LKMM litmus tests

flat view

From: Björn Töpel <hidden>
Date: 2021-03-02 22:37:53
Also in: lkml

On Tue, 2 Mar 2021 at 21:04, Paul E. McKenney [off-list ref] wrote:
[...]
And if the answer is "yes", how about this one?
With the == to != change in P1, this is OK!
P0(int *prod, int *cons, int *data)
{
    int p;

    p = READ_ONCE(*prod);
    if (p == READ_ONCE(*cons)) {
...and now d==1 is not a valid state anymore according to herd. If
think I need some input here! :-D
        WRITE_ONCE(*data, 1);
        smp_wmb();
        WRITE_ONCE(*prod, p ^ 1);
    }
}

P1(int *prod, int *cons, int *data)
{
    int c;
    int d = -1;

    c = READ_ONCE(*cons);
    if (READ_ONCE(*prod) == c) {
        smp_rmb();
        d = READ_ONCE(*data);
        smp_mb();
        WRITE_ONCE(*cons, c ^ 1);
    }
}
[...]

Björn
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help