Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Aug 2017 12:45:58 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322400 - head/sys/kern
Message-ID:  <201708111245.v7BCjwPV081416@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708111245.v7BCjwPV081416>