From owner-freebsd-smp Sat Apr 5 09:14:39 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id JAA17167 for smp-outgoing; Sat, 5 Apr 1997 09:14:39 -0800 (PST) Received: from critter.dk.tfs.com (phk.cybercity.dk [195.8.133.247]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id JAA17157; Sat, 5 Apr 1997 09:14:33 -0800 (PST) Received: from critter (localhost [127.0.0.1]) by critter.dk.tfs.com (8.8.5/8.8.5) with ESMTP id TAA03845; Sat, 5 Apr 1997 19:13:25 +0200 (CEST) To: cr@jcmax.com (Cyrus Rahman) cc: smp@freebsd.org Subject: Re: Questions about mp_lock In-reply-to: Your message of "Sat, 05 Apr 1997 11:17:25 CDT." <9704051617.AA05092@corona.jcmax.com> Date: Sat, 05 Apr 1997 19:13:25 +0200 Message-ID: <3843.860260405@critter> From: Poul-Henning Kamp Sender: owner-smp@freebsd.org X-Loop: FreeBSD.org Precedence: bulk In message <9704051617.AA05092@corona.jcmax.com>, Cyrus Rahman writes: >Could someone who had a hand in implementing the SMP kernel give me a hint >about why the mp_lock count gets stored in the proc/user structure and >switched out in cpu_switch()? Because it has to match the sequence of calls on the kernelstack. Remember: we can enter the protected space by syscall, (page-)fault or interrupt, and one doesn't prevent the others. >Seems kind of weird, since I would expect that a process getting switched in >or out would always posses exactly one lock, and that any others would be >the result of interrupts. But it does appear that something more complicated >is going on, and I can't exactly figure out what it is. It >is< weird, but it works great. No, it's not that simple. We could probably have done it that way too, but it would cost more time & code in various already not very nice pieces of assembler code. -- Poul-Henning Kamp | phk@FreeBSD.ORG FreeBSD Core-team. http://www.freebsd.org/~phk | phk@login.dknet.dk Private mailbox. whois: [PHK] | phk@tfs.com TRW Financial Systems, Inc. Power and ignorance is a disgusting cocktail.