From owner-freebsd-hackers Mon Aug 20 12:56:26 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from earth.backplane.com (earth-nat-cw.backplane.com [208.161.114.67]) by hub.freebsd.org (Postfix) with ESMTP id 1E37D37B403 for ; Mon, 20 Aug 2001 12:56:23 -0700 (PDT) (envelope-from dillon@earth.backplane.com) Received: (from dillon@localhost) by earth.backplane.com (8.11.4/8.11.2) id f7KJuKt55214; Mon, 20 Aug 2001 12:56:20 -0700 (PDT) (envelope-from dillon) Date: Mon, 20 Aug 2001 12:56:20 -0700 (PDT) From: Matt Dillon Message-Id: <200108201956.f7KJuKt55214@earth.backplane.com> To: Sandeep Joshi Cc: freebsd-hackers@freebsd.org Subject: Re: long-term kernel locks References: <3B813AF2.BC7C726@research.bell-labs.com> <200108201747.f7KHl7l52745@earth.backplane.com> <3B816954.9CF1134E@research.bell-labs.com> 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 :Matt : :Ok I see..the interlock is a lock on a collection (e.g :on vfs mount list) and it can be released once the simple :lock within the to-be-locked object has been acquired. :These are really spin locks, now that I saw simplelock.s : :One more clarification if you will.. :-) : :What is the purpose of the "splhigh" in acquire() ? : :Is it this that prevents an involuntary context switch in :a UP system , while the lock variables are being modified :by acquire() ? : :-Sandeep In -stable there are no involuntary context switches in kernel mode and only one cpu can truely be running kernel code at any given moment, but interrupts can still preempt (temporarily) the mainline code. So all you need to protect against are interrupts. splhigh() effectively disables interrupts - because an interrupt might call code that conflicts with the mainline code in question. There are places in the mainline code that interrupts never touch where the mainline code thus does not bother to use splhigh() or any spl*() stuff at all. There are other places in the mainline code that are also called from interrupts and that is where the spl*() protection is required. In -current the situation is vastly different. Involuntary context switches can occur at almost any time and more then one cpu may be running kernel code at any given instance, so structures must be protected by mutexes at all times. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message