Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jun 2016 22:49:32 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302181 - head/sys/x86/x86
Message-ID:  <201606242249.u5OMnWbN019173@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Jun 24 22:49:32 2016
New Revision: 302181
URL: https://svnweb.freebsd.org/changeset/base/302181

Log:
  Add a tunable to disable migration of MSI-X interrupts.
  
  The new 'machdep.disable_msix_migration' tunable can be set to 1 to
  disable migration of MSI-X interrupts.
  
  Xen versions prior to 4.6.0 do not properly handle updates to MSI-X
  table entries after the initial write.  In particular, the operation
  to unmask a table entry after updating it during migration is not
  propagated to the "real" table for passthrough devices causing the
  interrupt to remain masked.  At least some systems in EC2 are
  affected by this bug when using SRIOV.  The tunable can be set in
  loader.conf as a workaround.
  
  Submitted by:	Jeremiah Lott <jlott@averesystems.com> (original patch)
  Approved by:	re (marius)
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D6947

Modified:
  head/sys/x86/x86/msi.c

Modified: head/sys/x86/x86/msi.c
==============================================================================
--- head/sys/x86/x86/msi.c	Fri Jun 24 21:44:46 2016	(r302180)
+++ head/sys/x86/x86/msi.c	Fri Jun 24 22:49:32 2016	(r302181)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/malloc.h>
 #include <sys/mutex.h>
 #include <sys/sx.h>
+#include <sys/sysctl.h>
 #include <sys/systm.h>
 #include <x86/apicreg.h>
 #include <machine/cputypes.h>
@@ -148,6 +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.
+ */
+static int msix_disable_migration = 0;
+SYSCTL_INT(_machdep, OID_AUTO, disable_msix_migration, CTLFLAG_RDTUN,
+    &msix_disable_migration, 0,
+    "Disable migration of MSI-X interrupts between CPUs");
+
 static int msi_enabled;
 static int msi_last_irq;
 static struct mtx msi_lock;
@@ -226,6 +237,9 @@ msi_assign_cpu(struct intsrc *isrc, u_in
 	if (msi->msi_first != msi)
 		return (EINVAL);
 
+	if (msix_disable_migration && msi->msi_msix)
+		return (EINVAL);
+
 	/* Store information to free existing irq. */
 	old_vector = msi->msi_vector;
 	old_id = msi->msi_cpu;



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