From owner-freebsd-current@FreeBSD.ORG Wed Nov 3 17:09:26 2010 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 397B61065674; Wed, 3 Nov 2010 17:09:26 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 484298FC16; Wed, 3 Nov 2010 17:09:24 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA11787; Wed, 03 Nov 2010 19:09:23 +0200 (EET) (envelope-from avg@icyb.net.ua) Message-ID: <4CD19742.2010501@icyb.net.ua> Date: Wed, 03 Nov 2010 19:09:22 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.11) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.5 MIME-Version: 1.0 To: mdf@FreeBSD.org References: <4CD190EF.5080600@icyb.net.ua> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-current@FreeBSD.org Subject: Re: MTX_DEF versus MTX_SPIN X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Nov 2010 17:09:26 -0000 on 03/11/2010 19:04 mdf@FreeBSD.org said the following: > On Wed, Nov 3, 2010 at 9:42 AM, Andriy Gapon wrote: >> on 03/11/2010 18:27 mdf@FreeBSD.org said the following: >>> It's not clear to me from the man pages (perhaps I didn't look at the >>> right one?) in which environments I need a spinlock. For example, I >>> wouldn't think it's safe to use a MTX_DEF in a hard interrupt handler >>> (i.e one that was registered with BUS_SETUP_INTR), but I see some code >>> lying around here that does it and nothing I'm aware of has broken. >> >> Such a handler runs in an interrupt thread. >> The "harder" interrupt handler is called interrupt filter in FreeBSD terminology. >> I think that it was formerly known as fast interrupt. > > So a MTX_DEF is okay in that environment? Yes, I think so. > What would "best practices" be considered for what code should be run > in the interrupt handler versus a soft interrupt? Sorry for not going into details, but I personally think that there is no reason to use soft interrupts. If you can do everything in interrupt handler (i.e. on interrupt threads), then that should be all you need. -- Andriy Gapon