i8kmon won't work on Dell Inspiron 7720 (causes lag)

Bug #1349176 reported by Marcel Henrique Bertonzzin on 2014-07-27
42
This bug affects 8 people
Affects Status Importance Assigned to Milestone
i8kutils
High
vitorafsr
i8kutils (Ubuntu)
Undecided
vitorafsr

Bug Description

lsb_release -rd
Description: Ubuntu 14.04.1 LTS
Release: 14.04

apt-cache policy i8kutils
i8kutils:
  Installed: 1.41
  Candidate: 1.41
  Version table:
 *** 1.41 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status

My CPU keeps overheating from time to time... the fan gear up and slow down in cycles and the lag makes the machine unusable, it's worst when I'm using Firefox to watch some Flash video (using the HTML5 player), but the problem also occurs when nothing special is running. During the lag htop doesn't show any process using all CPU capacity.
When I stop "sudo service i8kmon stop" and "sudo i8kfan 2 2" I get "-1 2" and everything goes back to normal.

The attached image is the psensor graph after logging in (passing lightdm).

My machine is a Dell Inspiron 17R SE 7720, with an GT650M video card (Optimus technology) that I'm using with Prime+nouveau.

I'm using the latest BIOS available (A16) with the SpeedStep activated.

Please let me know if any other information can be useful.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: i8kutils 1.41
ProcVersionSignature: Ubuntu 3.13.0-32.57-generic 3.13.11.4
Uname: Linux 3.13.0-32-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.2
Architecture: amd64
CurrentDesktop: XFCE
Date: Sun Jul 27 17:24:36 2014
InstallationDate: Installed on 2014-02-23 (154 days ago)
InstallationMedia: Ubuntu 13.10 "Saucy Salamander" - Release amd64 (20131016.1)
SourcePackage: i8kutils
UpgradeStatus: Upgraded to trusty on 2014-05-07 (81 days ago)
modified.conffile..etc.default.i8kmon:
 # /etc/default/i8kmon

 # Change to one to enable i8kmon
 ENABLED=1
mtime.conffile..etc.default.i8kbuttons: 2014-06-29T18:31:00.440067
mtime.conffile..etc.default.i8kmon: 2014-06-29T18:31:15.412067

description: updated
Malevaniy Dmitry (neimovirne) wrote :

I can confirm this. I also have a Dell Inspiron 17R SE 7720 notebook. Andmy fan after installing i8k is switched on and off every two seconds, and the system at this time freezes

vitorafsr (vitorafsr) wrote :

If the freeze is caused by the i8k kernel module, it is reproducible issuing

   $ cat /proc/i8k

This information helps to find the cause of the problem.

Same laptop, same problem. cat /proc/i8k does indeed cause a freeze

vitorafsr (vitorafsr) wrote :

A freeze problem was solved at version 1.39. It was to be right at version 1.41 for @marcelhb.

But there might be another problem as just a "cat /proc/i8k" causes a freeze. The solution for 1.39 was at i8kmon and not in the kernel module.

To isolate the problem, please see if the system freezes when just changing fan state with "i8kfan".

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in i8kutils (Ubuntu):
status: New → Confirmed
Dmitry Tuykov (d-touikov) wrote :

The same problem on Dell 7720.
After reaching threshold temperature, fan turns on for a second and stop after. At start-stop sequence lag is occured.

I have the same start-stop sequence lag on a Dell Vostro 1720 with i8kutils 1.41 on Debian.

By shutting down i8kmon (/etc/init.d/i8kmon stop) and switching to manual i8kfan commands I can reproduce the lag/freeze for some commands, and not for others;

cat /proc/i8k does not cause lag/freeze.
The command "i8kctl temp" returns "55" and does not cause a lag/freeze.
The command "i8kfan 0 2" returns "-1 2" (and makes the fan run fast) and does not cause a lag/freeze.

The command "i8kfan 0 0" returns "-1 0" (and stops the fan) and causes a short lag/freeze.
The command "i8kfan 0 1" returns "-1 1" (and makes the fan run slow) and causes a short lag/freeze.

solazs (solazs) wrote :

Same here on a Dell Insiron N7110.
issuing the sensors command also causes a lag, so I had to kill my temperature monitor, because it caused a half-sec lag every 2 seconds.

solazs (solazs) wrote :

In reply to comment #8
The command "i8kfan 0 2" returns "-1 2" causes a lag for me.
Running i8kfan with any combinations of -1,0 and 0,1,2 causes the lag for me, but simply running i8kfan does not.
This leads me to believe, that lag happens when i8kfan writes the fan speed control file.

vitorafsr (vitorafsr) wrote :

In the last commit at "lp:i8kutils" I included a tool to measure the time took by each function of i8kctl.

As the calls are the same as i8kmon's, we can identify which one is slow, to properly correct this bug.

To compile and run, just checkout the last version, do a 'make', and execute "./probe_i8k_calls_time".

Something like this must happen:

vitor:/tmp$ bzr branch lp:i8kutils
Branched 36 revisions.
vitor:/tmp$ cd i8kutils/
vitor:/tmp/i8kutils$ make
cc -c -o i8kctl.o i8kctl.c
gcc -Wall i8kctl.c -o i8kctl
gcc -Wall -c -g -DLIB i8kctl.c
gcc -Wall -c -g -DLIB probe_i8k_calls_time.c
gcc -o probe_i8k_calls_time i8kctl.o probe_i8k_calls_time.o
vitor:/tmp/i8kutils$ ./probe_i8k_calls_time
functions time
i8k_get_bios_version() = 0.003788
i8k_get_machine_id() = 0.000004
i8k_get_cpu_temp() = 0.000109
i8k_get_fan_status() = 0.000077
i8k_get_fan_status() = 0.000077
i8k_get_fan_speed() = 0.000088
i8k_get_fan_speed() = 0.005137
i8k_get_power_status() = 0.000074
i8k_get_fn_status() = 0.000070

solazs (solazs) wrote :

I've attached my output.

vitorafsr (vitorafsr) wrote :

Oh, nice, the lag is caused because on Dell Insiron N7110 it took half a second to get BIOS version and to get fan speed.

functions time
i8k_get_bios_version() = 0.509215
i8k_get_machine_id() = 0.000009
i8k_get_cpu_temp() = 0.002506
i8k_get_fan_status() = 0.000421
i8k_get_fan_status() = 0.002539
i8k_get_fan_speed() = 0.000435
i8k_get_fan_speed() = 0.502481
i8k_get_power_status() = 0.000517
i8k_get_fn_status() = 0.000492

Changed in i8kutils:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → vitorafsr (vitorafsr)
Changed in i8kutils (Ubuntu):
assignee: nobody → vitorafsr (vitorafsr)
vitorafsr (vitorafsr) wrote :

solazs,

I've updated the functions that are probed as it seems another function, i8k_set_fan, also causes lag/freeze. Could you please update your local repo, and call "./probe_i8k_calls_time" again?

vitorafsr

solazs (solazs) wrote :

Thanks for your swift reply :)

i8k_set_fan does take long to run.

$ ./probe_i8k_calls_time
functions time
i8k_get_bios_version() = 0.508801
i8k_get_machine_id() = 0.000009
i8k_get_cpu_temp() = 0.002492
i8k_get_fan_status() = 0.000427
i8k_get_fan_status() = 0.002275
i8k_get_fan_speed() = 0.000402
i8k_get_fan_speed() = 0.502663
i8k_get_power_status() = 0.000507
i8k_get_fn_status() = 0.000503
i8k_set_fan() = 0.000507
i8k_set_fan() = 0.000511
i8k_set_fan() = 0.000530
i8k_set_fan() = 0.506672
i8k_set_fan() = 0.517949
i8k_set_fan() = 0.508671

vitorafsr (vitorafsr) on 2014-12-05
Changed in i8kutils:
status: Confirmed → Fix Committed
Changed in i8kutils (Ubuntu):
status: Confirmed → Fix Committed
vitorafsr (vitorafsr) wrote :

As the freeze exist for setting fan speed, it is impossible to remove it.

But at least now (with the last commit) i8kmon will only call i8k_set_fan() when it needs change fan speed. This way, freeze will be sparser.

Please try it as a preparation for release.

vitorafsr (vitorafsr) wrote :

To test without installation is this way:

vitor:/tmp$ bzr branch lp:i8kutils
Branched 39 revisions.
vitor:/tmp$ cd i8kutils/
vitor:/tmp/i8kutils$ sudo service i8kmon stop
 * Stopping Dell fan/cpu-temperature monitor i8kmon
vitor:/tmp/i8kutils$ ./i8kmon
reading user config file
i8kmon v1.30 11/16/2013 - Copyright (C) 2013-2014 Vitor Augusto <email address hidden>
config(0) = {0 0} -1 60 -1 60
config(1) = {1 1} 50 70 50 70
config(2) = {2 2} 60 128 60 128
config(3) = {2 2} 60 128 60 128
config(acpi) = acpi
config(auto) = 1
config(daemon) = 1
config(geometry) =
config(i8kfan) = /usr/bin/i8kfan
config(min_speed) = 2000
config(sysconfig) = /etc/i8kmon.conf
config(t_high) = 80
config(timeout) = 5
config(unit) = C
config(use_conf) = 1
config(userconfig) = ~/.i8kmon
config(verbose) = 1
status(ac) = 0
status(acpi_timer) = 0
status(leftspeed) =
status(lspeed) = 0
status(lstate) = 0
status(lstuck) = 0
status(nfans) = 2
status(rightspeed) = 0 1000 2000 3000
status(rspeed) = 0
status(rstate) = 0
status(rstuck) = 0
status(state) = 0
status(t_high) = 0
status(t_low) = 0
status(temp) = 0
status(timer) =
status(ui) = 0
1417775624 acpi: Battery 0: Full, 100%
temp, left, right, ac state: 48 -1 1 0
temp, left, right, ac state: 48 -1 1 0
temp, left, right, ac state: 48 -1 1 0
temp, left, right, ac state: 48 -1 1 0

solazs (solazs) wrote :

I've tried the updated i8kmon, I understand the changes made, but the lag is present at sensors query and fan speed change, so from my perspective this bug is still present.

vitorafsr (vitorafsr) wrote :

i8kmon does not call, unnecessarily, i8k_set_fan() anymore. For sure, it was one of the sources of the lag. But now it avoids that!

Perhaps, to somebody this bug is solved. We need some more tests here from others models.

What is still present is querying temperature speed regularly but it seems that, until now, this function is quicly enough in all Dell systems.

vitorafsr (vitorafsr) on 2014-12-12
Changed in i8kutils:
status: Fix Committed → Fix Released
Changed in i8kutils (Ubuntu):
status: Fix Committed → Fix Released

I've also tried the updated version and it's definitely better, but since the lag is still present I would not consider the bug fixed.

vitorafsr (vitorafsr) wrote :

If the meaning of better is that the lag is sparser than before, I say that it's the best where the software can reach, to the most of my knowledge.

It is impossible to avoid the lag completely in some models as even change fan speed is a slow call.

vitorafsr (vitorafsr) wrote :

I reopened this problem on Bug #1405003.

This bug number #1349176 was closed on released 1.42 as I considered that some models would benefit from the improvements I made in the code of i8kmon. But as some models still have the lag, the problem is not solved.

postadelmaga (postadelmaga) wrote :

fix is not working on 14.10: I just tested the last version `i8kutils-1.42-45` unfortunately I still face same lag issue

However I think there are some possibility to improvement since the issue looks to be related only to the fan functionality.

Some info that maybe useful:

on my system dell inspiron 14z the lag is caused only by the fan control/read so the following command trigger the issue:
- `watch i8kctl fan - 2`
- `watch sensors`

I was able to fix the lag with sensor disabling the read of the fan speed add this file `/etc/sensors.d/dell.conf` with the following content:

chip "i8k-virtual-0"
 ignore fan2

solazs (solazs) wrote :

This workaround worked for me too.

Note that the error is still present, only sensors does not use the erroneous function.

solazs (solazs) wrote :

Update:

The fix and the workaround together is a definite improvement, but the lag is still present upon changing fan speed, but feels shorter, and sometimes absent.

postadelmaga (postadelmaga) wrote :

Ok I found another workaround for the fan speed:
- watch echo 255 > /sys/class/hwmon/hwmon2/pwm2

If you set the speed directly using sysfs you don't have the lag, this point out that the lag occurs only when you read the speed of the fan, indeed if try to read the speed with sysfs you still have the lag:
- watch cat /sys/class/hwmon/hwmon2/fan_input2

So If it was possible to avoid the read speed while you set it in i8kutil ... I think this will be a great improvements.

Note:
On my system if I set the fan speed to max speed ( with sysfs or i8kutils ) I never reach the maximum speed: the bios is able to set more high speed ... I'm not sure if it is i8k driver limitation.

postadelmaga (postadelmaga) wrote :

this bug looks more generic and it is basically the same issue https://bugs.launchpad.net/i8kutils/+bug/1179282
( I have posted some info/workaround there so we can have duplicate stuff )

please reopen the main bug and follow up that one

vitorafsr (vitorafsr) wrote :

postadelmaga (postadelmaga),

it is going to be very clarifying if you can post the results of the command "./probe_i8k_calls_time" here.

It seems that changing fan speed in some models is a slow call under the very basic call in i8k kernel module.

If so in your system, nothing can avoid the lag: the system will have to change fan speed to control temp and the lag will appear, either using i8kmon, sensors, sysfs whatever...

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers