Module Name: src Committed By: knakahara Date: Tue Aug 3 01:08:18 UTC 2021
Modified Files: src/sys/dev/pci: if_wm.c Log Message: Fix locking against myself reported by rin@n.o. In some machine, INTx interrupts occurs for some reason while holding txq_lock in softint context. e.g. https://dmesgd.nycbug.org/index.cgi?do=view&id=6139 The panic message is the following. ==================== [ 50.1699480] panic: LOCKDEBUG: Mutex error: mutex_vector_enter,467: locking against myself [ 50.1800188] cpu0: Begin traceback... [ 50.1800188] 0xc7a29ac4: netbsd:db_panic+0xc [ 50.1900018] 0xc7a29adc: netbsd:vpanic+0x120 [ 50.1999533] 0xc7a29af4: netbsd:aprint_debug [ 50.1999533] 0xc7a29b34: netbsd:lockdebug_abort1+0x18c [ 50.2099719] 0xc7a29b74: netbsd:lockdebug_wantlock+0x1e8 [ 50.2199525] 0xc7a29bb4: netbsd:mutex_enter+0x288 [ 50.2299642] 0xc7a29be4: netbsd:wm_intr_legacy+0x9c [ 50.2299642] 0xc7a29c2c: netbsd:i80321_intr_dispatch+0x138 [ 50.2399631] 0xc7a29de4: netbsd:irq_entry+0x98 [ 50.2499452] 0xc7a29e24: netbsd:entropy_enter+0x88 [ 50.2599996] 0xc7a29e6c: netbsd:rnd_add_data_1+0x50 [ 50.2699565] 0xc7a29ebc: netbsd:rnd_add_data+0x10c [ 50.2699565] 0xc7a29ed4: netbsd:rnd_add_uint32+0x28 [ 50.2799524] 0xc7a29f1c: netbsd:wm_txeof+0x2c0 [ 50.2899527] 0xc7a29f5c: netbsd:wm_handle_queue+0x44 [ 50.3000257] 0xc7a29fac: netbsd:softint_thread+0x130 [ 50.3100119] cpu0: End traceback... ==================== To fix this panic, stop wm(4) interrupts before calling softint. This behavior is similar to MSI-X polling mode. Reviewed by msaitoh@n.o, tested by rin@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.705 -r1.706 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.