From owner-freebsd-hackers@FreeBSD.ORG Mon Jan 12 18:16:52 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B303106566B for ; Mon, 12 Jan 2009 18:16:52 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.170]) by mx1.freebsd.org (Postfix) with ESMTP id 6B2308FC29 for ; Mon, 12 Jan 2009 18:16:52 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: by wf-out-1314.google.com with SMTP id 24so13919863wfg.7 for ; Mon, 12 Jan 2009 10:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=NryGT+whINa4kDBf0QPmZO3lpOmnHKEauHTZOgriRi8=; b=gcMO6SGtfixUEyVMIaTX1akYDDlWmzGfBzOyjS2i3rZFJmCCVTeBv4AkycG/OsrTn5 h5d22cVk6i16zB98SFUo12cO+1C3WY7cIH/gkA48C8ZdGIV3XAoGlq+WbTtz6zBZXG+k melX3T6nOvP2c6UtW3zB/+JA4ih1j2ETWgBtk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=H6lthgGsNheK+oUdOlLRxCLIpdjetc9bl9NJlDBW5zrJvohp+Qdmn6hutaCt6ACUCj aTsuUIWRKEwWkCK0U8eSZYm8CiPPIwoxzsqiCLq6ExXlW6Lc29nBqMr2sJ/uYgEpOJ7O WSHQfrrR9nH87JApw7SJ1i9YKo8Yl54ZCNJic= Received: by 10.114.184.7 with SMTP id h7mr19625226waf.151.1231784211775; Mon, 12 Jan 2009 10:16:51 -0800 (PST) Received: by 10.114.202.10 with HTTP; Mon, 12 Jan 2009 10:16:51 -0800 (PST) Message-ID: <671bb5fc0901121016m7932666cpfe3c089d4c78486e@mail.gmail.com> Date: Mon, 12 Jan 2009 19:16:51 +0100 From: "Alexej Sokolov" To: "Mateusz Guzik" In-Reply-To: <20090112173913.GA2102@skucha> MIME-Version: 1.0 References: <20090112134726.GA2988@debian.samsung.router> <20090112141029.GA31108@skucha> <671bb5fc0901120819q65969961v723807bcb7ad5a96@mail.gmail.com> <20090112173913.GA2102@skucha> 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-hackers@freebsd.org Subject: Re: panic by unlocking of mutex in KLD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jan 2009 18:16:53 -0000 2009/1/12 Mateusz Guzik > On Mon, Jan 12, 2009 at 05:19:56PM +0100, Alexej Sokolov wrote: > > 2009/1/12 Mateusz Guzik > > > Mutexes have owners. It panics on loading because processes cannot > > > return to userland with locks held. > > > > i am not sure about it. Some time ago i implemented a charecter device > with > > two syscalls: write, read. "write" lock the mutex and "read" unlock it. > The > > user space programm opens device, then mekes "write" (mutex will held in > > kernel), goes back to user space, then makes "read" (mutex will unlocked > in > > kernel) and it all run without panic. If needed i can post the source > code. > > > > Do you have kernel compiled with WITNESS? At least on -CURRENT the > kernel panicked like this (while loading your module): > > System call kldload returning with 1 locks held My kernel is compiled without WITNESS. And it allows to lock mutex in one systcall (for example "write") and to unlock it in other ("read"). Do you mean it is "very bad idea" to do something like this ? I could not find anywhere in the documentation that a it is not allowed to return in the user space with a locked mutex. Can you give me some reference on man page, source code or something other from where can I understand it ? Thanx a lot, Alexej > > > -- > Mateusz Guzik > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >