Bug 12297 - Direct use of tsc: Analog joystick doesn't work properly with CPU frequency scaling activated
Summary: Direct use of tsc: Analog joystick doesn't work properly with CPU frequency s...
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_input-devices
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-25 15:28 UTC by Radoslaw Warowny
Modified: 2013-12-10 16:22 UTC (History)
3 users (show)

See Also:
Kernel Version: 3.12
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Radoslaw Warowny 2008-12-25 15:28:28 UTC
Latest working kernel version: unknown
Earliest failing kernel version: unknown
Distribution: Debian lenny AMD64, Ubuntu Hardy Heron AMD64 (kernel 2.6.24)
Hardware Environment: x86 PC, AMD64 processor, single core
Software Environment:
Problem Description:
Analog joystick connected to game port produces false input events when CPU frequency changed. More details (with problem determination attempt) could be found at the following Debian bug report:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=+503029

It seems the couse of the problem is usage of rdtsc function for time measurement which is unreliable with recent CPUs which have such features like CPU frequency scaling.

Steps to reproduce:
1. Activate CPU frequency scaling function in your system.
2. Connect your joystick to the game port.
3. Load analog kernel module.
4. Run a game with intensive CPU usage (most SDL games).
Comment 1 Jonathan Nieder 2011-07-29 16:42:30 UTC
Hi Radek,

Radek Warowny wrote:

> I think the problem is located in analog kernel driver and is related
> to usage of rdtscl() function to read time (in GET_TIME macro). This
> function returns number of clock ticks, not real time. So when cpu
[...]

The driver hasn't changed much over time, so I suspect this still
isn't fixed.  If you are interested in fixing it, I think your best
bet is writing a patch.  If you make progress and then get stuck or
want review, Vojtech Pavlik (the author) might still be reachable
from <vojtech@suse.cz>; hopefully chapter 7 ("Time, Delays, and
Deferred Work") of Linux Device Drivers at http://lwn.net/Kernel/LDD3/
would be helpful for getting vaguely acquainted with the facilities
available.

Sorry I have no better advice to offer.
Comment 2 Ilya 2012-07-29 13:00:02 UTC
I confirm the bug. Analog joystick is unplayable on SB Live! gameport.

I must change the cpugouverneut to performance, before loading the emu10k1-gp and analog modules.

Probably the MIDI events for the music instruments is also affected by this.

Note You need to log in before you can comment on or make changes to this bug.