From owner-freebsd-current@FreeBSD.ORG Mon Oct 25 15:13:35 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 992F016A4CE; Mon, 25 Oct 2004 15:13:35 +0000 (GMT) Received: from athena.softcardsystems.com (mail.softcardsystems.com [12.34.136.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1BF9D43D1F; Mon, 25 Oct 2004 15:13:35 +0000 (GMT) (envelope-from sah@softcardsystems.com) Received: from athena (athena [12.34.136.114])i9PGBDgR030644; Mon, 25 Oct 2004 11:11:14 -0500 Date: Mon, 25 Oct 2004 11:11:13 -0500 (EST) From: Sam X-X-Sender: sah@athena To: freebsd-current@freebsd.org, freebsd-arch@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: 6.0 Witness squawk X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2004 15:13:35 -0000 Hello, I'm almost finished porting my AoE (ATA over Ethernet) driver to 6.0 and have a question about a complaint witness is making. In general, is it ok to sleep with a mutex held? Specifically, it works like this in the driver. Each device struct has a mutex for guarding operations on it. Discovering devices is a two step process. First the device must respond to an AoE Query command, then it must respond to an ATA identify command. On the response to the latter, I grab the device mutex, examine the response and call disk_alloc() and disk_create(). Both of these functions call malloc with M_WAITOK, the latter triggers the witness message. In my situation, I don't really mind if I sleep with the mutex since I can't do any useful work with the device anyway. This does leave the possibility that the netisr for AoE could sleep. Thoughts? Cheers, Sam