From: Robert Hancock <hancockr@shaw.ca>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Help: Using cpufreq from kernel level
Date: Sat, 17 Dec 2005 12:24:33 -0600 [thread overview]
Message-ID: <43A457E1.9090909@shaw.ca> (raw)
In-Reply-To: <5kOPa-5vo-23@gated-at.bofh.it>
Claudio Scordino wrote:
> 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_setspeed
>
> but I have no idea how to implement it at kernel level.
>
> I tried to declare
>
> extern struct cpufreq_driver *cpufreq_driver;
> extern struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS];
> extern spinlock_t cpufreq_driver_lock;
> extern ssize_t show_available_freqs (struct cpufreq_policy *policy, char
> *buf);
>
> and to do
>
> 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.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/
next parent reply other threads:[~2005-12-17 18:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5kOPa-5vo-23@gated-at.bofh.it>
2005-12-17 18:24 ` Robert Hancock [this message]
2005-12-17 18:10 Help: Using cpufreq from kernel level Claudio Scordino
2005-12-17 18:27 ` Mattia Dongili
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43A457E1.9090909@shaw.ca \
--to=hancockr@shaw.ca \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox