From owner-freebsd-scsi@FreeBSD.ORG Tue Aug 9 19:39:53 2011 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 32740106566B for ; Tue, 9 Aug 2011 19:39:53 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id EE47E8FC0A for ; Tue, 9 Aug 2011 19:39:52 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id p79JdnZK021146; Tue, 9 Aug 2011 13:39:49 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id p79Jdnp2021145; Tue, 9 Aug 2011 13:39:49 -0600 (MDT) (envelope-from ken) Date: Tue, 9 Aug 2011 13:39:49 -0600 From: "Kenneth D. Merry" To: Matthew Jacob Message-ID: <20110809193949.GA93077@nargothrond.kdm.org> References: <4E3F0332.7030004@feral.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E3F0332.7030004@feral.com> User-Agent: Mutt/1.4.2i Cc: freebsd-scsi@freebsd.org Subject: Re: some changes to xpt to help make unloading sim modules safer 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, 09 Aug 2011 19:39:53 -0000 On Sun, Aug 07, 2011 at 14:27:14 -0700, Matthew Jacob wrote: > > See http://people.freebsd.org/~mjacob/xpt_patches.txt > > The first one come from a coworker (Chuck Tuffli) who found a hole > xpt_create_path_unlocked. This looks fine. > I added a few after that to guard against overrunning some counters so > that they would wrap. Just out of curiosity, have you seen instances where the counters have gone negative? > It helped me find out what was going on much easier by adding the > function described here: > http://people.freebsd.org/~mjacob/xpt_path_counts.txt > > Finally, http://people.freebsd.org/~mjacob/isp_patches.txt makes isp > safe for unload as a module. > > There's some ambiguity over whether it's safe to unload when a periph is > open. Using xpt_path_counts to check with the bus reference count is > 3 > for each scsibus attached to each isp sim is a way to avoid that. > > Comments? I would think you'd want to wait until the periph is closed, but perhaps there is a way to get away with it if there aren't any commands outstanding in the SIM. You could send async notifications that all of the devices on the bus have gone away, and then once everything disappears, you could finish the unload. Ken -- Kenneth Merry ken@kdm.org