Help: Using cpufreq from kernel level
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 22 lines · Claudio Scordino
Hi all,
I'm writing a kernel module that needs to get info about the available
frequencies on the current processor and to periodically change the current frequency.At user level it can be done through
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeedbut I have no idea how to implement it at kernel level.
I tried to declare
extern struct
cpufreq_driver*cpufreq_driver;
extern structcpufreq_policy*cpufreq_cpu_data[NR_CPUS];
externspinlock_tcpufreq_driver_lock;
externssize_tshow_available_freqs(structcpufreq_policy*policy, char *buf);and to do
Quoted 8 lines
char buffer [100000] = "\n";
spin_lock_irqsave(&cpufreq_driver_lock, flags);show_available_freqs(cpufreq_cpu_data[0], buffer);spin_unlock_irqrestore(&cpufreq_driver_lock, flags);but it crashes the system.
Please, can somebody tell me how this can be done ?
For one thing, you cannot put such a huge buffer on the kernel stack.
Signature · 3 lines
Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from [email protected] Home Page: http://www.roberthancock.com/