[PATCH v2 net-next 08/14] net: enetc: add multiple command BD rings support
Wei Fang
wei.fang at nxp.com
Wed Mar 25 12:56:30 AEDT 2026
> > +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
More information about the Linuxppc-dev
mailing list