From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 13:25:22 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7B2E27A; Wed, 10 Dec 2014 13:25:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 93D0F7F; Wed, 10 Dec 2014 13:25:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBADPMTn081974; Wed, 10 Dec 2014 13:25:22 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBADPMgZ081973; Wed, 10 Dec 2014 13:25:22 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201412101325.sBADPMgZ081973@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 10 Dec 2014 13:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275679 - head/sys/x86/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 13:25:22 -0000 Author: royger Date: Wed Dec 10 13:25:21 2014 New Revision: 275679 URL: https://svnweb.freebsd.org/changeset/base/275679 Log: xen/intr: balance dynamic interrupts across available vCPUs By default Xen binds all event channels to vCPU#0, and FreeBSD only shuffles the interrupt sources once, at the end of the boot process. Since new event channels might be created after this point (because new devices or backends are added), try to automatically shuffle them at creation time. This does not affect VIRQ or IPI event channels, that are already bound to a specific vCPU as requested by the caller. Sponsored by: Citrix Systems R&D Modified: head/sys/x86/xen/xen_intr.c Modified: head/sys/x86/xen/xen_intr.c ============================================================================== --- head/sys/x86/xen/xen_intr.c Wed Dec 10 11:42:02 2014 (r275678) +++ head/sys/x86/xen/xen_intr.c Wed Dec 10 13:25:21 2014 (r275679) @@ -425,6 +425,17 @@ xen_intr_bind_isrc(struct xenisrc **isrc /* Assign the opaque handler (the event channel port) */ *port_handlep = &isrc->xi_port; +#ifdef SMP + if (type == EVTCHN_TYPE_PORT) { + /* + * By default all interrupts are assigned to vCPU#0 + * unless specified otherwise, so shuffle them to balance + * the interrupt load. + */ + xen_intr_assign_cpu(&isrc->xi_intsrc, intr_next_cpu()); + } +#endif + if (filter == NULL && handler == NULL) { /* * No filter/handler provided, leave the event channel