From owner-freebsd-hackers Mon Aug 20 9:30: 4 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from dirty.research.bell-labs.com (dirty.research.bell-labs.com [204.178.16.6]) by hub.freebsd.org (Postfix) with SMTP id 35E9137B405 for ; Mon, 20 Aug 2001 09:29:50 -0700 (PDT) (envelope-from sandeepj@research.bell-labs.com) Received: from scummy.research.bell-labs.com ([135.104.2.10]) by dirty; Mon Aug 20 12:29:50 EDT 2001 Received: from aura.research.bell-labs.com (aura.research.bell-labs.com [135.104.46.10]) by scummy.research.bell-labs.com (8.11.4/8.11.4) with ESMTP id f7KGTcl59353 for ; Mon, 20 Aug 2001 12:29:38 -0400 (EDT) Received: from research.bell-labs.com (IDENT:sandeepj@sandeepj-pcmh.research.bell-labs.com [135.104.47.90]) by aura.research.bell-labs.com (8.9.1/8.9.1) with ESMTP id MAA05309 for ; Mon, 20 Aug 2001 12:29:38 -0400 (EDT) Message-ID: <3B813AF2.BC7C726@research.bell-labs.com> Date: Mon, 20 Aug 2001 12:29:38 -0400 From: Sandeep Joshi X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.16-3 i686) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: long-term kernel locks Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi there, I need some mechanism to hold long-term locks (across context switches) while using kernel threads (kthread_*) and lockmgr() looked like the right thing to use. I am running FreeBSD 4.1 on a uniprocessor (..the questions are similar with 4.3) Looking at kern_lock.c, I see that lockmgr() uses simple locks. On a UP system, simple locks are turned off. I dont see any way to prevent a context switch while the kernel thread is in the lockmgr code - after going thru a simple_lock() call. Is this correct ? So my questions are : 1) Is lockmgr safe ? 2) Are there other sync primitives that can be used between two kernel entities (i can move to 4.3) 3) What is the use of simplelock_recurse in kern_lock.c ? TIA, -Sandeep To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message