From owner-freebsd-scsi@FreeBSD.ORG Tue Dec 7 22:48:55 2010 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56543106566B for ; Tue, 7 Dec 2010 22:48:55 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 9BE4D8FC08 for ; Tue, 7 Dec 2010 22:48:54 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA10417 for ; Wed, 08 Dec 2010 00:48:53 +0200 (EET) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1PQ6L6-000HqU-PW for freebsd-scsi@freebsd.org; Wed, 08 Dec 2010 00:48:52 +0200 Message-ID: <4CFEB9D4.9090808@freebsd.org> Date: Wed, 08 Dec 2010 00:48:52 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101029 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: freebsd-scsi@freebsd.org X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: atomic_set_xxx(&x, 0) in arcmsr X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Dec 2010 22:48:55 -0000 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 To: freebsd-hackers@freebsd.org Subject: Re: atomic_set_xxx(&x, 0) Date: Tue, 7 Dec 2010 16:24:59 -0500 Cc: Andriy Gapon References: <4CFE75D3.4050009@freebsd.org> In-Reply-To: <4CFE75D3.4050009@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