From owner-svn-src-all@freebsd.org Fri Jul 15 09:44:50 2016 Return-Path: Delivered-To: svn-src-all@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 41C1EB97A90; Fri, 15 Jul 2016 09:44:50 +0000 (UTC) (envelope-from royger@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 1E9A01709; Fri, 15 Jul 2016 09:44:50 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F9inqk072147; Fri, 15 Jul 2016 09:44:49 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F9inT1072143; Fri, 15 Jul 2016 09:44:49 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201607150944.u6F9inT1072143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Fri, 15 Jul 2016 09:44:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r302895 - in stable/11/sys: amd64/include i386/include x86/x86 x86/xen X-SVN-Group: stable-11 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.22 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: Fri, 15 Jul 2016 09:44:50 -0000 Author: royger Date: Fri Jul 15 09:44:48 2016 New Revision: 302895 URL: https://svnweb.freebsd.org/changeset/base/302895 Log: MFC r302635: xen: automatically disable MSI-X interrupt migration Approved by: re (kib) Modified: stable/11/sys/amd64/include/intr_machdep.h stable/11/sys/i386/include/intr_machdep.h stable/11/sys/x86/x86/msi.c stable/11/sys/x86/xen/hvm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/intr_machdep.h ============================================================================== --- stable/11/sys/amd64/include/intr_machdep.h Fri Jul 15 09:28:32 2016 (r302894) +++ stable/11/sys/amd64/include/intr_machdep.h Fri Jul 15 09:44:48 2016 (r302895) @@ -149,6 +149,8 @@ extern cpuset_t intr_cpus; extern struct mtx icu_lock; extern int elcr_found; +extern int msix_disable_migration; + #ifndef DEV_ATPIC void atpic_reset(void); #endif Modified: stable/11/sys/i386/include/intr_machdep.h ============================================================================== --- stable/11/sys/i386/include/intr_machdep.h Fri Jul 15 09:28:32 2016 (r302894) +++ stable/11/sys/i386/include/intr_machdep.h Fri Jul 15 09:44:48 2016 (r302895) @@ -140,6 +140,8 @@ extern cpuset_t intr_cpus; extern struct mtx icu_lock; extern int elcr_found; +extern int msix_disable_migration; + #ifndef DEV_ATPIC void atpic_reset(void); #endif Modified: stable/11/sys/x86/x86/msi.c ============================================================================== --- stable/11/sys/x86/x86/msi.c Fri Jul 15 09:28:32 2016 (r302894) +++ stable/11/sys/x86/x86/msi.c Fri Jul 15 09:44:48 2016 (r302895) @@ -149,12 +149,16 @@ struct pic msi_pic = { .pic_reprogram_pin = NULL, }; -/* +/** * Xen hypervisors prior to 4.6.0 do not properly handle updates to * enabled MSI-X table entries. Allow migration of MSI-X interrupts - * to be disabled via a tunable. + * to be disabled via a tunable. Values have the following meaning: + * + * -1: automatic detection by FreeBSD + * 0: enable migration + * 1: disable migration */ -static int msix_disable_migration = 0; +int msix_disable_migration = -1; SYSCTL_INT(_machdep, OID_AUTO, disable_msix_migration, CTLFLAG_RDTUN, &msix_disable_migration, 0, "Disable migration of MSI-X interrupts between CPUs"); @@ -312,6 +316,11 @@ msi_init(void) return; } + if (msix_disable_migration == -1) { + /* The default is to allow migration of MSI-X interrupts. */ + msix_disable_migration = 0; + } + msi_enabled = 1; intr_register_pic(&msi_pic); mtx_init(&msi_lock, "msi", NULL, MTX_DEF); Modified: stable/11/sys/x86/xen/hvm.c ============================================================================== --- stable/11/sys/x86/xen/hvm.c Fri Jul 15 09:28:32 2016 (r302894) +++ stable/11/sys/x86/xen/hvm.c Fri Jul 15 09:44:48 2016 (r302895) @@ -134,9 +134,29 @@ xen_hvm_init_hypercall_stubs(enum xen_hv return (ENXIO); if (init_type == XEN_HVM_INIT_COLD) { + int major, minor; + do_cpuid(base + 1, regs); - printf("XEN: Hypervisor version %d.%d detected.\n", - regs[0] >> 16, regs[0] & 0xffff); + + major = regs[0] >> 16; + minor = regs[0] & 0xffff; + printf("XEN: Hypervisor version %d.%d detected.\n", major, + minor); + + if (((major < 4) || (major == 4 && minor <= 5)) && + msix_disable_migration == -1) { + /* + * Xen hypervisors prior to 4.6.0 do not properly + * handle updates to enabled MSI-X table entries, + * so disable MSI-X interrupt migration in that + * case. + */ + if (bootverbose) + printf( +"Disabling MSI-X interrupt migration due to Xen hypervisor bug.\n" +"Set machdep.msix_disable_migration=0 to forcefully enable it.\n"); + msix_disable_migration = 1; + } } /*