Re: usbhid panic when switching vt-s (invariants+witness enabled)

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Fri, 23 Sep 2022 21:43:40 UTC
On 9/23/22 23:33, Andriy Gapon wrote:
> 
> It seems that the problem may be related to different keyboard LED 
> states between the VTs.  The system is a fresh stable/13.  The panic 
> looks like an attempt to sleep while in an interrupt thread (a callout?).
> 

Hi,

I suspect vt_switch_timer must have a task to handle those requests, 
which allows sleeping.

Vladimir, will you handle this?

It is a minor regression issue when using the new usbhid feature.

--HPS

> panic: sleepq_add: td 0xfffff80006af0000 to sleep on wchan 
> 0xfffff802ea752e08 with sleeping prohibited
> cpuid = 5
> time = 1663940484
> KDB: stack backtrace:
> db_trace_self_wrapper() at 0xffffffff8061555b = 
> db_trace_self_wrapper+0x2b/frame 0xfffffe003590e7f0
> kdb_backtrace() at 0xffffffff80942637 = kdb_backtrace+0x37/frame 
> 0xfffffe003590e8a0
> vpanic() at 0xffffffff808f4c84 = vpanic+0x184/frame 0xfffffe003590e900
> panic() at 0xffffffff808f4a33 = panic+0x43/frame 0xfffffe003590e960
> sleepq_add() at 0xffffffff809521ab = sleepq_add+0x37b/frame 
> 0xfffffe003590e9b0
> _sleep() at 0xffffffff80902118 = _sleep+0x238/frame 0xfffffe003590ea40
> usbhid_sync_xfer() at 0xffffffff8532e071 = usbhid_sync_xfer+0x171/frame 
> 0xfffffe003590eaa0
> usbhid_set_report() at 0xffffffff8532db26 = usbhid_set_report+0x96/frame 
> 0xfffffe003590eae0
> hid_set_report() at 0xffffffff80686caa = hid_set_report+0x6a/frame 
> 0xfffffe003590eb20
> hidbus_write() at 0xffffffff85335a7c = hidbus_write+0x5c/frame 
> 0xfffffe003590eb50
> hid_write() at 0xffffffff80686b98 = hid_write+0x58/frame 0xfffffe003590eb80
> hkbd_set_leds() at 0xffffffff85c1cfe6 = hkbd_set_leds+0x206/frame 
> 0xfffffe003590ebc0
> hkbd_ioctl_locked() at 0xffffffff85c1cd6b = 
> hkbd_ioctl_locked+0x33b/frame 0xfffffe003590ec20
> hkbd_ioctl_locked() at 0xffffffff85c1caff = hkbd_ioctl_locked+0xcf/frame 
> 0xfffffe003590ec80
> hkbd_ioctl() at 0xffffffff85c1ba5a = hkbd_ioctl+0xba/frame 
> 0xfffffe003590ecc0
> kbdmux_ioctl() at 0xffffffff80695d3b = kbdmux_ioctl+0x12b/frame 
> 0xfffffe003590ed00
> vt_window_switch() at 0xffffffff8079d969 = vt_window_switch+0x229/frame 
> 0xfffffe003590ed40
> vt_switch_timer() at 0xffffffff807a15a1 = vt_switch_timer+0x21/frame 
> 0xfffffe003590ed60
> softclock_call_cc() at 0xffffffff809127c4 = 
> softclock_call_cc+0x244/frame 0xfffffe003590ee20
> softclock() at 0xffffffff80912c1c = softclock+0x7c/frame 0xfffffe003590ee50
> ithread_loop() at 0xffffffff808b662a = ithread_loop+0x2da/frame 
> 0xfffffe003590eef0
> fork_exit() at 0xffffffff808b2f85 = fork_exit+0xc5/frame 0xfffffe003590ef30
> fork_trampoline() at 0xffffffff80c084fe = fork_trampoline+0xe/frame 
> 0xfffffe003590ef30
> 
>