From owner-freebsd-mips@freebsd.org Tue Dec 22 11:31:57 2015 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18D67A4E080 for ; Tue, 22 Dec 2015 11:31:57 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "raven.bwct.de", Issuer "BWCT" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BCE491A1B; Tue, 22 Dec 2015 11:31:55 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from mail.cicely.de ([10.1.1.37]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id tBMBR1w7069186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 22 Dec 2015 12:27:09 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by mail.cicely.de (8.14.5/8.14.4) with ESMTP id tBMBQtlQ035157 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 22 Dec 2015 12:26:56 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.15.2/8.15.2) with ESMTP id tBMBQtem021968; Tue, 22 Dec 2015 12:26:55 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.15.2/8.15.2/Submit) id tBMBQsM6021967; Tue, 22 Dec 2015 12:26:54 +0100 (CET) (envelope-from ticso) Date: Tue, 22 Dec 2015 12:26:54 +0100 From: Bernd Walter To: Adrian Chadd Cc: Eugene Grosbein , "freebsd-mips@freebsd.org" Subject: Re: L2 cache management and busdma - or, "damnit USB, who you not like me" Message-ID: <20151222112653.GB21902@cicely7.cicely.de> Reply-To: ticso@cicely.de References: <5678DAF8.6000807@grosbein.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD cicely7.cicely.de 10.2-RELEASE amd64 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED=-1, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 autolearn=ham version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on spamd.cicely.de X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2015 11:31:57 -0000 On Tue, Dec 22, 2015 at 12:12:55AM -0800, Adrian Chadd wrote: > hi, > > It shouldn't be - the atheros mips doesn't have l2 cache. > > I wish I could reproduce your issue. :( It is strange that you couldn't reproduce the problem. For me It happened on so many HW combinations of sticks and magnetic USB drive, with different AR9331 boards and also with the WDR-4300. On the other hand I know someone with a stable SATA-HDD on USB converter connected to a Carambola2, which is something I couldn't reproduce. Nevertheless, it is not a filesystem corruption thing. To me it is more suspect to corruption in USB controller request memory and not in the bulk payload. However, I have no evidence to proove this theory. > On 21 December 2015 at 21:09, Eugene Grosbein wrote: > > On 21.12.2015 12:02, Adrian Chadd wrote: > >> hi, > >> > >> I've been poking at the ci20 port to bring it up to > >> self-booting/running, and this involves using USB1 as a rootfs. Yeah, > >> I know, ohci, but that's what I have for now. > >> > >> Anyway, there was filesystem corruption, so I went digging into it and > >> found that we just weren't taking L2 cache line size into account when > >> doing the busdma bits. The JZ4780 SoC has 32 byte L1 lines, and 128 > >> byte L2 lines. Oops > >> > >> So, two things are needed: > >> > >> * for the ci20 port, which isn't in the mainline tree yet, we need to > >> use USB_HOST_ALIGN=128, and > >> * we need to teach the busdma code about the maximum line size, not > >> just the L1 line size. > >> > >> Here's a diff that does the latter: > >> > >> https://people.freebsd.org/~adrian/mips/mips-fix-dcache-busdma.diff > >> > >> I'm going to test this out on my L1-only platforms (read: atheros) tomorrow. > >> > >> Does anyone have any comments? > > > > Can that be the source of my USB problems? Total system hang while doing lots of umass I/O > > with TP-Link TL-WDR3600? If yes, I'd like to re-run my tests with these new patches. -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.