Only return the current cpu if it's in the cpumask. When we restrict the

cpumask it probably means we are unable to sent interrupts to CPUs outside
the map. As such only return the current CPU when it's within the mask
otherwise return the first valid CPU.

This is needed on ThunderX as, in a dual socket configuration, we are
unable to send MSI/MSI-X interrupts between sockets.

Reviewed by:	mmel
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11957
This commit is contained in:
Andrew Turner 2017-08-11 12:45:58 +00:00
parent ebf854802d
commit a92a2f00b1

View File

@ -1169,9 +1169,17 @@ intr_bind_irq(device_t dev, struct resource *res, int cpu)
u_int
intr_irq_next_cpu(u_int last_cpu, cpuset_t *cpumask)
{
u_int cpu;
if (!irq_assign_cpu || mp_ncpus == 1)
return (PCPU_GET(cpuid));
KASSERT(!CPU_EMPTY(cpumask), ("%s: Empty CPU mask", __func__));
if (!irq_assign_cpu || mp_ncpus == 1) {
cpu = PCPU_GET(cpuid);
if (CPU_ISSET(cpu, cpumask))
return (curcpu);
return (CPU_FFS(cpumask) - 1);
}
do {
last_cpu++;