You are here

Milestone overclocking - patch: CPUfreq statistics fix for the overclock module

link: milestone-overclock

UPDATE: Hmm, it looks like the the stats are still broken in Tiago's version. I will look at the his sources and try to find what's wrong. Till that time, better use the module version that is attached here.
UPDATE 27 August, 2010: the patch has been incorporated in the new 1.4 version of the milestone-overclock module by tiagosousa, therefore this modified version is no longer needed.

This patch fixes two issues of the original overclock module (v1.2):
1. broken CPUfreq statistics
2. freq_table_addr and mpu_opps_addr not set by echo to /proc/overclock/omap2_clk_init_cpufreq_table_addr (Issue 30)

1. CPUfreq statistics:
The frequencies in the cpufreq stats table are not updated by the original overclock.ko module.
Therefore when the cpu_freq table is changed, e.g. cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state does not provide any useful information anymore - it still contains the original frequencies.

The patch adds /proc/overclock/cpufreq_stats_update_addr entry that can be used to autodetect the correct cpufreq stats address.
You can use busybox grep cpufreq_stats_update /proc/kallsyms to find the cpufreq_stats_update address.
Then use echo 0xc029d9d4 > /proc/overclock/cpufreq_stats_update_addr (replace 0xc029d9d4 with the found value).

The default cpufreq stats address used by the patched module comes from the kernel from the 2.1 Canadian Telus firmware. If you are using another kernel, you have to set the cpufreq_stats_update_addr as described above.

2. Handling of writes to /proc/overclock/omap2_clk_init_cpufreq_table_addr:
Fixed missing assignments to freq_table_addr and mpu_opps_addr after autodetection of addresses when handling writes to /proc/overclock/omap2_clk_init_cpufreq_table_addr (Issue 30 of the original overclock module).

E.g. for 2.34.3/2.36.0 firmware you can now use:
echo 0xc0295704 > /proc/overclock/cpufreq_stats_update_addr
echo 0xc004e4b0 > /proc/overclock/omap2_clk_init_cpufreq_table_addr

It will correctly set all three needed addresses (stats_addr, freq_table_addr and mpu_opps_addr).

The correct values for any kernel can be found by:
busybox grep cpufreq_stats_update /proc/kallsyms
busybox grep omap2_clk_init_cpufreq_table /proc/kallsyms

An example of the output of cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state for a 1000000/750000/500000/250000 freq table:
Unpatched overclock.ko
550000 5108
500000 10287
250000 100373
125000 0

1000000 12092
750000 3435
500000 11563
250000 101553

File overclock.patch6.27 KB
Binary Data overclock_stats.ko13.15 KB