From owner-freebsd-scsi@FreeBSD.ORG Fri Jun 1 03:21:19 2007 Return-Path: X-Original-To: freebsd-scsi@freebsd.org Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3026516A421; Fri, 1 Jun 2007 03:21:19 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id DC0CE13C483; Fri, 1 Jun 2007 03:21:18 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.samsco.home (phobos.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.8/8.13.8) with ESMTP id l513LFDw079451; Thu, 31 May 2007 21:21:16 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <465F90A9.7080608@samsco.org> Date: Thu, 31 May 2007 21:21:13 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.2pre) Gecko/20070111 SeaMonkey/1.1 MIME-Version: 1.0 To: Hidetoshi Shimokawa References: <86wsyopf0t.wl%simokawa@FreeBSD.ORG> In-Reply-To: <86wsyopf0t.wl%simokawa@FreeBSD.ORG> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (pooker.samsco.org [168.103.85.57]); Thu, 31 May 2007 21:21:16 -0600 (MDT) X-Spam-Status: No, score=-1.4 required=5.5 tests=ALL_TRUSTED autolearn=failed version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: freebsd-scsi@freebsd.org Subject: Re: CAM locking 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: Fri, 01 Jun 2007 03:21:19 -0000 Hidetoshi Shimokawa wrote: > Hi Scott, > > Thank you for your work on CAM. > I have some questions about lock assertion. > > 1. Now, xpt_done() should be called with a sim lock for QUEUED ccbs. > Why don't you add an assertion in xpt_done()? Accessing the sim_lock from the CCB requires enough dereferences that if the lock isn't already held, you'll probably run into problems just doing the derefs in the assertion. Adding a sim_lock field to the CCB has crossed my mind, but I don't want to pollute the CCB with more kernel-only fields if I can. I need to think some more on it. > > 2. CAMDEBUG seems useless with WITNESS because xpt_path_path_id() requires > a sim lock. Can we safely drop the assertion? Yes, this is an area that I didn't clean up very well. A lot of code in periphs and SIMs wants to be able to use CAMDEBUG functions in random places without the lock held, and I don't know of a good way to safely fix this without rewriting a lot of code. I don't know if it's better to just drop the assertion or to audit all of the code provide locked and unlocked versions of the CAMDEBUG functions. Scott