Re: SMP and setrunnable()- scheduler 4bsd

From: Terry Lambert <tlambert2_at_mindspring.com>
Date: Wed, 09 Jul 2003 00:22:23 -0700
Julian Elischer wrote:
> It looks tp me that if we make a thread runnable
> and there is a processor in the idle loop, the idle processor should be
> kicked in some way to make it go get the newly runnable thread.
> 
> If the processors are halting in the idle loop however, it may take
> quite a while for the new work to be noticed..
> (possibly up to milliseconds I think)
> 
> Is there a mechanism to send an IPI to particular processors?
> or is it just broadcast?

Yes.  Quoting:

	IA-32 Intel Architecture Developer's Manual
	Volume 3: System Programming Guide
	Chapter 8: Advanced Programmable Interrupt Controller (APIC)

	8.1. Local an I/O APIC Overview

	Each local APIC consists of a set of APIC registers (see Table
	8-1) and associated hardware that control the delivery of
	interrupts to the processor core and the generation of IPI
	messages.  The APIC registers are memory mapped and can be
	read and written to using the MOV instruction.

	The local APIC can receive interrupts from the following
	sources:
		[...]
	Inter-processor Interrupts (IPIs).  An IA-32 processor can
	use the IPI mechanism to interrup another processor or group
	of processors on the system bus.  IPIs are used for such
	things as software self-interrupts, interrupt forwarding, or
	preemptive scheduling.
		[...]
	The local APIC handles interrupts from the other two interrupt
	sources (externally connected I/O devices and IPIs) through
	its IPI message handling facilities.

	A processor can generate IPIs by programming the interrupt
	command register (ICR) in its local APIC (see Section 8.6.1.,
	"Interrupt Command Register (ICR)").  The act of writing to
	the ICR causes an IPI message to be generated and issued on
	the system bus (for Pentium 4 and Intel Xeon processors) or
	on the APIC bus (for Pentium and P6 family processors).

This book is Intel Order Number 245472-007.  I also recommend ordering
245470-007 ("IA-32 Intel Architecture Software Developer's Manual,
Volume 1: Basic Architecture") and 245471-007 ("IA-32 Intel Architecture
Software Developer's Manual, Volume 2: Instruction Set Reference").

These books are free to developers, and usually arrive within a couple
of days of when you order them, if you are in the U.S..  Sorry, I don't
think they ship outside the U.S., at least not for free.  Note that if
they have a run on them, they will likely start charging for them.

Volume 3 has been invaluable to me, so if you must get only one, get
that one.

-- Terry
Received on Tue Jul 08 2003 - 22:23:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:14 UTC