atomic_set_xxx(&x, 0) in arcmsr

Andriy Gapon avg at freebsd.org
Tue Dec 7 22:48:55 UTC 2010



Can somebody please take a look at the following report?
Looks like that use of atomic_set_int() could cause problems in driver's
reset/shutdown logic.
Thanks!

-------- Original Message --------
From: John Baldwin <jhb at freebsd.org>
To: freebsd-hackers at freebsd.org
Subject: Re: atomic_set_xxx(&x, 0)
Date: Tue, 7 Dec 2010 16:24:59 -0500
Cc: Andriy Gapon <avg at freebsd.org>
References: <4CFE75D3.4050009 at freebsd.org>
In-Reply-To: <4CFE75D3.4050009 at freebsd.org>

On Tuesday, December 07, 2010 12:58:43 pm Andriy Gapon wrote:
> 
> $ glimpse atomic_set_ | fgrep -w 0
> /usr/src/sys/dev/arcmsr/arcmsr.c:       atomic_set_int(&acb->srboutstandingcount, 0);
> /usr/src/sys/dev/arcmsr/arcmsr.c:       atomic_set_int(&acb->srboutstandingcount, 0);
> /usr/src/sys/dev/jme/if_jme.c:  atomic_set_int(&sc->jme_morework, 0);
> /usr/src/sys/dev/jme/if_jme.c:  atomic_set_int(&sc->jme_morework, 0);
> /usr/src/sys/dev/ale/if_ale.c:  atomic_set_int(&sc->ale_morework, 0);
> /usr/src/sys/mips/rmi/dev/xlr/rge.c:
> atomic_set_int(&(priv->frin_to_be_sent[i]), 0);
> /usr/src/sys/dev/drm/drm_irq.c:
> atomic_set_rel_32(&dev->vblank[i].count, 0);
> /usr/src/sys/dev/cxgb/ulp/tom/cxgb_tom.c:       atomic_set_int(&t->tids_in_use, 0);
> 
> I wonder if these are all bugs and atomic_store_xxx() was actually intended?

They are most likely bugs.  You can probably ask yongari@ about jme(4) and
ale(4) and np@ about cxgb(4).  drm_irq looks to want to be an atomic_store_rel().
Not sure who to ask about arcmsr(4).  I'm not sure arcmsr(4) really needs the
atomic ops at all, but it should be using atomic_fetchadd() and
atomic_readandclear() instead of some of the current atomic ops.

-- 
John Baldwin


More information about the freebsd-scsi mailing list