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

Wei Fang
2026-03-25T01:56:34Z

> > +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