From mboxrd@z Thu Jan 1 00:00:00 1970 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-reply-to: Your message of "Fri, 01 Jul 2011 14:01:28 EDT." References: <20110701160026.0db036cd@leffe.cs.bell-labs.com> <83656e84a9290648e03a7e880786e132@ladd.quanstro.net> Date: Fri, 1 Jul 2011 11:35:12 -0700 From: Bakul Shah Message-Id: <20110701183512.CFF4DB84F@mail.bitblocks.com> Subject: Re: [9fans] why not halt in x86 multicore Topicbox-Message-UUID: f8fc3ab4-ead6-11e9-9d60-3106f5b1d025 On Fri, 01 Jul 2011 14:01:28 EDT erik quanstrom wrote: > > > > interprocessor interrupts are the obvious solution > > but no one has bothered to implement them. > > > > i almost mentioned this, and it's on my list. i just haven't > had the time. it turns out that a naive implementation of > ipi'ing 1 proc per wakeup will have to watch out for the > same races that bedeviled multiprocessor sleep/wakeup. > > the really naive solution of waking 'em all up is a very > bad idea because you'll have n-1 procs duking it out > over the run queue. > > perhaps i just ignorant of the standard solution. > or perhaps the sleep/wakeup model isn't the right one > for the situation. You might want to look at how FreeBSD does. http://fxr.watson.org/fxr/source/i386/i386/mp_machdep.c http://fxr.watson.org/fxr/source/i386/i386/machdep.c Robert Watson's excellent site has cross-referenced sources for a variety of OSes (including plan9) and releases for some of them. FreeBSD put in hlt for MP kernels in 2003 but the code has evolved since then. The commit logs may be of some use too. See the same files in http://www.freebsd.org/cgi/cvsweb.cgi