Attempting to sleep in interrupts

From: Peter Jeremy <PeterJeremy_at_optushome.com.au>
Date: Mon, 7 Nov 2005 20:46:55 +1100
I (or my son, actually) just got bitten by the USB code trying to do
bus_dmamem_alloc() in an interrupt handler and panicing when
contigmalloc() tried to sleep.  I've previously mentioned this bug in
(eg) http://lists.freebsd.org/pipermail/freebsd-stable/2005-January/010979.html
My son was trying to copy some photos onto a flashdisk at the time.
Repeating the copy after the system recovered worked OK so the problem
depends on how badly fragmented KVM is.

Tonight's problem was in -CURRENT from last Saturday night.  A
backtrace is below.  No crashdump (unfortunately) because the kernel
got into a loop of breakpoint instruction faults.  That said, the
fault is fairly clearly the API bug that's mentioned in the above
reference.

Nov  7 19:14:26 server kernel: panic: trying to sleep while sleeping is prohibited
Nov  7 19:14:26 server kernel: KDB: stack backtrace:
Nov  7 19:14:26 server kernel: kdb_backtrace(c06fac04,c0762460,c06fd889,d4494828,100) at kdb_backtrace+0x2e
Nov  7 19:14:26 server kernel: panic(c06fd889,1,c06fd805,10c,2) at panic+0xb7
Nov  7 19:14:26 server kernel: sleepq_add(cbe8f0e0,c07adc60,c070d2f1,0,c053527a) at sleepq_add+0xb2
Nov  7 19:14:26 server kernel: msleep(cbe8f0e0,c07adc60,44,c070d2f1,0) at msleep+0x2df
Nov  7 19:14:26 server kernel: bwait(cbe8f0e0,44,c070d2f1,509,0) at bwait+0x60
Nov  7 19:14:26 server kernel: swap_pager_putpages(c2215ce4,d4494970,1,1,d4494920) at swap_pager_putpages+0x47a
Nov  7 19:14:26 server kernel: default_pager_putpages(c2215ce4,d4494970,1,1,d4494920) at default_pager_putpages+0x2e
Nov  7 19:14:26 server kernel: vm_pageout_flush(d4494970,1,1,60,c19115a0) at vm_pageout_flush+0x16b
Nov  7 19:14:26 server kernel: vm_contig_launder_page(c1911558,0,c070dd4b,1ec,ffffffff) at vm_contig_launder_page+0x229
Nov  7 19:14:26 server kernel: vm_page_alloc_contig(10,0,0,ffffffff,1) at vm_page_alloc_contig+0x24d
Nov  7 19:14:26 server kernel: contigmalloc(10000,c073a940,1,0,ffffffff) at contigmalloc+0xb5
Nov  7 19:14:26 server kernel: bus_dmamem_alloc(c2879100,c2410c88,5,c2410c84,ffffffff) at bus_dmamem_alloc+0xd2
Nov  7 19:14:26 server kernel: usb_block_allocmem(0,10000,1,c1fe333c,d4494a9c) at usb_block_allocmem+0x180
Nov  7 19:14:26 server kernel: usb_allocmem(c1b14000,10000,0,c1fe333c,d4494ae8) at usb_allocmem+0x73
Nov  7 19:14:26 server kernel: uhci_allocm(c1b14000,c1fe333c,10000,10c,1) at uhci_allocm+0x27
Nov  7 19:14:26 server kernel: usbd_transfer(c1fe3300,c4849480,c26e6400,d1483000,10000) at usbd_transfer+0xaa
Nov  7 19:14:26 server kernel: umass_setup_transfer(c26e6400,c4849480,d1483000,10000,0) at umass_setup_transfer+0x57
Nov  7 19:14:26 server kernel: umass_bbb_state(c1a52d00,c26e6400,0,c19566f0,d4494b7c) at umass_bbb_state+0x1ce
Nov  7 19:14:26 server kernel: usb_transfer_complete(c1a52d00,c053552c,c0761ce0,1,c06f9a88) at usb_transfer_complete+0x1aa
Nov  7 19:14:26 server kernel: uhci_idone(c1a52d70,c1a52d88,c07ad548) at uhci_idone+0x2ee
Nov  7 19:14:26 server kernel: uhci_check_intr(c1b14000,c1a52d70,c0761d20,c1b14000,1) at uhci_check_intr+0x148
Nov  7 19:14:26 server kernel: uhci_softintr(c1b14000,c0761d20) at uhci_softintr+0x57
Nov  7 19:14:26 server kernel: usb_schedsoftintr(c1b14000,c0761d20,c1b14000,c1987800,c1b0a200) at usb_schedsoftintr+0x39
Nov  7 19:14:26 server kernel: uhci_intr1(c1b14000) at uhci_intr1+0x248
Nov  7 19:14:26 server kernel: uhci_intr(c1b14000,0,c06f7c83,295,1) at uhci_intr+0x46
Nov  7 19:14:26 server kernel: ithread_execute_handlers(c1a28224,c1987800,c06f7c83,2f9,c198b180) at ithread_execute_handlers+0x118
Nov  7 19:14:26 server kernel: ithread_loop(c1a5f7f0,d4494d38,c06f7a7d,30d,c1a5f7f0) at ithread_loop+0x7b
Nov  7 19:14:26 server kernel: fork_exit(c05278d0,c1a5f7f0,d4494d38) at fork_exit+0xc3
Nov  7 19:14:26 server kernel: fork_trampoline() at fork_trampoline+0x8
Nov  7 19:14:26 server kernel: --- trap 0x1, eip = 0, esp = 0xd4494d6c, ebp = 0 ---

-- 
Peter Jeremy
Received on Mon Nov 07 2005 - 08:47:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:47 UTC