geom - panic: sleepq_add: sleep with sleeping prohibited

From: Svatopluk Kraus <onwahe_at_gmail.com>
Date: Tue, 7 Apr 2015 11:38:22 +0200
Hi,

I've got the following panic running FreeBSD-11-current:

panic: sleepq_add: td 0xc128a330 to sleep on wchan 0xc1bdd080 with
sleeping prohibited

After some digging, the call stack is the following:

...
g_io_schedule_up()
biodone()
swapgeom_done()
g_waitfor_event()
_sleep()
...

As biodone() in g_io_schedule_up() is wrapped by THREAD_NO_SLEEPING()
and THREAD_SLEEPING_OK(), IMHO, there is something missing in code as
_sleep() can be called regularly in this case.

Svatopluk Kraus

-----------------------------------------

More info about this is bellow:

root_at_raspberry-pi:/usr/src/src2 # ~~~(da0:umass-sim0:0:0:0): READ(10).
CDB: 28 00 00 12 1c 50 00 00 18 00
(da0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI status: Check Condition
(da0:umass-sim0:0:0:0): SCSI sense: UNIT ATTENTION asc:28,0 (Not ready
to ready change, medium may have changed)
(da0:umass-sim0:0:0:0): Retrying command (per sense data)
(da0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 12 1c 50 00 00 18 00
(da0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI status: Check Condition
(da0:umass-sim0:0:0:0): SCSI sense: UNIT ATTENTION asc:28,0 (Not ready
to ready change, medium may have changed)
(da0:umass-sim0:0:0:0): Retrying command (per sense data)
(da0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 12 1c 50 00 00 18 00
(da0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI status: Check Condition
(da0:umass-sim0:0:0:0): SCSI sense: UNIT ATTENTION asc:28,0 (Not ready
to ready change, medium may have changed)
(da0:umass-sim0:0:0:0): Retrying command (per sense data)
(da0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 12 1c 50 00 00 18 00
(da0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI status: Check Condition
(da0:umass-sim0:0:0:0): SCSI sense: UNIT ATTENTION asc:28,0 (Not ready
to ready change, medium may have changed)
(da0:umass-sim0:0:0:0): Retrying command (per sense data)
(da0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 12 1c 50 00 00 18 00
(da0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI status: Check Condition
(da0:umass-sim0:0:0:0): SCSI sense: UNIT ATTENTION asc:28,0 (Not ready
to ready change, medium may have changed)
(da0:umass-sim0:0:0:0): Error 6, Retries exhausted
(da0:umass-sim0:0:0:0): Invalidating pack
g_vfs_done():da0s1a[READ(offset=606642176, length=12288)]error = 6
vnode_pager_generic_getpages_done: I/O read error 5
vm_fault: pager read error, pid 327 (dhclient)
pid 327 (dhclient), uid 65: exited on signal 11
swap_pager: I/O error - pagein failed; blkno 57953,size 4096, error 6
panic: sleepq_add: td 0xc128a330 to sleep on wchan 0xc1bdd080 with
sleeping prohibited
KDB: enter: panic
[ thread pid 12 tid 100007 ]
Stopped at      kdb_enter+0x48: ldrb    r15, [r15, r15, ror r15]!
db> bt
Tracing pid 12 tid 100007 td 0xc128a330
db_trace_self() at db_trace_self
         pc = 0xc04ee7cc  lr = 0xc0131f90 (db_hex2dec+0x4c0)
         sp = 0xcfec2970  fp = 0xcfec2988
        r10 = 0xc070f6f8
db_hex2dec() at db_hex2dec+0x4c0
         pc = 0xc0131f90  lr = 0xc01319dc (db_command_loop+0x3c4)
         sp = 0xcfec2990  fp = 0xcfec2a30
         r4 = 0x00000000  r5 = 0x00000000
         r6 = 0x00000000 r10 = 0xc070f6f8
db_command_loop() at db_command_loop+0x3c4
         pc = 0xc01319dc  lr = 0xc0131674 (db_command_loop+0x5c)
         sp = 0xcfec2a38  fp = 0xcfec2a48
         r4 = 0xc054916d  r5 = 0xc0569f39
         r6 = 0xc070f6e4  r7 = 0xc0622154
         r8 = 0xc07079b0  r9 = 0xc07079b4
        r10 = 0xcfec2c10
db_command_loop() at db_command_loop+0x5c
         pc = 0xc0131674  lr = 0xc01340c0 (db_fetch_ksymtab+0x298)
         sp = 0xcfec2a50  fp = 0xcfec2b68
         r4 = 0x00000000  r5 = 0xc070f6f0
         r6 = 0xc07079d8 r10 = 0xcfec2c10
db_fetch_ksymtab() at db_fetch_ksymtab+0x298
         pc = 0xc01340c0  lr = 0xc02d2eb8 (kdb_trap+0xbc)
         sp = 0xcfec2b70  fp = 0xcfec2b90
         r4 = 0x00000000  r5 = 0x00000001
         r6 = 0xc07079d8  r7 = 0xc0622154
kdb_trap() at kdb_trap+0xbc
         pc = 0xc02d2eb8  lr = 0xc0505a08 (undefinedinstruction+0x2b4)
         sp = 0xcfec2b98  fp = 0xcfec2c08
         r4 = 0x00000000  r5 = 0x00000000
         r6 = 0xc05056a4  r7 = 0xe7ffffff
         r8 = 0xc128a330  r9 = 0xc02d27b0
        r10 = 0xcfec2c10
undefinedinstruction() at undefinedinstruction+0x2b4
         pc = 0xc0505a08  lr = 0xc04efe38 (exception_exit)
         sp = 0xcfec2c10  fp = 0xcfec2ca8
         r4 = 0xc0569f8e  r5 = 0xcfec2cfc
         r6 = 0xc056f664  r7 = 0xc06f9f18
         r8 = 0xc128a330  r9 = 0xc0710e50
        r10 = 0xc06f9d80
exception_exit() at exception_exit
         pc = 0xc04efe38  lr = 0xc02d27a4 (kdb_enter+0x3c)
         sp = 0xcfec2ca0  fp = 0xcfec2ca8
         r0 = 0xc07079c4  r1 = 0x00000000
         r2 = 0xc056dc29  r3 = 0xc056d86c
         r4 = 0xc0569f8e  r5 = 0xcfec2cfc
         r6 = 0xc056f664  r7 = 0xc06f9f18
         r8 = 0xc128a330  r9 = 0xc0710e50
        r10 = 0xc06f9d80 r12 = 0x00000000
kdb_enter() at kdb_enter+0x4c
         pc = 0xc02d27b4  lr = 0xc02994d4 (kassert_panic+0x1c8)
         sp = 0xcfec2cb0  fp = 0xcfec2cd0
         r4 = 0x00000100 r10 = 0xc06f9d80
kassert_panic() at kassert_panic+0x1c8
         pc = 0xc02994d4  lr = 0xc0299410 (kassert_panic+0x104)
         sp = 0xcfec2cd8  fp = 0xcfec2cf0
         r4 = 0xc06f9e18  r5 = 0xc056f664
         r6 = 0xcfec2cfc  r7 = 0xc06f9d80
         r8 = 0x00000050  r9 = 0xc0707c68
        r10 = 0xc06f7d78
kassert_panic() at kassert_panic+0x104
         pc = 0xc0299410  lr = 0xc02e475c (sleepq_add+0x2d4)
         sp = 0xcfec2d08  fp = 0xcfec2d30
         r4 = 0xc07083fc  r5 = 0xc128a330
         r6 = 0x00000000  r7 = 0xc1bdd080
sleepq_add() at sleepq_add+0x2d4
         pc = 0xc02e475c  lr = 0xc02a2374 (_sleep+0x27c)
         sp = 0xcfec2d38  fp = 0xcfec2d80
         r4 = 0xc0710d40  r5 = 0xc0710d40
         r6 = 0xc1bdd080  r7 = 0xffffffa0
         r8 = 0x00000000  r9 = 0x00000000
        r10 = 0xc06f7d78
_sleep() at _sleep+0x27c
         pc = 0xc02a2374  lr = 0xc022badc (g_waitfor_event+0xf0)
         sp = 0xcfec2d88  fp = 0xcfec2dc8
         r4 = 0xffffffa0  r5 = 0xc06f7d78
         r6 = 0x00000000  r7 = 0x00000000
         r8 = 0x00040000  r9 = 0x00000100
        r10 = 0xc055e43c
g_waitfor_event() at g_waitfor_event+0xf0
         pc = 0xc022badc  lr = 0xc04ba12c (vmspace_swap_count+0x8d0)
         sp = 0xcfec2dd8  fp = 0xcfec2de8
         r4 = 0xc21525e8  r5 = 0xc178fd40
         r6 = 0xc070df80  r7 = 0xc06f7dd4
         r8 = 0xc0710378  r9 = 0xc055c18b
        r10 = 0x00000000
vmspace_swap_count() at vmspace_swap_count+0x8d0
         pc = 0xc04ba12c  lr = 0xc022d000 (g_io_schedule_up+0xd4)
         sp = 0xcfec2df0  fp = 0xcfec2e20
         r4 = 0xc055e63f  r5 = 0xc21525e8
         r6 = 0xc06f7d90 r10 = 0x00000000
g_io_schedule_up() at g_io_schedule_up+0xd4
         pc = 0xc022d000  lr = 0xc022d738 (g_init+0x220)
         sp = 0xcfec2e28  fp = 0xcfec2e30
         r4 = 0xc055ea78  r5 = 0xc06f7dfc
         r6 = 0xc022d6cc  r7 = 0x00000000
         r8 = 0xcfec2e58  r9 = 0x00000000
        r10 = 0x00000000
g_init() at g_init+0x220
         pc = 0xc022d738  lr = 0xc02678a0 (fork_exit+0x7c)
         sp = 0xcfec2e38  fp = 0xcfec2e50
         r4 = 0xc128a330  r5 = 0xc1287378
fork_exit() at fork_exit+0x7c
         pc = 0xc02678a0  lr = 0xc04efdc8 (swi_exit)
         sp = 0xcfec2e58  fp = 0x00000000
         r4 = 0xc022d6cc  r5 = 0x00000000
         r6 = 0x00000000  r7 = 0x00000000
         r8 = 0x00000000 r10 = 0x00000000
swi_exit() at swi_exit
         pc = 0xc04efdc8  lr = 0xc04efdc8 (swi_exit)
         sp = 0xcfec2e58  fp = 0x00000000
db> show thread 0xc128a330
Thread 100007 at 0xc128a330:
 proc (pid 12): 0xc1287378
 name: g_up
 stack: 0xcfec1000-0xcfec2fff
 flags: 0x1010004  pflags: 0x210000
 state: RUNNING (CPU 0)
 priority: 92
 container lock: sched lock (0xc0707554)
Received on Tue Apr 07 2015 - 07:38:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:56 UTC