Thread (26 messages) 26 messages, 4 authors, 2026-03-25

RE: [PATCH v2 net-next 08/14] net: enetc: add multiple command BD rings support

flat view

From: Wei Fang <wei.fang@nxp.com>
Date: 2026-03-25 01:56:34
Also in: imx, linux-arm-kernel, linux-devicetree, lkml, netdev

quoted
+static struct netc_cbdr *netc_select_cbdr(struct ntmp_user *user)
+{
+	int cpu, i;
+
+	for (i = 0; i < user->cbdr_num; i++) {
+		if (spin_is_locked(&user->ring[i].ring_lock))
+			continue;
+
+		return &user->ring[i];
+	}
Frank Li raised a concern about the use of spin_is_locked() here. Is this
lockless check reliable across all architectures? spin_is_locked() behavior
varies across configurations - it can return false negatives on UP builds and
may not provide the ordering guarantees needed for lockless checks.

Would spin_trylock() be more appropriate here? Or if this racy check is
intentional and acceptable, should it be documented why the potential race is
safe in this context?
I missed this comment in v1 for some reasons, I will improve this, thanks

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