From owner-freebsd-drivers@FreeBSD.ORG Fri Dec 12 07:34:11 2014 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9502DF58 for ; Fri, 12 Dec 2014 07:34:11 +0000 (UTC) Received: from mail-ob0-x235.google.com (mail-ob0-x235.google.com [IPv6:2607:f8b0:4003:c01::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 589D3D87 for ; Fri, 12 Dec 2014 07:34:11 +0000 (UTC) Received: by mail-ob0-f181.google.com with SMTP id gq1so6943977obb.12 for ; Thu, 11 Dec 2014 23:34:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=rr1AoY5Vzq1xCzwT1l1g1hJVB0cJQphacuTL0bpWLAM=; b=pR3janIzfo1LASwsT7XbH5rNfRW42HGWdb1Bo/4X5dnHqze2t7ddw3kKtUc/qQb/bZ D8p1vPrPv6Br8rjV73PjKCxCIvApkGg8ppgdF6I2zO+TJyPlP/7vZuRJ8OT5N740D4So d6/bHvWrsJ73L9v4yvsDAMsFek5Qg7OCAqtnHcvIMDv3/EH9lDby4xhi19nSXRRs2NgF 2FDyBxtz9ay0Je8gezxWFOHdCUGdi07OISDUGpP47v7m1gKyAFl5fBSYS+KAEb3MrlUo pRLB9fcF6cQ7/7Sd6k83ipAtbYlU39VNgY3TM/Rthzj1YeHACE9is2o01vglHxfozTd/ za/w== MIME-Version: 1.0 X-Received: by 10.202.3.3 with SMTP id 3mr8655617oid.11.1418369650683; Thu, 11 Dec 2014 23:34:10 -0800 (PST) Received: by 10.60.25.106 with HTTP; Thu, 11 Dec 2014 23:34:10 -0800 (PST) In-Reply-To: <20141211195821.GA3827@ox> References: <20141211195821.GA3827@ox> Date: Fri, 12 Dec 2014 04:34:10 -0300 Message-ID: Subject: Re: Locking a MTX_DEF inside an interrupt thread From: Martin Galvan To: freebsd-drivers@freebsd.org, nparhar@gmail.com Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2014 07:34:11 -0000 2014-12-11 16:58 GMT-03:00 Navdeep Parhar : > MTX_DEF mutexes can block but never sleep, and it is perfectly safe to acquire > them in an ithread. Thanks a lot for your answer. At first I was a bit confused on what the actual difference between "blocking" and "sleeping" was, but then I read the "Bounded vs Unbounded Sleep" section from locking(9) and it cleared things out a bit. I still don't understand why can't we sleep (i.e. do an 'unbounded sleep') inside an ithread. What would be the problem, exactly?