svn commit: r325667 - in head/sys/dev: mpr mps

Scott Long scottl at FreeBSD.org
Fri Nov 10 17:01:52 UTC 2017


Author: scottl
Date: Fri Nov 10 17:01:51 2017
New Revision: 325667
URL: https://svnweb.freebsd.org/changeset/base/325667

Log:
  Refactoring the interrupt setup code introduced a bug where the drivers
  would attempt to re-allocate interrupts during a chip reset without
  first de-allocating them.  Doing that right is going to be tricky, so
  just band-aid it for now so that a re-init doesn't guarantee a failure
  due to resource re-use.
  
  Reported by:	gallatin
  Sponsored by:	Netflix

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mps/mps.c

Modified: head/sys/dev/mpr/mpr.c
==============================================================================
--- head/sys/dev/mpr/mpr.c	Fri Nov 10 15:28:17 2017	(r325666)
+++ head/sys/dev/mpr/mpr.c	Fri Nov 10 17:01:51 2017	(r325667)
@@ -677,7 +677,11 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at
 		return (error);
 	}
 
-	if ((error = mpr_pci_setup_interrupts(sc)) != 0) {
+	/*
+	 * XXX If the number of MSI-X vectors changes during re-init, this
+	 * won't see it and adjust.
+	 */
+	if (attaching && (error = mpr_pci_setup_interrupts(sc)) != 0) {
 		mpr_dprint(sc, MPR_INIT|MPR_ERROR,
 		    "Failed to setup interrupts\n");
 		mpr_free(sc);

Modified: head/sys/dev/mps/mps.c
==============================================================================
--- head/sys/dev/mps/mps.c	Fri Nov 10 15:28:17 2017	(r325666)
+++ head/sys/dev/mps/mps.c	Fri Nov 10 17:01:51 2017	(r325667)
@@ -665,7 +665,11 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at
 		return (error);
 	}
 
-	if ((error = mps_pci_setup_interrupts(sc)) != 0) {
+	/*
+	 * XXX If the number of MSI-X vectors changes during re-init, this
+	 * won't see it and adjust.
+	 */
+	if (attaching && (error = mps_pci_setup_interrupts(sc)) != 0) {
 		mps_dprint(sc, MPS_INIT|MPS_FAULT, "Failed to setup "
 		    "interrupts\n");
 		mps_free(sc);


More information about the svn-src-all mailing list