Fix a silly bogon which prevented all the CPUs that are tagged as interrupt

receivers from being given interrupts if any CPUs in the system were not
tagged as interrupt receivers that I introduced when switching the x86
interrupt code to track CPUs via FreeBSD CPU IDs rather than local APIC
IDs.  In practice this only affects systems with Hyperthreading (though
disabling HTT in the BIOS would workaround the issue) as that is the only
case currently where one can have CPUs that aren't tagged as interrupt
receivers.  On a Dell SC1425 test box with 2 x Xeon w/ HTT (so 4 logical
CPUs of which 2 were interrupt receivers) the result was that all
device interrupts were sent to CPU 0.

MFC after:	1 week
Pointy hat to:	jhb
This commit is contained in:
John Baldwin 2008-03-14 03:44:42 +00:00
parent ae667c3df0
commit c9107e85d9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177160
2 changed files with 8 additions and 8 deletions

View File

@ -48,6 +48,7 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/smp.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/sx.h>
@ -536,7 +537,7 @@ DB_SHOW_COMMAND(irqs, db_show_irqs)
/* The BSP is always a valid target. */
static cpumask_t intr_cpus = (1 << 0);
static int current_cpu, num_cpus = 1;
static int current_cpu;
static void
intr_assign_next_cpu(struct intsrc *isrc)
@ -552,7 +553,7 @@ intr_assign_next_cpu(struct intsrc *isrc)
pic->pic_assign_cpu(isrc, apic_id);
do {
current_cpu++;
if (current_cpu >= num_cpus)
if (current_cpu > mp_maxid)
current_cpu = 0;
} while (!(intr_cpus & (1 << current_cpu)));
}
@ -572,7 +573,6 @@ intr_add_cpu(u_int cpu)
cpu_apic_ids[cpu]);
intr_cpus |= (1 << cpu);
num_cpus++;
}
/*
@ -586,7 +586,7 @@ intr_shuffle_irqs(void *arg __unused)
int i;
/* Don't bother on UP. */
if (num_cpus <= 1)
if (mp_ncpus == 1)
return;
/* Round-robin assign a CPU to each enabled source. */

View File

@ -47,6 +47,7 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/smp.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/sx.h>
@ -512,7 +513,7 @@ DB_SHOW_COMMAND(irqs, db_show_irqs)
/* The BSP is always a valid target. */
static cpumask_t intr_cpus = (1 << 0);
static int current_cpu, num_cpus = 1;
static int current_cpu;
static void
intr_assign_next_cpu(struct intsrc *isrc)
@ -528,7 +529,7 @@ intr_assign_next_cpu(struct intsrc *isrc)
pic->pic_assign_cpu(isrc, apic_id);
do {
current_cpu++;
if (current_cpu >= num_cpus)
if (current_cpu > mp_maxid)
current_cpu = 0;
} while (!(intr_cpus & (1 << current_cpu)));
}
@ -548,7 +549,6 @@ intr_add_cpu(u_int cpu)
cpu_apic_ids[cpu]);
intr_cpus |= (1 << cpu);
num_cpus++;
}
/*
@ -562,7 +562,7 @@ intr_shuffle_irqs(void *arg __unused)
int i;
/* Don't bother on UP. */
if (num_cpus <= 1)
if (mp_ncpus == 1)
return;
/* Round-robin assign a CPU to each enabled source. */