From owner-cvs-src@FreeBSD.ORG Tue Feb 12 11:03:29 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9685416A418; Tue, 12 Feb 2008 11:03:29 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8034F13C43E; Tue, 12 Feb 2008 11:03:29 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1CB3TWl060826; Tue, 12 Feb 2008 11:03:29 GMT (envelope-from raj@repoman.freebsd.org) Received: (from raj@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1CB3TqS060825; Tue, 12 Feb 2008 11:03:29 GMT (envelope-from raj) Message-Id: <200802121103.m1CB3TqS060825@repoman.freebsd.org> From: Rafal Jaworowski Date: Tue, 12 Feb 2008 11:03:29 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/dev/usb usbdi.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Feb 2008 11:03:29 -0000 raj 2008-02-12 11:03:29 UTC FreeBSD src repository Modified files: sys/dev/usb usbdi.c Log: Eliminate BUS_DMA <-> cache incoherencies in USB transfers. With write-allocate cache we get into the following scenario: 1. data has been updated in the memory by the USB HC, but 2. D-cache holds an un-flushed value of it 3. when affected cache line is being replaced, the old (un-flushed) value is flushed and overwrites the newly arrived This is possible due to how write-allocate works with virtual caches (ARM for example). In case of USB transfers it leads to fatal tags discrepancies in umass(4) operation, which look like the following: umass0: Invalid CSW: tag 1 should be 2 (probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR (probe0:umass-sim0:0:0:0): Retrying Command umass0: Invalid CSW: tag 1 should be 3 (probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR (probe0:umass-sim0:0:0:0): Retrying Command umass0: Invalid CSW: tag 1 should be 4 (probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR (probe0:umass-sim0:0:0:0): Retrying Command umass0: Invalid CSW: tag 1 should be 5 (probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR (probe0:umass-sim0:0:0:0): Retrying Command umass0: Invalid CSW: tag 1 should be 6 (probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR (probe0:umass-sim0:0:0:0): error 5 (probe0:umass-sim0:0:0:0): Retries Exausted To eliminate this, a BUS_DMASYNC_PREREAD sync operation is required in usbd_start_transfer(). Credits for nailing this down go to Grzegorz Bernacki gjb AT semihalf DOT com. Reviewed by: imp Approved by: cognet (mentor) Revision Changes Path 1.104 +2 -1 src/sys/dev/usb/usbdi.c