From owner-p4-projects@FreeBSD.ORG Tue Aug 25 10:00:22 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 12DB91065691; Tue, 25 Aug 2009 10:00:22 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB84F106568D for ; Tue, 25 Aug 2009 10:00:21 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BAD218FC14 for ; Tue, 25 Aug 2009 10:00:21 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PA0LUJ030502 for ; Tue, 25 Aug 2009 10:00:21 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n7PA0LQK030500 for perforce@freebsd.org; Tue, 25 Aug 2009 10:00:21 GMT (envelope-from mav@freebsd.org) Date: Tue, 25 Aug 2009 10:00:21 GMT Message-Id: <200908251000.n7PA0LQK030500@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Cc: Subject: PERFORCE change 167779 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 10:00:22 -0000 http://perforce.freebsd.org/chv.cgi?CH=167779 Change 167779 by mav@mav_mavbook on 2009/08/25 10:00:01 With high request rates and long ATA timeouts it looks cheaper to ignore some rare obsoleted timeouts then bother with stopping them to rearm again in just a few milliseconds. Affected files ... .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#54 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#54 (text+ko) ==== @@ -851,6 +851,7 @@ for (i = 0; i < ch->numslots; i++) { struct ahci_slot *slot = &ch->slot[i]; + callout_drain(&slot->timeout); if (slot->dma.data_map) { bus_dmamap_destroy(ch->dma.data_tag, slot->dma.data_map); slot->dma.data_map = NULL; @@ -1246,6 +1247,10 @@ struct ahci_channel *ch = device_get_softc(dev); int i; + /* Check for stale timeout. */ + if (slot->state != AHCI_SLOT_RUNNING) + return; + device_printf(dev, "Timeout on slot %d\n", slot->slot); /* Kick controller into sane state. */ ahci_stop(ch->dev); @@ -1278,8 +1283,6 @@ struct ahci_channel *ch = device_get_softc(dev); union ccb *ccb = slot->ccb; - /* Cancel command execution timeout */ - callout_stop(&slot->timeout); bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, BUS_DMASYNC_POSTWRITE); /* Read result registers to the result struct