Re: Query: CPU Freq Framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,

On Tue, Jan 12, 2010 at 12:14:29PM +0530, Deepak Sikri wrote:
> The System timer (Clock Source & ClockEvent) for our board is sharing the
> clock with CPU.On changing the CPU frequency using the CPU freq governors,
> we are changing the clock being fed to CPU and timers. This is affecting the
> kernel time keeping as the timer frequecy has been changed. What is the
> mechanism for managing this through the CPU freq/some other Linux Framework
> ?

The CPUfreq framework offers CPU transition notifiers for exactly this
purpose. See e.g. this snippet from arch/x86/kernel/tsc.c:

	...
        cpufreq_register_notifier(&time_cpufreq_notifier_block,
                                CPUFREQ_TRANSITION_NOTIFIER);
	...

static struct notifier_block time_cpufreq_notifier_block = {
        .notifier_call  = time_cpufreq_notifier
};

	...

static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
                                void *data)
{
	...

        if ((val == CPUFREQ_PRECHANGE  && freq->old < freq->new) ||
                        (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) ||
                        (val == CPUFREQ_RESUMECHANGE)) {
                *lpj = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new);

                tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new);
		...
        }
	...
}

Hope this helps.

Best,
	Dominik
_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux