FreeBSD Bugzilla – Attachment 191908 Details for
Bug 226968
IRQ storm on cpu0 timer when holding down key on USB keyboard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Resolve timer issues
ukbd.diff (text/plain), 1.65 KB, created by
Hans Petter Selasky
on 2018-03-28 15:30:39 UTC
(
hide
)
Description:
Resolve timer issues
Filename:
MIME Type:
Creator:
Hans Petter Selasky
Created:
2018-03-28 15:30:39 UTC
Size:
1.65 KB
patch
obsolete
>Index: sys/dev/usb/input/ukbd.c >=================================================================== >--- sys/dev/usb/input/ukbd.c (revision 331565) >+++ sys/dev/usb/input/ukbd.c (working copy) >@@ -386,10 +386,22 @@ > static void > ukbd_start_timer(struct ukbd_softc *sc) > { >- sbintime_t delay, prec; >+ sbintime_t delay, prec, now; > >+ now = sbinuptime(); >+ >+ /* check if initial delay passed and fallback to key repeat delay */ >+ if (sc->sc_delay == 0) >+ sc->sc_delay = sc->sc_kbd.kb_delay2; >+ >+ /* compute timeout */ > delay = SBT_1MS * sc->sc_delay; > sc->sc_co_basetime += delay; >+ >+ /* check if we are running behind */ >+ if (sc->sc_co_basetime < now) >+ sc->sc_co_basetime = now; >+ > /* This is rarely called, so prefer precision to efficiency. */ > prec = qmin(delay >> 7, SBT_1MS * 10); > usb_callout_reset_sbt(&sc->sc_callout, sc->sc_co_basetime, prec, >@@ -510,7 +522,6 @@ > static void > ukbd_interrupt(struct ukbd_softc *sc) > { >- struct timeval ctv; > uint32_t n_mod; > uint32_t o_mod; > uint32_t now = sc->sc_time_ms; >@@ -580,14 +591,11 @@ > break; > } > } >- if (j < UKBD_NKEYCODE) { >- /* Old key repeating. */ >- sc->sc_delay = sc->sc_kbd.kb_delay2; >- } else { >- /* New key. */ >- microuptime(&ctv); >- sc->sc_co_basetime = tvtosbt(ctv); >+ if (j == UKBD_NKEYCODE) { >+ /* New key - set initial delay and [re]start timer */ >+ sc->sc_co_basetime = sbinuptime(); > sc->sc_delay = sc->sc_kbd.kb_delay1; >+ ukbd_start_timer(sc); > } > ukbd_put_key(sc, key | KEY_PRESS); > >@@ -838,10 +846,6 @@ > > ukbd_interrupt(sc); > >- if (ukbd_any_key_pressed(sc) != 0) { >- ukbd_start_timer(sc); >- } >- > case USB_ST_SETUP: > tr_setup: > if (sc->sc_inputs < UKBD_IN_BUF_FULL) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 226968
:
191904
| 191908