Subject: Re: isp(4) with Q-Logic 2340 suffers "stray interrupts" under load
To: NetBSD Kernel Technical Discussion List <tech-kern@NetBSD.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: port-alpha
Date: 03/28/2005 20:08:26
--Apple-Mail-1-618120671
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed


On Mar 28, 2005, at 3:48 PM, Greg A. Woods wrote:

> I guess if there really is some tangible benefit to disabling IRQs  
> that
> generate a lot of strays and never get handled then this change  
> could be
> propogated to the pci_6600 code (and wherever else it's missing)  
> instead
> of just commenting out the disabling code as I've done for now.....

I just checked in the attached (minimally invasive) patch, and will  
request pullups to the netbsd-2 and netbsd-3 branches.

-- thorpej


--Apple-Mail-1-618120671
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	x-mac-type=54455854;
	x-unix-mode=0755;
	x-mac-creator=74747874;
	name="alpha-strays-patch.txt"
Content-Disposition: attachment;
	filename=alpha-strays-patch.txt

Index: common/shared_intr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/common/shared_intr.c,v
retrieving revision 1.16
diff -u -p -r1.16 shared_intr.c
--- common/shared_intr.c	27 Jul 2001 00:25:19 -0000	1.16
+++ common/shared_intr.c	29 Mar 2005 04:03:18 -0000
@@ -245,6 +245,18 @@ alpha_shared_intr_set_maxstrays(struct a
 }
 
 void
+alpha_shared_intr_reset_strays(struct alpha_shared_intr *intr,
+    unsigned int num)
+{
+
+	/*
+	 * Don't bother blocking interrupts; this doesn't have to be
+	 * precise, but it does need to be fast.
+	 */
+	intr[num].intr_nstrays = 0;
+}
+
+void
 alpha_shared_intr_stray(struct alpha_shared_intr *intr, unsigned int num,
     const char *basename)
 {
Index: include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/include/intr.h,v
retrieving revision 1.49
diff -u -p -r1.49 intr.h
--- include/intr.h	27 Jul 2001 00:25:19 -0000	1.49
+++ include/intr.h	29 Mar 2005 04:03:19 -0000
@@ -300,6 +300,8 @@ void	alpha_shared_intr_set_dfltsharetype
 	    unsigned int, int);
 void	alpha_shared_intr_set_maxstrays(struct alpha_shared_intr *,
 	    unsigned int, int);
+void	alpha_shared_intr_reset_strays(struct alpha_shared_intr *,
+	    unsigned int);
 void	alpha_shared_intr_stray(struct alpha_shared_intr *, unsigned int,
 	    const char *);
 void	alpha_shared_intr_set_private(struct alpha_shared_intr *,
Index: pci/pci_1000.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_1000.c,v
retrieving revision 1.14
diff -u -p -r1.14 pci_1000.c
--- pci/pci_1000.c	27 Sep 2002 15:35:37 -0000	1.14
+++ pci/pci_1000.c	29 Mar 2005 04:03:19 -0000
@@ -275,7 +275,8 @@ dec_1000_iointr(arg, vec)
 		    "dec_1000 irq");
 		if (ALPHA_SHARED_INTR_DISABLE(dec_1000_pci_intr, irq))
 			dec_1000_disable_intr(irq);
-	}
+	} else
+		alpha_shared_intr_reset_strays(dec_1000_pci_intr, irq);
 }
 
 /*
Index: pci/pci_1000a.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_1000a.c,v
retrieving revision 1.16
diff -u -p -r1.16 pci_1000a.c
--- pci/pci_1000a.c	27 Sep 2002 15:35:37 -0000	1.16
+++ pci/pci_1000a.c	29 Mar 2005 04:03:19 -0000
@@ -296,7 +296,8 @@ dec_1000a_iointr(framep, vec)
 		    "dec_1000a irq");
 		if (ALPHA_SHARED_INTR_DISABLE(dec_1000a_pci_intr, irq))
 			dec_1000a_disable_intr(irq);
-	}
+	} else
+		alpha_shared_intr_reset_strays(dec_1000a_pci_intr, irq);
 }
 
 /*
Index: pci/pci_2100_a500.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_2100_a500.c,v
retrieving revision 1.5
diff -u -p -r1.5 pci_2100_a500.c
--- pci/pci_2100_a500.c	27 Sep 2002 15:35:37 -0000	1.5
+++ pci/pci_2100_a500.c	29 Mar 2005 04:03:20 -0000
@@ -662,7 +662,8 @@ dec_2100_a500_iointr(void *arg, u_long v
 		alpha_shared_intr_stray(tcp->tc_intrtab, irq, "T2 irq");
 		if (ALPHA_SHARED_INTR_DISABLE(tcp->tc_intrtab, irq))
 			(*tcp->tc_enable_intr)(tcp, irq, 0);
-	}
+	} else
+		alpha_shared_intr_reset_strays(tcp->tc_intrtab, irq);
 }
 
 void
Index: pci/pci_550.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_550.c,v
retrieving revision 1.24
diff -u -p -r1.24 pci_550.c
--- pci/pci_550.c	27 Sep 2002 15:35:37 -0000	1.24
+++ pci/pci_550.c	29 Mar 2005 04:03:20 -0000
@@ -419,7 +419,8 @@ dec_550_iointr(arg, vec)
 		    "dec 550 irq");
 		if (ALPHA_SHARED_INTR_DISABLE(dec_550_pci_intr, irq))
 			dec_550_intr_disable(irq);
-	}
+	} else
+		alpha_shared_intr_reset_strays(dec_550_pci_intr, irq);
 }
 
 void
Index: pci/pci_6600.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_6600.c,v
retrieving revision 1.10
diff -u -p -r1.10 pci_6600.c
--- pci/pci_6600.c	27 Sep 2002 15:35:38 -0000	1.10
+++ pci/pci_6600.c	29 Mar 2005 04:03:20 -0000
@@ -301,7 +301,8 @@ dec_6600_iointr(arg, vec)
 		    irqtype);
 		if (ALPHA_SHARED_INTR_DISABLE(dec_6600_pci_intr, irq))
 			dec_6600_intr_disable(irq);
-	}
+	} else
+		alpha_shared_intr_reset_strays(dec_6600_pci_intr, irq);
 }
 
 void
Index: pci/pci_eb164.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_eb164.c,v
retrieving revision 1.32
diff -u -p -r1.32 pci_eb164.c
--- pci/pci_eb164.c	27 Sep 2002 15:35:38 -0000	1.32
+++ pci/pci_eb164.c	29 Mar 2005 04:03:21 -0000
@@ -371,7 +371,8 @@ eb164_iointr(arg, vec)
 		    "eb164 irq");
 		if (ALPHA_SHARED_INTR_DISABLE(eb164_pci_intr, irq))
 			eb164_intr_disable(irq);
-	}
+	} else
+		alpha_shared_intr_reset_strays(eb164_pci_intr, irq);
 }
 
 #if 0		/* THIS DOES NOT WORK!  see pci_eb164_intr.S. */
Index: pci/pci_eb64plus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_eb64plus.c,v
retrieving revision 1.12
diff -u -p -r1.12 pci_eb64plus.c
--- pci/pci_eb64plus.c	27 Sep 2002 15:35:38 -0000	1.12
+++ pci/pci_eb64plus.c	29 Mar 2005 04:03:21 -0000
@@ -280,7 +280,8 @@ eb64plus_iointr(arg, vec)
 		    "eb64+ irq");
 		if (ALPHA_SHARED_INTR_DISABLE(eb64plus_pci_intr, irq))
 			eb64plus_intr_disable(irq);
-	}
+	} else
+		alpha_shared_intr_reset_strays(eb64plus_pci_intr, irq);
 }
 
 #if 0		/* THIS DOES NOT WORK!  see pci_eb64plus_intr.S. */
Index: pci/pci_eb66.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_eb66.c,v
retrieving revision 1.12
diff -u -p -r1.12 pci_eb66.c
--- pci/pci_eb66.c	27 Sep 2002 15:35:38 -0000	1.12
+++ pci/pci_eb66.c	29 Mar 2005 04:03:21 -0000
@@ -279,7 +279,8 @@ eb66_iointr(arg, vec)
 		    "eb66 irq");
 		if (ALPHA_SHARED_INTR_DISABLE(eb66_pci_intr, irq))
 			eb66_intr_disable(irq);
-	}
+	} else
+		alpha_shared_intr_reset_strays(eb66_pci_intr, irq);
 }
 
 #if 0		/* THIS DOES NOT WORK!  see pci_eb66_intr.S. */
Index: pci/pci_kn20aa.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_kn20aa.c,v
retrieving revision 1.44
diff -u -p -r1.44 pci_kn20aa.c
--- pci/pci_kn20aa.c	27 Sep 2002 15:35:38 -0000	1.44
+++ pci/pci_kn20aa.c	29 Mar 2005 04:03:21 -0000
@@ -277,7 +277,8 @@ kn20aa_iointr(arg, vec)
 		    "kn20aa irq");
 		if (ALPHA_SHARED_INTR_DISABLE(kn20aa_pci_intr, irq))
 			kn20aa_disable_intr(irq);
-	}
+	} else
+		alpha_shared_intr_reset_strays(kn20aa_pci_intr, irq);
 }
 
 void
Index: pci/pci_kn300.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/pci_kn300.c,v
retrieving revision 1.26
diff -u -p -r1.26 pci_kn300.c
--- pci/pci_kn300.c	6 Jul 2004 13:36:19 -0000	1.26
+++ pci/pci_kn300.c	29 Mar 2005 04:03:21 -0000
@@ -252,7 +252,7 @@ kn300_iointr(arg, vec)
 		 * reset the stray interrupt count- elsewise a slow leak
 		 * over time will cause this level to be shutdown.
 		 */
-		alpha_shared_intr_set_maxstrays(kn300_pci_intr, irq, 25);
+		alpha_shared_intr_reset_strays(kn300_pci_intr, irq);
 		return;
 	}
 
Index: pci/sio_pic.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/sio_pic.c,v
retrieving revision 1.32
diff -u -p -r1.32 sio_pic.c
--- pci/sio_pic.c	1 Jul 2004 18:46:49 -0000	1.32
+++ pci/sio_pic.c	29 Mar 2005 04:03:22 -0000
@@ -548,6 +548,8 @@ sio_iointr(arg, vec)
 
 	if (!alpha_shared_intr_dispatch(sio_intr, irq))
 		alpha_shared_intr_stray(sio_intr, irq, "isa irq");
+	else
+		alpha_shared_intr_reset_strays(sio_intr, irq);
 
 	/*
 	 * Some versions of the machines which use the SIO

--Apple-Mail-1-618120671--