git: 35f0bf2d37a4 - stable/13 - atkbd: Reduce polling rate from 10Hz to ~1Hz.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 04 Feb 2022 00:56:02 UTC
The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=35f0bf2d37a49a25a81e25de2ffbd7cba850be36 commit 35f0bf2d37a49a25a81e25de2ffbd7cba850be36 Author: Alexander Motin <mav@FreeBSD.org> AuthorDate: 2022-01-05 16:32:44 +0000 Commit: Alexander Motin <mav@FreeBSD.org> CommitDate: 2022-02-04 00:55:44 +0000 atkbd: Reduce polling rate from 10Hz to ~1Hz. In my understanding this is only needed to workaround lost interrupts. I was thinking to remove it completely, but the comment about edge- triggered interrupt may be true and needs deeper investigation. ~1Hz should be often enough to handle the supposedly rare loss cases, but rare enough to not appear in top. Add sysctl hw.atkbd.hz to tune it. MFC after: 1 month (cherry picked from commit 9e007a88d65ba0d23e73c3c052d474a78260d503) --- sys/dev/atkbdc/atkbd.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c index 40dd698984e3..cee1207df973 100644 --- a/sys/dev/atkbdc/atkbd.c +++ b/sys/dev/atkbdc/atkbd.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <sys/proc.h> #include <sys/limits.h> #include <sys/malloc.h> +#include <sys/sysctl.h> #include <machine/bus.h> #include <machine/resource.h> @@ -73,6 +74,13 @@ typedef struct atkbd_state { #endif } atkbd_state_t; +static SYSCTL_NODE(_hw, OID_AUTO, atkbd, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "AT keyboard"); + +static int atkbdhz = 1; +SYSCTL_INT(_hw_atkbd, OID_AUTO, hz, CTLFLAG_RWTUN, &atkbdhz, 0, + "Polling frequency (in hz)"); + static void atkbd_timeout(void *arg); static int atkbd_reset(KBDC kbdc, int flags, int c); @@ -198,8 +206,11 @@ atkbd_timeout(void *arg) kbdd_intr(kbd, NULL); } splx(s); - state = (atkbd_state_t *)kbd->kb_data; - callout_reset(&state->ks_timer, hz / 10, atkbd_timeout, arg); + if (atkbdhz > 0) { + state = (atkbd_state_t *)kbd->kb_data; + callout_reset_sbt(&state->ks_timer, SBT_1S / atkbdhz, 0, + atkbd_timeout, arg, C_PREL(1)); + } } /* LOW-LEVEL */