http://bugzilla.kernel.org/show_bug.cgi?id=12651

           Summary: ondemand cpu governor is always at the max speed
           Product: ACPI
           Version: 2.5
     KernelVersion: 2.6.28
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: low
          Priority: P1
         Component: Power-Processor
        AssignedTo: acpi_power-proces...@kernel-bugs.osdl.org
        ReportedBy: p...@bk.ru


-- kernel bug

Latest working kernel version: 2.6.27.x
Earliest failing kernel version: 2.6.28 (failing on 2.6.28.4 as well)

Hardware Environment:

$ cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 107
model name      : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
stepping        : 2
cpu MHz         : 2900.000
cache size      : 512 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm
3dnowext 3dnow rep_good pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
3dnowprefetch
bogomips        : 5828.09
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc 100mhzsteps

processor       : 1
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 107
model name      : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
stepping        : 2
cpu MHz         : 2900.000
cache size      : 512 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm
3dnowext 3dnow rep_good pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
3dnowprefetch
bogomips        : 5828.89
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc 100mhzsteps

$ dmesg |grep powernow
powernow-k8: Found 1 AMD Athlon(tm) 64 X2 Dual Core Processor 5600+ processors
(2 cpu cores) (version 2.20.00)
powernow-k8:    0 : fid 0x15 (2900 MHz), vid 0x9
powernow-k8:    1 : fid 0x14 (2800 MHz), vid 0xa
powernow-k8:    2 : fid 0x12 (2600 MHz), vid 0xc
powernow-k8:    3 : fid 0x10 (2400 MHz), vid 0xe
powernow-k8:    4 : fid 0xe (2200 MHz), vid 0x10
powernow-k8:    5 : fid 0xc (2000 MHz), vid 0x10
powernow-k8:    6 : fid 0xa (1800 MHz), vid 0x10
powernow-k8:    7 : fid 0x2 (1000 MHz), vid 0x12

Software Environment:

$ sh scripts/ver_linux
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.

Linux lo 2.6.28.4 #1 SMP Sat Feb 7 14:08:18 MSK 2009 x86_64 GNU/Linux

Gnu C                  4.3.3
Gnu make               3.81
binutils               2.19.51.20081229
util-linux             scripts/ver_linux: line 23: fdformat: command not found
mount                  support
module-init-tools      found
Linux C Library        2.9
Dynamic linker (ldd)   2.9
Linux C++ Library      6.0.10
Procps                 3.2.7
Kbd                    1.14.1
Sh-utils               7.0
Modules Loaded         nvidia

(the bug is also present if nvidia module is not loaded)

$ egrep 'NO_HZ|GOV' .config
CONFIG_NO_HZ=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
$ wc -l .config 
1225 .config

(whole .config is too large to place it here as is but if you really need it I
will provide it)

Problem Description:

Both right after a boot and two minutes later with no activity /proc/cpuinfo
shows that the processor is at the hightest speed (for me, 2900 MHz) when
running 2.6.28 with ondemand governor. 2.6.27 gives the lowest speed (1000 MHz)
with the same .config.

Steps to reproduce: Just build the kernel using my .config and boot into it.

My thoughts:

I'm not a kernel hacker but I think I can help you a little.

The following patch "fixes" the bug by partially reverting "[CPUFREQ][6/6]
cpufreq: Add idle microaccounting in ondemand governor" patch
(808009131046b62ac434dbc796c0fe8accaab415)

$ diff -u drivers/cpufreq/cpufreq_ondemand.c.orig
drivers/cpufreq/cpufreq_ondemand.c
--- cpufreq_ondemand.c.orig     2009-02-07 17:39:12.000000000 +0300
+++ cpufreq_ondemand.c  2009-02-07 17:39:33.000000000 +0300
@@ -134,7 +134,7 @@
 {
        u64 idle_time = get_cpu_idle_time_us(cpu, wall);

-       if (idle_time == -1ULL)
+/*     if (idle_time == -1ULL)*/
                return get_cpu_idle_time_jiffy(cpu, wall);

        if (dbs_tuners_ins.ignore_nice) {

Looking in get_cpu_idle_time_us() suggested me another way to fix the bug by
building the kernel with CONFIG_NO_HZ unset. And the another fix actually
works.

It seems the problem is that to determine idle time get_cpu_idle_time_us()
(used by ondemand governor in 2.6.28, not in 2.6.27) reads
tick_sched.idle_sleeptime which is less than a second for the first core for me
even after an hour of uptime and therefore load calculated as
100*(wall-idle)/wall is near to 100% (since idle is less than a second) so
leaving the processor speed high.

$ cat /proc/timer_list
Timer List Version: v0.4
HRTIMER_MAX_CLOCK_BASES: 2
now at 3293129991143 nsecs

cpu: 0
 clock 0:
  .base:       ffff880001014a78
  .index:      0
  .resolution: 3333116 nsecs
  .get_time:   <ffffffff802421f7>
active timers:
 clock 1:
  .base:       ffff880001014ab0
  .index:      1
  .resolution: 3333116 nsecs
  .get_time:   <ffffffff80242282>
active timers:
 #0: <ffff88007ef4b998>, <ffffffff80241a17>, S:01
 # expires at 3293719991142-3293720991142 nsecs [in 589999999 to 590999999
nsecs]
 #1: <ffffffff8056de48>, <ffffffff802289c1>, S:01
 # expires at 3294000000000-3294000000000 nsecs [in 870008857 to 870008857
nsecs]
 #2: <ffff88007ed5dec8>, <ffffffff80241a17>, S:01
 # expires at 3294486657804-3294486707804 nsecs [in 1356666661 to 1356716661
nsecs]
  .nohz_mode      : 0
  .idle_tick      : 0 nsecs
  .tick_stopped   : 0
  .idle_jiffies   : 0
  .idle_calls     : 0
  .idle_sleeps    : 0
  .idle_entrytime : 3293129991143 nsecs
  .idle_waketime  : 0 nsecs
  .idle_exittime  : 0 nsecs
  .idle_sleeptime : 233332990 nsecs
  .last_jiffies   : 0
  .next_jiffies   : 0
  .idle_expires   : 0 nsecs
jiffies: 4295865235

cpu: 1
 clock 0:
  .base:       ffff88000101fa78
  .index:      0
  .resolution: 3333116 nsecs
  .get_time:   <ffffffff802421f7>
active timers:
 clock 1:
  .base:       ffff88000101fab0
  .index:      1
  .resolution: 3333116 nsecs
  .get_time:   <ffffffff80242282>
active timers:
 #0: <ffff880079abb998>, <ffffffff80241a17>, S:01
 # expires at 3293146324476-3293146377476 nsecs [in 16333333 to 16386333 nsecs]
 #1: <ffff88007f837998>, <ffffffff80241a17>, S:01
 # expires at 3296133324477-3296138324477 nsecs [in 3003333334 to 3008333334
nsecs]
 #2: <ffff88007d56f998>, <ffffffff80241a17>, S:01
 # expires at 3412576991143-3412676991143 nsecs [in 119447000000 to
119547000000 nsecs]
 #3: <ffff88007eeedad8>, <ffffffff80241a17>, S:01
 # expires at 3606166657810-3606266657810 nsecs [in 313036666667 to
313136666667 nsecs]
  .nohz_mode      : 0
  .idle_tick      : 0 nsecs
  .tick_stopped   : 0
  .idle_jiffies   : 0
  .idle_calls     : 0
  .idle_sleeps    : 0
  .idle_entrytime : 3293129991143 nsecs
  .idle_waketime  : 0 nsecs
  .idle_exittime  : 0 nsecs
  .idle_sleeptime : 3222196659164 nsecs
  .last_jiffies   : 0
  .next_jiffies   : 0
  .idle_expires   : 0 nsecs
jiffies: 4295865235


Tick Device: mode:     0
Broadcast device
Clock Event Device: pit
 max_delta_ns:   27461866
 min_delta_ns:   12571
 mult:           5124677
 shift:          32
 mode:           1
 next_event:     9223372036854775807 nsecs
 set_next_event: <ffffffff80210f43>
 set_mode:       <ffffffff80210ed0>
 event_handler:  <ffffffff80245c31>
tick_broadcast_mask: 00000000
tick_broadcast_oneshot_mask: 00000000


Tick Device: mode:     0
Per CPU device: 0
Clock Event Device: lapic
 max_delta_ns:   668032790
 min_delta_ns:   1194
 mult:           53932671
 shift:          32
 mode:           2
 next_event:     9223372036854775807 nsecs
 set_next_event: <ffffffff8021a05a>
 set_mode:       <ffffffff8021a074>
 event_handler:  <ffffffff8024635d>

Tick Device: mode:     0
Per CPU device: 1
Clock Event Device: lapic
 max_delta_ns:   668032790
 min_delta_ns:   1194
 mult:           53932671
 shift:          32
 mode:           2
 next_event:     9223372036854775807 nsecs
 set_next_event: <ffffffff8021a05a>
 set_mode:       <ffffffff8021a074>
 event_handler:  <ffffffff8024635d>

Any thoughts?


-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
acpi-bugzilla mailing list
acpi-bugzilla@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acpi-bugzilla

Reply via email to