From owner-p4-projects@FreeBSD.ORG Tue Apr 30 15:51:17 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6EC8F103; Tue, 30 Apr 2013 15:51:17 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 32A94101 for ; Tue, 30 Apr 2013 15:51:17 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0986B1B46 for ; Tue, 30 Apr 2013 15:51:17 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3UFpGUi079024 for ; Tue, 30 Apr 2013 15:51:16 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3UFpGhg079021 for perforce@freebsd.org; Tue, 30 Apr 2013 15:51:16 GMT (envelope-from brooks@freebsd.org) Date: Tue, 30 Apr 2013 15:51:16 GMT Message-Id: <201304301551.r3UFpGhg079021@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 228253 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 15:51:17 -0000 http://p4web.freebsd.org/@@228253?ac=10 Change 228253 by brooks@brooks_zenith on 2013/04/30 15:50:28 Reduce the risk of spurious timeouts one busy systems by disabling interrupts when issuing write and erase commands. This has little or no performance impact with modern Intel flash that supports large block writes. Affected files ... .. //depot/projects/ctsrd/beribsd/src/sys/dev/cfi/cfi_core.c#12 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/sys/dev/cfi/cfi_core.c#12 (text+ko) ==== @@ -460,6 +460,7 @@ uint16_t *x16; uint32_t *x32; } ptr, cpyprt; + register_t intr; int error, i, neederase = 0; uint32_t st; u_int wlen; @@ -482,6 +483,7 @@ } if (neederase) { + intr = intr_disable(); binuptime(&start); /* Erase the block. */ switch (sc->sc_cmdset) { @@ -498,8 +500,10 @@ break; default: /* Better safe than sorry... */ + intr_restore(intr); return (ENODEV); } + intr_restore(intr); error = cfi_wait_ready(sc, sc->sc_wrofs, &start, CFI_TIMEOUT_ERASE); if (error) @@ -517,6 +521,8 @@ for (i = 0; i < sc->sc_wrbufsz; i += wlen) { wlen = MIN(sc->sc_maxbuf, sc->sc_wrbufsz - i); + intr = intr_disable(); + binuptime(&start); do { cfi_write(sc, sc->sc_wrofs + i, @@ -548,6 +554,8 @@ cfi_write(sc, sc->sc_wrofs + i, CFI_BCS_CONFIRM); + intr_restore(intr); + error = cfi_wait_ready(sc, sc->sc_wrofs + i, &start, CFI_TIMEOUT_BUFWRITE); } @@ -580,6 +588,13 @@ } } + /* + * Make sure the command to start a write and the + * actual write happens back-to-back without any + * excessive delays. + */ + intr = intr_disable(); + binuptime(&start); switch (sc->sc_cmdset) { case CFI_VEND_INTEL_ECS: @@ -605,6 +620,8 @@ sc->sc_wrofs + i, *(ptr.x32 + i / 4)); break; } + + intr_restore(intr); error = cfi_wait_ready(sc, sc->sc_wrofs, &start, CFI_TIMEOUT_WRITE);