From owner-cvs-all Tue Aug 14 7:13:43 2001 Delivered-To: cvs-all@freebsd.org Received: from InterJet.elischer.org (c421509-a.pinol1.sfba.home.com [24.7.86.9]) by hub.freebsd.org (Postfix) with ESMTP id 03BEB37B403; Tue, 14 Aug 2001 07:13:31 -0700 (PDT) (envelope-from julian@elischer.org) Received: from elischer.org (InterJet.elischer.org [192.168.1.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id HAA07231; Tue, 14 Aug 2001 07:19:46 -0700 (PDT) Message-ID: <3B7930E2.2A16C92C@elischer.org> Date: Tue, 14 Aug 2001 07:08:34 -0700 From: Julian Elischer X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en, hu MIME-Version: 1.0 To: Nick Hibma Cc: Julian Elischer , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/usb uhub.c References: Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Nick Hibma wrote: > > This is not the correct way to do it. usbd_devinfo should allocate the > buffer and return it. All drivers should be adapted to use an allocated > buffer. I'm wasn't really intersted in the optimal way of doing it.. because that would require that I learn the USB code. I just need it off the stack so I can boot. This is functionally the same as what was here defore and minimal impact on the rest of the USB code so I could prove to myself that I wasn't going to break anything else. You should also go through the USB cade and remove all allocations onthe stack that are > 32 bytes or so unless you can show that they only occur with very small prior and later stack usage. (in anscestors and descendents.) The fact that I hit 3.5K of stack in the USB code with 2K alloated here means that there was already 1.5K allocated somewhere else which si already too much.. a kernel stack frame should really not be more than 25 pointers (100 bytes on ia32) as a rough guide. The USB code routinely seems to allocate some structures that have 127 (or was it 256?) byte buffers in them, on the stack this is bad practice because if someone decides to up the buffer size constant, we blow our stack again. I singled out the USB code because that is what hit me, but there are other pieces of code that have the same problems. For example I think I saw the newbus code allocating some prety large items on the stack.. > > Nick > > > -----Original Message----- > > From: owner-cvs-committers@FreeBSD.org > > [mailto:owner-cvs-committers@FreeBSD.org]On Behalf Of Julian Elischer > > Sent: 10 August 2001 18:32 > > To: cvs-committers@FreeBSD.org; cvs-all@FreeBSD.org > > Subject: cvs commit: src/sys/dev/usb uhub.c > > > > > > julian 2001/08/10 10:32:12 PDT > > > > Modified files: > > sys/dev/usb uhub.c > > Log: > > Do NOT allocate a 1K buffer on the kernel stack. > > > > Found by: Smashed u-area and hardware watch points. > > MFC after: 1 week > > > > Revision Changes Path > > 1.29 +13 -3 src/sys/dev/usb/uhub.c > > > > > > http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/usb/uhub.c?r > > 1=1.28&r2=1.29&cvsroot=freebsd > > -- +------------------------------------+ ______ _ __ | __--_|\ Julian Elischer | \ U \/ / hard at work in | / \ julian@elischer.org +------>x USA \ a very strange | ( OZ ) \___ ___ | country ! +- X_.---._/ presently in San Francisco \_/ \\ v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message