From owner-p4-projects@FreeBSD.ORG Wed Jun 6 13:31:47 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9238016A46E; Wed, 6 Jun 2007 13:31:47 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A67DB16A469 for ; Wed, 6 Jun 2007 13:31:46 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.186]) by mx1.freebsd.org (Postfix) with ESMTP id 32C9613C483 for ; Wed, 6 Jun 2007 13:31:45 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by mu-out-0910.google.com with SMTP id w9so143284mue for ; Wed, 06 Jun 2007 06:31:44 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=kWK8nWHd33+PZtXwHrpZ+7LtV97GcWRbeTUImpuDGsNvoVWhMPNgUf+bJCEAExr9EBTl2rLQiLlJJG0gFjNe/06O1U04ETMuSHPBzVH8MyZnnjT92QcoBM+/FMkEaD7x6dg1PFuCL7xllnuE1LXdqjGjLZizrE/E93JSzymbA9Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=a62g07GX9PiRIcBjRGlan4a4aOx+NRYGdhiH4B0uRZL5teDrTTbQ6Td5awxOXOspwUJfVLUlsx7ex2c1hSR/33LEzxLXrgKuMFxVCz5mLLDSFI5TtO8wYbRXRHqwomOUt0AgyHczznJ4cm/XTP49ZuYHVkgjEeNtJbRgVE8Wa7I= Received: by 10.82.182.1 with SMTP id e1mr980463buf.1181136704667; Wed, 06 Jun 2007 06:31:44 -0700 (PDT) Received: from ?172.31.5.25? ( [89.97.252.178]) by mx.google.com with ESMTP id 7sm1071265nfv.2007.06.06.06.31.44; Wed, 06 Jun 2007 06:31:44 -0700 (PDT) Message-ID: <4666B730.9080908@FreeBSD.org> Date: Wed, 06 Jun 2007 15:31:28 +0200 From: Attilio Rao User-Agent: Thunderbird 1.5 (X11/20060526) MIME-Version: 1.0 To: Rui Paulo References: <200706021756.l52Huq9A049371@repoman.freebsd.org> <4661BFD0.1080107@FreeBSD.org> <86myzeq67f.wl%rpaulo@fnop.net> In-Reply-To: <86myzeq67f.wl%rpaulo@fnop.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Attilio Rao Cc: Perforce Change Reviews , Rui Paulo Subject: Re: PERFORCE change 120788 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2007 13:31:47 -0000 Rui Paulo wrote: > > If I'm not doing something wrong, I need to use spin locks on my > interrupt handler, or else witness_checkorder will complain with > "blockable sleep lock". > > Note that I'm using FILTERs. So you are doing this in the wrong way. In order to use correctly filters, please note that the support for them is compile time choosen, so you need to wrapper all filter specific parts using INTR_FILTER compat macro. You have so to provide an alternative way for !INTR_FILTERS kernel. Respect to locking, the correct thing to do here is: - blocking lock for ithreads - spin lock for fast handlers - spin lock when you need locking inside a filter (it means that you could end in the not ideal case to use a spin lock inside an ithread, in the case the filter decides the ithread needs to run and they need to be synchronized). You would choose a fast handler/filter only handler when the work the handler needs to do is simple and doesn't require too much hardwork, otherwise you would need an ithread/filter + ithread. In the latter case you can use a blocking lock (a mutex or a rwlock) if you just need syncronization of your softc inside the ithread, otherwise, as I previously mentioned, you need a spinlock too here. Attilio