Date: Tue, 03 Jul 2001 02:37:41 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: "E.B. Dreger" <eddy+public+spam@noc.everquick.net> Cc: Bernd Walter <ticso@mail.cicely.de>, Peter Pentchev <roam@orbitel.bg>, Chris Costello <chris@calldei.com>, freebsd-smp@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: libc_r locking... why? Message-ID: <3B419265.A6A1316D@mindspring.com> References: <Pine.LNX.4.20.0106291838250.12068-100000@www.everquick.net>
next in thread | previous in thread | raw e-mail | index | archive | help
"E.B. Dreger" wrote: > Any good references on MP standard? Is the lock prefix > the only way to force cache coherency? Cache coherency is managed by the MESI (modified, exclusive, shared, invalid) protocol, in hardware. The basic issue that the lock addresses is provision of a barrier instruction, so that two processes (the original one, and the result of the rfork) don't try to enter a critical section at the same time (for example, a race to lock an fd or muck with signals), and the data cache is forced to be invalidated, even if the data is already in the pipeline (that's what the barrier instruction buys you). Generally, you will use a LOCK CMPXCHG to implement MP safe mutexes in user space. If you look at the kernel SMP locking, you can probably just take that code and use it, unmodified. The reason you need to do this is that the locking in the libc_r which you are using as a basis is not MP safe: it won't prevent one processor and the other from causing a race condition in user space as a result of two or more processors being in user space in the same VM at the same time. You can download the multiprocessing section of the Pentium programmers guide from the Intel web site; it has all the information on the APIC and other guts that make SMP possible. You can also download the Intel Multiprocessing specification, version 1.4, from their web site: http://developer.intel.com/design/PentiumII/manuals/24319002.PDF http://developer.intel.com/design/PentiumII/manuals/24319202.pdf http://developer.intel.com/design/pro/datashts/24201606.pdf The last one is the MP Spec, version 1.4. Note: These are some hulking big files, so don't try to download them over a slow link, unless you are willing to wait a very long time (e.g. hours, for all of them). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B419265.A6A1316D>