Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Aug 2013 01:10:33 +0000 (UTC)
From:      Scott Long <scottl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254117 - head/sys/dev/mps
Message-ID:  <201308090110.r791AXv2049466@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scottl
Date: Fri Aug  9 01:10:33 2013
New Revision: 254117
URL: http://svnweb.freebsd.org/changeset/base/254117

Log:
  Rate limit the 'out of chain frame' messages to once per 60 seconds.
  
  Obtained from:	Netflix
  MFC after:	3 days

Modified:
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mps/mps.c
==============================================================================
--- head/sys/dev/mps/mps.c	Fri Aug  9 01:09:02 2013	(r254116)
+++ head/sys/dev/mps/mps.c	Fri Aug  9 01:10:33 2013	(r254117)
@@ -123,6 +123,9 @@ typedef union _reply_descriptor {
         } u;
 }reply_descriptor,address_descriptor;
 
+/* Rate limit chain-fail messages to 1 per minute */
+static struct timeval mps_chainfail_interval = { 60, 0 };
+
 /* 
  * sleep_flag can be either CAN_SLEEP or NO_SLEEP.
  * If this function is called from process context, it can sleep
@@ -1467,6 +1470,7 @@ mps_attach(struct mps_softc *sc)
 	mtx_init(&sc->mps_mtx, "MPT2SAS lock", NULL, MTX_DEF);
 	callout_init_mtx(&sc->periodic, &sc->mps_mtx, 0);
 	TAILQ_INIT(&sc->event_list);
+	timevalclear(&sc->lastfail);
 
 	if ((error = mps_transition_ready(sc)) != 0) {
 		mps_printf(sc, "%s failed to transition ready\n", __func__);
@@ -2413,8 +2417,9 @@ mps_data_cb(void *arg, bus_dma_segment_t
 		    sflags, nsegs - i);
 		if (error != 0) {
 			/* Resource shortage, roll back! */
-			mps_dprint(sc, MPS_INFO, "Out of chain frames, "
-			    "consider increasing hw.mps.max_chains.\n");
+			if (ratecheck(&sc->lastfail, &mps_chainfail_interval))
+				mps_dprint(sc, MPS_INFO, "Out of chain frames, "
+				    "consider increasing hw.mps.max_chains.\n");
 			cm->cm_flags |= MPS_CM_FLAGS_CHAIN_FAILED;
 			mps_complete_command(sc, cm);
 			return;

Modified: head/sys/dev/mps/mpsvar.h
==============================================================================
--- head/sys/dev/mps/mpsvar.h	Fri Aug  9 01:09:02 2013	(r254116)
+++ head/sys/dev/mps/mpsvar.h	Fri Aug  9 01:10:33 2013	(r254117)
@@ -416,6 +416,7 @@ struct mps_softc {
 	struct mps_column_map		DD_column_map[MPS_MAX_DISKS_IN_VOL];
 
 	char				exclude_ids[80];
+	struct timeval			lastfail;
 };
 
 struct mps_config_params {



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