From owner-svn-src-stable@FreeBSD.ORG Tue Nov 17 21:00:03 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4272A106566B; Tue, 17 Nov 2009 21:00:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 117028FC13; Tue, 17 Nov 2009 21:00:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHL02ur038436; Tue, 17 Nov 2009 21:00:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHL02nY038435; Tue, 17 Nov 2009 21:00:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200911172100.nAHL02nY038435@svn.freebsd.org> From: Alexander Motin Date: Tue, 17 Nov 2009 21:00:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199441 - stable/8/sys/dev/siis X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Nov 2009 21:00:03 -0000 Author: mav Date: Tue Nov 17 21:00:02 2009 New Revision: 199441 URL: http://svn.freebsd.org/changeset/base/199441 Log: MFC r198896: Do not unarm callout on request completion and change slot selection algorithm as done in ahci(4). This saves some CPU time on high request rates. Modified: stable/8/sys/dev/siis/siis.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Nov 17 20:59:00 2009 (r199440) +++ stable/8/sys/dev/siis/siis.c Tue Nov 17 21:00:02 2009 (r199441) @@ -641,6 +641,7 @@ siis_slotsfree(device_t dev) for (i = 0; i < SIIS_MAX_SLOTS; i++) { struct siis_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; @@ -838,15 +839,11 @@ siis_begin_transaction(device_t dev, uni mtx_assert(&ch->mtx, MA_OWNED); /* Choose empty slot. */ tag = ch->lastslot; - do { - tag++; - if (tag >= SIIS_MAX_SLOTS) + while (ch->slot[tag].state != SIIS_SLOT_EMPTY) { + if (++tag >= SIIS_MAX_SLOTS) tag = 0; - if (ch->slot[tag].state == SIIS_SLOT_EMPTY) - break; - } while (tag != ch->lastslot); - if (ch->slot[tag].state != SIIS_SLOT_EMPTY) - device_printf(ch->dev, "ALL SLOTS BUSY!\n"); + KASSERT(tag != ch->lastslot, ("siis: ALL SLOTS BUSY!")); + } ch->lastslot = tag; /* Occupy chosen slot. */ slot = &ch->slot[tag]; @@ -999,6 +996,9 @@ siis_timeout(struct siis_slot *slot) struct siis_channel *ch = device_get_softc(dev); mtx_assert(&ch->mtx, MA_OWNED); + /* Check for stale timeout. */ + if (slot->state < SIIS_SLOT_RUNNING) + return; device_printf(dev, "Timeout on slot %d\n", slot->slot); device_printf(dev, "%s is %08x ss %08x rs %08x es %08x sts %08x serr %08x\n", __func__, ATA_INL(ch->r_mem, SIIS_P_IS), ATA_INL(ch->r_mem, SIIS_P_SS), ch->rslots, @@ -1024,8 +1024,6 @@ siis_end_transaction(struct siis_slot *s union ccb *ccb = slot->ccb; mtx_assert(&ch->mtx, MA_OWNED); - /* 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