From owner-freebsd-questions@FreeBSD.ORG Tue Jul 15 13:56:11 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9962B1065671 for ; Tue, 15 Jul 2008 13:56:11 +0000 (UTC) (envelope-from yonyossef.lists@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.25]) by mx1.freebsd.org (Postfix) with ESMTP id F3CFE8FC23 for ; Tue, 15 Jul 2008 13:56:10 +0000 (UTC) (envelope-from yonyossef.lists@gmail.com) Received: by qw-out-2122.google.com with SMTP id 9so135854qwb.7 for ; Tue, 15 Jul 2008 06:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=pH+DGOhlWWc5OeS+tm+sciV5rUvgJzXFD5NS5QJw74Q=; b=ey9USW8sQ3m+mPd3Cnpep4anW1vYT5IX3fqB1b9LAlloxHH2MLSE9+yZ/7YxVtnvDP Y4r1oMOJikNoyJZ3ETgJCkqIrfRyOeDH6ul/eKcXp7ZnWlZ601yEgsOMBUCvPJVFeg0f PZbDaafplBcv7LPXIxQ8bmzcbA1OoOKVabpLg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=lO+PAztwEDl4+PFta9STVE5omcwVMZVL56d5m93aNsZVVHBMHjRL4aWUDFu2SwO53r Py0zqgTNky38W+UsUd0C31wbCfl72hYVXQUwA5OY3+MYQKWSep2VXcATcveZot7Vrkq9 T4qSC1yaWwVcrLguLvkVMflhRwlHrTRQYUHzI= Received: by 10.150.51.2 with SMTP id y2mr294347yby.149.1216130170059; Tue, 15 Jul 2008 06:56:10 -0700 (PDT) Received: by 10.151.84.2 with HTTP; Tue, 15 Jul 2008 06:56:10 -0700 (PDT) Message-ID: <20def4870807150656y761a8bcfo858b85b760d0f93f@mail.gmail.com> Date: Tue, 15 Jul 2008 16:56:10 +0300 From: "Yony Yossef" To: "Kris Kennaway" In-Reply-To: <487CA8DC.2090703@FreeBSD.org> MIME-Version: 1.0 References: <20def4870807140902y4e5aad69r649d577fb5f5ad84@mail.gmail.com> <487BE91E.1020202@FreeBSD.org> <20def4870807150605w6e3de82eq4a999360e9b49b6c@mail.gmail.com> <487CA8DC.2090703@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: Re: options WITNESS and locks X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2008 13:56:11 -0000 > > > Something is still unclear. All my locks are MTX_DEF type, which means >> sleepable, including the one specified in the crash report (MTNIC state >> semaphore). >> This crash happens when I try to call bus_resource_alloc_any for a SYS_REQ >> which is trying to obtain the second lock (ACPI root bus). How come my >> MTX_DEF lock is being treated as as non-sleepable? >> > > MTX_DEF locks *are* non-sleepable :-) > > Kris > Good news :-) Yet the documentation is confusing me: man pages say: MTX_DEF Default mutexes will always allow the current thread to be suspended to avoid deadlock conditions against interrupt threads. The implementation of this lock type may spin for a while before suspending the current thread. and in mutex.h: /* * Mutex types and options passed to mtx_init(). MTX_QUIET and MTX_DUPOK * can also be passed in. */ #define MTX_DEF 0x00000000 /* DEFAULT (sleep) lock */ #define MTX_SPIN 0x00000001 /* Spin lock (disables interrupts) */ #define MTX_RECURSE 0x00000004 /* Option: lock allowed to recurse */ #define MTX_NOWITNESS 0x00000008 /* Don't do any witness checking. */ #define MTX_NOPROFILE 0x00000020 /* Don't profile this lock */ What does the "DEFAULT (sleep) lock" comment near MTX_DEF means? And which ones are sleepable?.. I guess I'm missing something here.