Bug 225341 - System locks up due to atkbd_timeout kludge when using /dev/atkbd0 directly
Summary: System locks up due to atkbd_timeout kludge when using /dev/atkbd0 directly
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-20 18:16 UTC by Jan Kokemüller
Modified: 2022-01-05 20:56 UTC (History)
2 users (show)

See Also:


Attachments
disable atkbd_timeout (1.36 KB, patch)
2020-09-09 10:51 UTC, Jan Kokemüller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kokemüller 2018-01-20 18:16:43 UTC
There is a timer in atkbd that is called 10 times per second. It seems to be a kludge that is used to unwedge keyboard interrupts [1].

Unfortunately, if I keep this in, my system locks up after a brief period of usage. I don't really know how to debug this -- the system just hangs.

One important bit of information: I don't use the atkbd device in its default configuration behind the kbdmux0 device. Instead, I detach it from kbdmux0, open it directly and parse the keyboard data in userspace [2]. I feed the data into an Evdev device and a vkbd(4) device for use in vt(4).

In the default configuration (atkbd0 attached to kbdmux0) the issue is masked.

I haven't noticed any negative effects by disabling the atkbd_timeout timer. I'm using a Lenovo Thinkpad T420.

I suspect it has to do with locking issues. There have been some attempts to improve locking in atkbd and psm [3] but it turned out that this locking approach could not be used [4].


[1]: https://svnweb.freebsd.org/base/head/sys/dev/atkbdc/atkbd.c?revision=326255&view=markup#l161
[2]: https://github.com/jiixyj/evdevfbsd/blob/e64ae7da580c9ccede482b380440d7b4636b4943/backend-atkbd.c#L108
[3]: https://lists.freebsd.org/pipermail/freebsd-arch/2017-May/018193.html
[4]: https://reviews.freebsd.org/D10263#221930
Comment 1 Jan Kokemüller 2020-09-09 10:51:18 UTC
Created attachment 217837 [details]
disable atkbd_timeout

I've attached the hack that I've been using for a few years now.
Comment 2 Dries Michiels freebsd_committer freebsd_triage 2020-09-19 16:34:24 UTC
Hmm, I have tried the patch in question but it does not help in my case while I observe similar symptoms.
Comment 3 Alexander Motin freebsd_committer freebsd_triage 2022-01-05 20:53:44 UTC
I am not sure how can it cause your symptoms, but I've just disabled the polling in head: https://cgit.freebsd.org/src/commit/?id=ce881170088c4c98c036fe561f8ee8413c2e2585
Comment 4 Alexander Motin freebsd_committer freebsd_triage 2022-01-05 20:56:16 UTC
We can probably call it "fixed" for now.