git: 65ec52e6e09f - main - buf_ring: Remove unneeded memory barriers

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 09 Dec 2024 15:45:04 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=65ec52e6e09f8b2a610a26638ff65a35ee5557b4

commit 65ec52e6e09f8b2a610a26638ff65a35ee5557b4
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-12-09 15:04:37 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-12-09 15:44:30 +0000

    buf_ring: Remove unneeded memory barriers
    
    We no longer need a memory barrier on the compare and set operations.
    If these fail then there are appropriate barriers on the loads earlier
    in the loop, and if they succeed then no other threads can be accessing
    the br_ring entry so any store to it is safe.
    
    Reviewed by:    alc
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D46381
---
 sys/sys/buf_ring.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/sys/buf_ring.h b/sys/sys/buf_ring.h
index 9a4bfa9fb549..ab7e683ed0e9 100644
--- a/sys/sys/buf_ring.h
+++ b/sys/sys/buf_ring.h
@@ -116,7 +116,7 @@ buf_ring_enqueue(struct buf_ring *br, void *buf)
 			}
 			continue;
 		}
-	} while (!atomic_cmpset_acq_32(&br->br_prod_head, prod_head, prod_next));
+	} while (!atomic_cmpset_32(&br->br_prod_head, prod_head, prod_next));
 	prod_idx = prod_head & mask;
 #ifdef DEBUG_BUFRING
 	if (br->br_ring[prod_idx] != NULL)
@@ -163,7 +163,7 @@ buf_ring_dequeue_mc(struct buf_ring *br)
 			critical_exit();
 			return (NULL);
 		}
-	} while (!atomic_cmpset_acq_32(&br->br_cons_head, cons_head, cons_next));
+	} while (!atomic_cmpset_32(&br->br_cons_head, cons_head, cons_next));
 	cons_idx = cons_head & mask;
 
 	buf = br->br_ring[cons_idx];