Subject: Re: Status report: sysmon_cpufreq(9) + powerctl(8)
To: Quentin Garnier <cube@cubidou.net>
From: Juan RP <juan@xtrarom.org>
List: tech-kern
Date: 09/28/2006 19:03:29
On Tue, 12 Sep 2006 22:42:00 +0200
Quentin Garnier <cube@cubidou.net> wrote:
> The thing that your are missing in that part is that the
> "smcpufreq_freqlist" and "smcpufreq_currfreq" callbacks are not
> needed: the backend driver will set its own properties and all you
> have to do in sysmon_cpufreq is to keep references to those
> properties; that way, the dictionary you send to userland will be
> built naturally.
Ok... I replaced these callbacks with a pointer to a cpufreq_data_t.
Latest code is even cleaner than before, thanks for this suggestion.
> "smcpufreq_snewfreq" can be kept just for now; once it's time to deal
> with SMP (it is not time), we'll see how that should be done.
I have not removed this callback, because it might be useful for the SMP
case.
> A quick note:
>
> + for (smcf = LIST_FIRST(&sysmon_cpufreq_list); smcf != NULL;
> + smcf = LIST_NEXT(smcf, smcf_list)) {
> + if (strcmp(smcf->smcf_name, name) == 0)
> + break;
> + }
>
> You know, that's exactly what LIST_FOREACH is all about...
Yes, my code now supports multiple drivers thanks for LIST_FOREACH :-)
Status report about the code as of today:
* It supports multiple drivers, each driver will create a new
dictionary with its values.
* Removed the callbacks to list frequencies and current
frequency and replaced with a pointer to a cpufreq_data_t
type.
* powerctl updated to work with multiple drivers attached.
Anyway there are some problems in the code that I need to fix...
when I set a frequency in a specified driver, it removes the dictionary
and consequent calls will panic because I think it removes device_t's
properties dictionary by accident... I don't know where's the problem.
Please see the following URL for updated code:
http://www.xtrarom.org/~juan/sysmon_cpufreq/
Do you have any idea about the problem I mentioned above?
Any more suggestions about the code?