Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 05 Apr 1997 19:13:25 +0200
From:      Poul-Henning Kamp <phk@critter.dk.tfs.com>
To:        cr@jcmax.com (Cyrus Rahman)
Cc:        smp@freebsd.org
Subject:   Re: Questions about mp_lock 
Message-ID:  <3843.860260405@critter>
In-Reply-To: Your message of "Sat, 05 Apr 1997 11:17:25 CDT." <9704051617.AA05092@corona.jcmax.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3843.860260405>