Date: Sun, 21 Jan 2018 20:45:01 +0000 From: Johannes Lundberg <johalun0@gmail.com> To: Hans Petter Selasky <hps@selasky.org> Cc: freebsd-current <freebsd-current@freebsd.org> Subject: Re: Periodical interrupt storm when playing game with USB keyboard Message-ID: <CAECmPwtWr0t5_xLgg4NMxnjz317sqnfR9-ttH62szq4fwPdO=Q@mail.gmail.com> In-Reply-To: <CAECmPwvgMDBTUjhAERe4bKLgNYCim9bwdHw2JEL0RgTckMjSDw@mail.gmail.com> References: <CAECmPwvDQBYw=mKJpZfUdKpXSC8GysZKSk0f9qaZEXCvy_QeMA@mail.gmail.com> <e2851846-0678-5cb9-0fce-e9cf49c41a2e@selasky.org> <CAECmPwvgMDBTUjhAERe4bKLgNYCim9bwdHw2JEL0RgTckMjSDw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jan 21, 2018 at 8:35 PM, Johannes Lundberg <johalun0@gmail.com> wrote: > Sending the same again, this time cc the list. > > > On Sun, Jan 21, 2018 at 7:34 PM, Hans Petter Selasky <hps@selasky.org> > wrote: > >> On 01/21/18 16:41, Johannes Lundberg wrote: >> >>> Hi >>> >>> Finally I found the root to the problem that's been having me puzzled f= or >>> the last week. >>> >>> I started playing UT2004 on my laptop while away from home. Worked >>> perfectly. When I'm home and connect external display+mouse/keyboard, I >>> get >>> weird random lag. >>> >>> It is intr process that goes up to 100% CPU usage (swi4: clock) for a >>> couple of seconds every 30 seconds or so, but only when I'm moving arou= nd >>> in the game. To move around you need to hold down any of the wasd-keys. >>> >>> Turns out, the interrupt storms only happen when I use my external >>> keyboard, not with the laptop keyboard. >>> >>> The internal keyboard is: >>> atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0 >>> atkbd0: <AT Keyboard> irq 1 on atkbdc0 >>> >>> and external (Microsoft sculpt ergonomic desktop): >>> ugen0.2: <Microsoft Microsoft 2.4GHz Transceiver v9.0> at usbus0 >>> ukbd0: <Microsoft Microsoft 2.4GHz Transceiver v9.0, class 0/0, rev >>> 2.00/7.97, addr 1> on usbus0 >>> >>> The game runs with a linux binary. 32/64bit both act the same. >>> It uses libSDL-1.2 from /compat/linux/lib for rendering but not sure >>> about >>> input events. >>> >>> I tried lowering the key repeat rate both with xset and kbdcontrol but = it >>> has no effect. >>> >>> I don't have any wired USB keyboard to try with. >>> >>> Anyone have a clue to what's going on? >>> >>> Hardware is Dell Latitude E7270 >>> with >>> FreeBSD 12-CURRENT >>> drm-next-kmod >>> linux-c6 >>> >> >> Hi, >> >> What does "vmstat -i" say? >> > > Don=E2=80=99t remember the exact values now but it says cpu0:timer is get= ting A > LOT of interrupts. Like at least 10-50x the others. Otherwise normal. > > >> >> The issue can also be caused by a timer with a small or zero timeout. >> >> This can be checked by setting: >> kern.eventtimer.periodic=3D1 >> >> in /boot/loader.conf and rebooting. >> > > Wow, kern.eventtimer.periodic=3D1 really made all the difference. > No problem at all now and all cpu timers have equal interrupt total and > rate. > > What does kern.eventtimer.periodic do? The sysctl description wasn't > that elaborate... > Replying myself. Found some explanation at https://www.freebsd.org/cgi/man.cgi?query=3Deventtimers&apropos=3D0&sektion= =3D0&manpath=3DFreeBSD+12-current&arch=3Ddefault&format=3Dhtml With periodic each cpu timer has an interrupt rate of 1999 while on one shot it's around 700. Maybe not a very power efficient and precise solution to the problem but it works. > > >> --HPS >> > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAECmPwtWr0t5_xLgg4NMxnjz317sqnfR9-ttH62szq4fwPdO=Q>