Author: andrew
Date: Fri Aug 11 12:45:58 2017
New Revision: 322400
URL: https://svnweb.freebsd.org/changeset/base/322400

Log:
  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

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==============================================================================
--- head/sys/kern/subr_intr.c   Fri Aug 11 11:38:04 2017        (r322399)
+++ head/sys/kern/subr_intr.c   Fri Aug 11 12:45:58 2017        (r322400)
@@ -1169,9 +1169,17 @@ intr_bind_irq(device_t dev, struct resource *res, int 
 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++;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to