diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-02-09 19:21:54 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-02-09 19:21:54 +0000 |
commit | 2cc0c7af021ffd25b46bfd6b8c087a7a62a5a40e (patch) | |
tree | f56a95d1a2dc3c15d037257c7e71c6ff8bd50793 /sys/powerpc/pseries | |
parent | effdf314c3a331e8f2532f7162fa226cf4e7f1d2 (diff) | |
download | FreeBSD-src-2cc0c7af021ffd25b46bfd6b8c087a7a62a5a40e.zip FreeBSD-src-2cc0c7af021ffd25b46bfd6b8c087a7a62a5a40e.tar.gz |
Distribute interrupts across multiple CPUs in SMP configurations instead of sending them
all to CPU 0.
Diffstat (limited to 'sys/powerpc/pseries')
-rw-r--r-- | sys/powerpc/pseries/xics.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/powerpc/pseries/xics.c b/sys/powerpc/pseries/xics.c index b09079a..f1a3c8b 100644 --- a/sys/powerpc/pseries/xics.c +++ b/sys/powerpc/pseries/xics.c @@ -197,13 +197,25 @@ xicp_bind(device_t dev, u_int irq, cpuset_t cpumask) { struct xicp_softc *sc = device_get_softc(dev); cell_t status, cpu; + int ncpus, i; /* - * This doesn't appear to actually support affinity groups, so just - * use the first CPU. + * This doesn't appear to actually support affinity groups, so pick a + * random CPU. */ CPU_FOREACH(cpu) - if (CPU_ISSET(cpu, &cpumask)) break; + if (CPU_ISSET(cpu, &cpumask)) ncpus++; + + i = mftb() % ncpus; + ncpus = 0; + CPU_FOREACH(cpu) { + if (!CPU_ISSET(cpu, &cpumask)) + continue; + if (ncpus == i) + break; + ncpus++; + } + rtas_call_method(sc->ibm_set_xive, 3, 1, irq, cpu, XICP_PRIORITY, &status); |