Comment 17 for bug 1179282

Revision history for this message
raphzahn (raphael-ku) wrote :

Hi vitorafsr,

I changed a little bit the code on my own and tried some things.
Now, I think I found the problem.

First of all, I wanted to identify, which request to the i8k_smm function produces the huge freeze time.
Therefore I've traced als the regs variable. Here is the output of the trace:

Aug 11 00:43:54 raph-laptop kernel: [ 2610.061753] NEW CALL smm -------------------
Aug 11 00:43:54 raph-laptop kernel: [ 2610.061760] eax: 4259
Aug 11 00:43:55 raph-laptop kernel: [ 2610.061763] ebx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.061765] ecx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.061766] edx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.061768] esi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.061769] edi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.062884] i8k_smm function took 1106 usecs
Aug 11 00:43:55 raph-laptop kernel: [ 2610.062886] NEW CALL smm -------------------
Aug 11 00:43:55 raph-laptop kernel: [ 2610.062888] eax: 163
Aug 11 00:43:55 raph-laptop kernel: [ 2610.062891] ebx: 1
Aug 11 00:43:55 raph-laptop kernel: [ 2610.062893] ecx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.062894] edx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.062896] esi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.062897] edi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.063084] i8k_smm function took 192 usecs
Aug 11 00:43:55 raph-laptop kernel: [ 2610.063086] NEW CALL smm -------------------
Aug 11 00:43:55 raph-laptop kernel: [ 2610.063089] eax: 163
Aug 11 00:43:55 raph-laptop kernel: [ 2610.063101] ebx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.063109] ecx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.063117] edx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.063124] esi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.063130] edi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064184] i8k_smm function took 1073 usecs
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064186] NEW CALL smm -------------------
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064189] eax: 675
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064191] ebx: 1
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064192] ecx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064194] edx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064195] esi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064197] edi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064340] i8k_smm function took 150 usecs
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064342] NEW CALL smm -------------------
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064345] eax: 675 <<<<<< can be used to identify the call-type <<<<<
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064347] ebx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064349] ecx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064351] edx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064353] esi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.064356] edi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.564123] i8k_smm function took 488793 usecs
Aug 11 00:43:55 raph-laptop kernel: [ 2610.564127] NEW CALL smm -------------------
Aug 11 00:43:55 raph-laptop kernel: [ 2610.564129] eax: 37
Aug 11 00:43:55 raph-laptop kernel: [ 2610.564132] ebx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.564134] ecx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.564137] edx: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.564139] esi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.564142] edi: 0
Aug 11 00:43:55 raph-laptop kernel: [ 2610.564274] i8k_smm function took 143 usecs

eax can be used to identify the call type. In case of the huge freeze time, its 675dez = 0x2a3.
0x2a3 is set in i8k_get_fan_speed.
The next thing, I found is, that the freeze is not alway present in case of reading the fan speed. Its only present, if there is a try to read the fan-speed from fan 0.
Therefore I modified the function i8k_get_fan_speed, to call i8k_smm only in case of fan 1, otherwise 0 should be returned:

static int i8k_get_fan_speed(int fan)
{
 /* there is only one fan, so perform this only one for fan 1 (why is it fan 1 ????) */
 if(fan == 1){
  struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, };

  regs.ebx = fan & 0xff;
  return i8k_smm(&regs) ? : (regs.eax & 0xffff) * fan_mult;
 }
 else{
  return 0;
 }
}

After this, the freeze was gone:

Aug 11 00:52:20 raph-laptop kernel: [ 3115.278136] NEW CALL smm -------------------
Aug 11 00:52:20 raph-laptop kernel: [ 3115.278145] eax: 4259
Aug 11 00:52:20 raph-laptop kernel: [ 3115.278148] ebx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.278150] ecx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.278151] edx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.278153] esi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.278154] edi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279619] i8k_smm function took 1452 usecs
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279629] NEW CALL smm -------------------
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279634] eax: 163
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279635] ebx: 1
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279637] ecx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279638] edx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279640] esi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279641] edi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279784] i8k_smm function took 152 usecs
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279786] NEW CALL smm -------------------
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279790] eax: 163
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279791] ebx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279793] ecx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279794] edx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279796] esi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.279797] edi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280812] i8k_smm function took 1002 usecs
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280814] NEW CALL smm -------------------
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280816] eax: 675
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280818] ebx: 1
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280819] ecx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280821] edx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280822] esi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280824] edi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280960] i8k_smm function took 142 usecs
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280963] NEW CALL smm -------------------
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280965] eax: 37
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280967] ebx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280969] ecx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280971] edx: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280973] esi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.280976] edi: 0
Aug 11 00:52:20 raph-laptop kernel: [ 3115.281108] i8k_smm function took 141 usecs

Now, there are some questions:
1. Why is there a problem during reading the fan-speed of fan 0?
2. Why is it performed for two fans (my notebook has only one)?
3. The output from cat /proc/i8k shows no fan speed, so I think its not possible to read the rpm with this i8k version. Am I right? Here is the ouput:
cat /proc/i8k
1.0 A15 1THDVW1 37 -22 1 -22 0 -1 -22

Best regards,
raph