From owner-svn-src-head@freebsd.org Fri Aug 11 12:45:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B0EDCC8BE; Fri, 11 Aug 2017 12:45:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B617A7084A; Fri, 11 Aug 2017 12:45:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BCjwXP081417; Fri, 11 Aug 2017 12:45:58 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BCjwPV081416; Fri, 11 Aug 2017 12:45:58 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708111245.v7BCjwPV081416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 11 Aug 2017 12:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322400 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 12:46:00 -0000 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++;