From owner-freebsd-current@FreeBSD.ORG Tue May 9 15:52:41 2006 Return-Path: X-Original-To: freebsd-current@FreeBSD.org 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 C1ABE16A61F; Tue, 9 May 2006 15:52:41 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (arm132.internetdsl.tpnet.pl [83.17.198.132]) by mx1.FreeBSD.org (Postfix) with ESMTP id 753F743D64; Tue, 9 May 2006 15:52:36 +0000 (GMT) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 363C750CF1; Tue, 9 May 2006 17:52:34 +0200 (CEST) Received: from localhost (pjd.wheel.pl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id E2BAD50BE1; Tue, 9 May 2006 17:52:26 +0200 (CEST) Date: Tue, 9 May 2006 17:50:47 +0200 From: Pawel Jakub Dawidek To: Brian Fundakowski Feldman Message-ID: <20060509155047.GB93453@garage.freebsd.pl> References: <20060509140312.GA93453@garage.freebsd.pl> <20060509152641.GC1036@green.homeunix.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1UWUbFP1cBYEclgG" Content-Disposition: inline In-Reply-To: <20060509152641.GC1036@green.homeunix.org> X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 User-Agent: mutt-ng/devel-r535 (FreeBSD) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: freebsd-current@FreeBSD.org, scottl@FreeBSD.org Subject: Re: contigmalloc(9) doesn't honor M_NOWAIT. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 May 2006 15:52:42 -0000 --1UWUbFP1cBYEclgG Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 09, 2006 at 11:26:42AM -0400, Brian Fundakowski Feldman wrote: +> On Tue, May 09, 2006 at 04:03:12PM +0200, Pawel Jakub Dawidek wrote: +> > Hi. +> >=20 +> > Using a USB pendrive can lead to kernel panic because of the issue +> > mentioned in the subject. +> >=20 +> > Trying sleep, but thread marked as sleeping prohibited +> > KDB: stack backtrace: +> > kdb_backtrace(c0602d36,1,c0602cb2,112,2) at kdb_backtrace+0x2e +> > sleepq_add(d7e13af0,c064c0e8,c060f7fd,0,0) at sleepq_add+0xba +> > msleep(d7e13af0,c064c0e8,44,c060f7fd,0) at msleep+0x209 +> > bwait(d7e13af0,44,c060f7fd,50a,0) at bwait+0x60 +> > swap_pager_putpages(c701ed98,e3c3ba44,1,1,e3c3ba00) at swap_pager_putp= ages+0x497 +> > vm_pageout_flush(e3c3ba44,1,1,61,3db) at vm_pageout_flush+0x172 +> > vm_contig_launder_page(c1ccbdb8,0,0,1ff,ffffffff) at vm_contig_launder= _page+0x29b +> > vm_page_alloc_contig(4,0,0,ffffffff,1) at vm_page_alloc_contig+0x398 +> > contigmalloc(4000,c0627840,1,0,ffffffff) at contigmalloc+0xb5 +> > bus_dmamem_alloc(c455b280,c6531048,5,c6531044,ffffffff) at bus_dmamem_= alloc+0xde +> > usb_block_allocmem(1,c51a913c,c479969c,c51a9100,c51a9100) at usb_block= _allocmem+0x11a +> > usb_allocmem(c455f000,4000,0,c51a913c,e3c3bbc4) at usb_allocmem+0x11c +> > ehci_allocm(c455f000,c51a913c,4000,0,e3c3bbf0) at ehci_allocm+0x25 +> > usbd_transfer(c51a9100,c4816400,c503ac00,d9cc1000,4000) at usbd_transf= er+0xec +> > umass_setup_transfer(d9cc1000,4000,4,c51a9100,e3c3bc1c) at umass_setup= _transfer+0x49 +> > umass_bbb_state(c51b8c00,c503ac00,0,1f,0) at umass_bbb_state+0xd6 +> > usb_transfer_complete(c51b8c00,c51b8c70,adc,e3c3bcb0,0) at usb_transfe= r_complete+0x1e7 +> > ehci_softintr(c455f000,c05fd1d2,e3c3bcb0,c0499a28,e6047000) at ehci_so= ftintr+0x17d +> > ehci_intr1(c455f000,0,c05fd1d2,295,1) at ehci_intr1+0x276 +> > ithread_execute_handlers(c45da8d0,c4510800,c05fd1d2,2f9,c45db1b0) at i= thread_execute_handlers+0x128 +> > ithread_loop(c460c2f0,e3c3bd38,c05fcfab,32b,0) at ithread_loop+0x83 +> > fork_exit(c048b2e0,c460c2f0,e3c3bd38) at fork_exit+0xc3 +> > fork_trampoline() at fork_trampoline+0x8 +> > --- trap 0x1, eip =3D 0, esp =3D 0xe3c3bd6c, ebp =3D 0 --- +> >=20 +> > Umass tries to allocate memory using bus_dmamem_alloc() with +> > BUS_DMA_NOWAIT flag, but contigmalloc() ignores the flag and simply can +> > sleep waiting for some memory to be reclaimed. +> > We don't allow to sleep in interrupt context, so the kernel panics. +> >=20 +> > PS. I replaced the assertion on my laptop with a printf, because it was +> > triggered way too often. +>=20 +> Please refer to the documentation: +> The flags parameter modifies contigmalloc()'s behaviour as follows: +>=20 +> M_ZERO Causes the allocated physical memory to be zero filled. +> Other flags (if present) are ignored. I've read it, but it doesn't fix the problem. I'm just saying, that this is the root of the problem, I don't know how to fix it. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --1UWUbFP1cBYEclgG Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFEYLpXForvXbEpPzQRAlabAKC28+fz789fmcYhyGLyH6v4f6gyIQCgpSfR rNtMNQcBsKSF+S/jx93pBtM= =1naJ -----END PGP SIGNATURE----- --1UWUbFP1cBYEclgG--