Interrupt Affinity Tool: INTBIND

Purpose:

The affinity tool may be used on Multiprocessor systems to affinitize 
interrupts of disk or network adapters to one or more processors.  
Affinitizing interrupts to a processor can improve system performance 
by improving processor cache locality.

Installation:

To install the intbind driver, copy all files to a directory and change
directory to that directory. Run INSTALL.BAT and reboot the system.

Usage:
On Windows NT 4.0 systems, install the intbind tool and reboot the system.
Use the -g option to display the current affinity settings for all enabled 
device interrupts. The -g option prints the device names and processor affinity
masks associated with all interrupt vectors enabled in the system interrupt 
controllers. If more than one device shares an interrupt vector, the -g option 
prints a  semi-colon separated list of device names(upto a maximum of 127 
characters) associated with that vector. Sample output for a  typical 4
processor system is given below:

Bus         Bus   System  Proc      Device
Type      Number  Vector  Affinity  Name
---------------------------------------------
Eisa         0     0x81    0xf      i8042prt: KeyboardPort0
Eisa         0     0xa1    0xf      Serial: Serial0
Eisa         0     0xd1    0x1      MPS 1.4 - APIC platform
PCI          1     0x51    0xf      aic78xx: ScsiPort0; aic78xx: ScsiPort1
Eisa         0     0x71    0xf      i8042prt: KeyboardPort0



Use the -p option to change the destination processor affinity for a device. 
The -p option takes as input the vector number as printed by the -g option 
and the desired processor affinity mask for that vector. The affinity mask 
has a bit set for each processor that interrupts should be affinitized to. In 
the following example, the adapter(s) at vector 0x51 are affinitized to the 
1st processor, adapters at vector 0x71 are affinitized to the 2nd processor, 
adapters(s) at vector 0x81 are affinitized to the 3rd processor and adapters 
at vector 0xA1 are affinitized to the 4th processor:

intbind -p 0x51 1
intbind -p 0x71 2
intbind -p 0x81 4
intbind -p 0xa1 8

Interrupt affinity settings made with the interrupt affinity tool are NOT 
saved between boots so it is necessary to enter the interrupt bindings each 
time the system is booted. It is useful to create command procedures such as 
d3.cmd and d4.cmd with the desired affinity settings to use each time the 
system is booted. If the Vector for any device for which interrupt affinity 
is used changes, it is necessary to modify the interrupt affinity setting used 
for the device. Be careful not to affinitize interrupts of devices that are 
not network or disk devices.

For network adapters that have NDIS miniport drivers, performance can be 
improved by affinitizing interrupts and DPCs to a processor.  For NDIS miniport 
drivers, you can affinitize network DPCs to the interrupt by setting the 
ProcessorAffinityMask to 0 in 
HKLM\SYSTEM\CurrentControlSet\Services\NDIS\Parameters

Risks:

 - The -p option should be used to change the destination processor affinity 
   for a device only when the device is not actively generating interrupts. 
   Changing the processor affinity while the device is active can cause the
   system to stop responding.  If this happens, a reboot will correct the 
   problem and you may attempt to set the processor destination affinity again 
   when the device is inactive.

 - If interrupts are bound to processors such that the processors have uneven 
   loads, one or more processors on the system may have higher cpu utilization 
   than the others which could reduce overall system throughput. If this 
   happens redistribute the interrupts to achieve a balanced load on the system.

 - For some non-disk and non-network devices, setting affinity to a particular 
   processor can cause the system to stop responding.  If this happens a reboot
   will correct the problem because the interrupt settings are not retained 
   between boots. 

 - If system load changes over time the interrupt affinity may be changed at 
   any point in time using the "intbind -p" command.  


Assumptions:

Rev 0.2 of the interrupt affinity tool. This tool picks up information about
the interrupt controllers present in the system from the MPS(Multiprocessor
Specification 1.1 or higher) table built by the system BIOS. If the system is 
not MPS compliant, the tool defaults to the assumption that there is a single 
IO APIC interrupt controller in the system mapped at physical address 
0xFEC00000. The IO APIC is assumed to have 16 interrupt pins. If your system
is not MPS compliant and in addition these assumptions are not valid for your 
system, use of this tool can lead to unpredictable and incorrect behavior. 

Disclaimer:

The interrupt affinity tool is an unsupported tool that you may use at your own 
risk.  

Removing INTBIND:

To remove intbind from a system delete the intbind key from the registry under
HKLM\SYSTEM\CurrentControlSet\Services
and remove the intbind.sys driver from %systemroot%\system32\drivers

