From owner-freebsd-current@FreeBSD.ORG Sun Jul 20 18:28:21 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 70AAE37B401; Sun, 20 Jul 2003 18:28:21 -0700 (PDT) Received: from mail.cyberonic.com (mail.cyberonic.com [4.17.179.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47B1743F85; Sun, 20 Jul 2003 18:28:20 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (node-40244c0a.sfo.onnet.us.uu.net [64.36.76.10]) by mail.cyberonic.com (8.12.8/8.12.5) with ESMTP id h6L1vX6d021243; Sun, 20 Jul 2003 21:57:33 -0400 Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.9/8.11.6) id h6L1SHRb021513; Sun, 20 Jul 2003 18:28:17 -0700 (PDT) (envelope-from jmg) Date: Sun, 20 Jul 2003 18:28:17 -0700 From: John-Mark Gurney To: Juli Mallett Message-ID: <20030721012817.GC917@funkthat.com> Mail-Followup-To: Juli Mallett , freebsd-current@freebsd.org References: <20030719194215.A6668@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030719194215.A6668@FreeBSD.org> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html cc: freebsd-current@freebsd.org Subject: Re: USB crappiness? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John-Mark Gurney List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2003 01:28:21 -0000 Juli Mallett wrote this message on Sat, Jul 19, 2003 at 19:42 -0500: > I tried to upgrade my workstation to current recently, and I have to > use a lot of USB, and while using some USB mass storage device, with > a UFS filesystem on it, and doing a large operation to it (tar c|tar x) > everything deadlocked on ufs, the USB stack blew up, and upon causing > an interrupt to it, it panicked, and panic pagefaulted. > > Anyone else seeing these sorts of cohesive fallovers? Ok, I think I know the problem now. It's a big different between NetBSD and FreeBSD's bus_dma code. In NetBSD, they keep the same bus_dma_tag_t, but in FreeBSD it is encouraged/required to create a new tag for sets of allocations because of size (we can't do a bus_dmamem_alloc w/ a size). So, in usb_allocmem, the tag equality doesn't work and allocated a full page for each 64byte allocation. This quickly causes kmem to get exhusted. ohci doesn't have this problem since it has it's own allocator for small sizes. this patch should fix it temporarily while I investigate a more complete fix (xterm pasted): Index: usb_mem.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/usb_mem.c,v retrieving revision 1.1 diff -u -r1.1 usb_mem.c --- usb_mem.c 2003/07/15 22:42:37 1.1 +++ usb_mem.c 2003/07/21 01:26:38 @@ -256,6 +259,8 @@ return (err); } b->fullblock = 0; + /* XXX - override the tag */ + b->tag = tag; for (i = 0; i < USB_MEM_BLOCK; i += USB_MEM_SMALL) { f = (struct usb_frag_dma *)((char *)b->kaddr + i); f->block = b; -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."