svn commit: r358307 - in head/sys: contrib/ncsw/inc contrib/ncsw/user/env dev/dpaa

Brandon Bergren bdragon at FreeBSD.org
Tue Feb 25 03:35:53 UTC 2020


Author: bdragon
Date: Tue Feb 25 03:35:52 2020
New Revision: 358307
URL: https://svnweb.freebsd.org/changeset/base/358307

Log:
  [PowerPC] [Book-E] Fix dpaa interrupt binding.
  
  After the network epoch was added, we lost the ability to migrate the
  ithread in the middle of dispatch, as being in the network epoch will pin
  the current thread (for safety reasons.)
  
  Luckily, we don't actually have to do this workaround in the first place,
  as we can just bind it to the correct cpu when we preallocate it.
  
  Pass dev through to XX_PreallocAndBindIntr() and actually bind it to the
  cpu like it was supposed to in the first place, instad of leaving it
  floating and moving it to the correct cpu the first time it fires.
  
  This fixes panics while bringing up dtsec on my X5000.
  
  Reviewed by:	jhibbits
  Sponsored by:	Tag1 Consulting, Inc.
  Differential Revision:	https://reviews.freebsd.org/D23826

Modified:
  head/sys/contrib/ncsw/inc/xx_ext.h
  head/sys/contrib/ncsw/user/env/xx.c
  head/sys/dev/dpaa/portals_common.c

Modified: head/sys/contrib/ncsw/inc/xx_ext.h
==============================================================================
--- head/sys/contrib/ncsw/inc/xx_ext.h	Tue Feb 25 02:42:43 2020	(r358306)
+++ head/sys/contrib/ncsw/inc/xx_ext.h	Tue Feb 25 03:35:52 2020	(r358307)
@@ -205,7 +205,7 @@ uint32_t XX_DisableAllIntr(void);
 void XX_RestoreAllIntr(uint32_t flags);
 
 
-t_Error XX_PreallocAndBindIntr(uintptr_t irq, unsigned int cpu);
+t_Error XX_PreallocAndBindIntr(device_t dev, uintptr_t irq, unsigned int cpu);
 t_Error XX_DeallocIntr(uintptr_t irq);
 
 /**************************************************************************//**

Modified: head/sys/contrib/ncsw/user/env/xx.c
==============================================================================
--- head/sys/contrib/ncsw/user/env/xx.c	Tue Feb 25 02:42:43 2020	(r358306)
+++ head/sys/contrib/ncsw/user/env/xx.c	Tue Feb 25 03:35:52 2020	(r358307)
@@ -95,8 +95,7 @@ MTX_SYSINIT(XX_MallocTrackLockInit, &XX_MallocTrackLoc
 
 /* Interrupt info */
 #define XX_INTR_FLAG_PREALLOCATED	(1 << 0)
-#define XX_INTR_FLAG_BOUND		(1 << 1)
-#define XX_INTR_FLAG_FMAN_FIX		(1 << 2)
+#define XX_INTR_FLAG_FMAN_FIX		(1 << 1)
 
 struct XX_IntrInfo {
 	driver_intr_t	*handler;
@@ -320,16 +319,6 @@ XX_Dispatch(void *arg)
 
 	info = arg;
 
-	/* Bind this thread to proper CPU when SMP has been already started. */
-	if ((info->flags & XX_INTR_FLAG_BOUND) == 0 && smp_started &&
-	    info->cpu >= 0) {
-		thread_lock(curthread);
-		sched_bind(curthread, info->cpu);
-		thread_unlock(curthread);
-
-		info->flags |= XX_INTR_FLAG_BOUND;
-	}
-
 	if (info->handler == NULL) {
 		printf("%s(): IRQ handler is NULL!\n", __func__);
 		return;
@@ -339,7 +328,7 @@ XX_Dispatch(void *arg)
 }
 
 t_Error
-XX_PreallocAndBindIntr(uintptr_t irq, unsigned int cpu)
+XX_PreallocAndBindIntr(device_t dev, uintptr_t irq, unsigned int cpu)
 {
 	struct resource *r;
 	unsigned int inum;
@@ -349,6 +338,10 @@ XX_PreallocAndBindIntr(uintptr_t irq, unsigned int cpu
 	inum = rman_get_start(r);
 
 	error = XX_SetIntr(irq, XX_Dispatch, &XX_IntrInfo[inum]);
+	if (error != 0)
+		return (error);
+
+	error = bus_bind_intr(dev, r, cpu);
 	if (error != 0)
 		return (error);
 

Modified: head/sys/dev/dpaa/portals_common.c
==============================================================================
--- head/sys/dev/dpaa/portals_common.c	Tue Feb 25 02:42:43 2020	(r358306)
+++ head/sys/dev/dpaa/portals_common.c	Tue Feb 25 03:35:52 2020	(r358307)
@@ -120,8 +120,7 @@ dpaa_portal_alloc_res(device_t dev, struct dpaa_portal
 		device_printf(dev, "Could not allocate irq.\n");
 		return (ENXIO);
 	}
-
-	err = XX_PreallocAndBindIntr((uintptr_t)sc->sc_dp[cpu].dp_ires, cpu);
+	err = XX_PreallocAndBindIntr(dev, (uintptr_t)sc->sc_dp[cpu].dp_ires, cpu);
 
 	if (err != E_OK) {
 		device_printf(dev, "Could not prealloc and bind interrupt\n");


More information about the svn-src-all mailing list