public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: Deepak Sikri <deepak.sikri79@gmail.com>
Cc: armando.visconti@st.com, shiraz.hashim@st.com,
	linux-pm@lists.linux-foundation.org
Subject: Re: Query: CPU Freq Framework
Date: Tue, 12 Jan 2010 19:50:37 +0100	[thread overview]
Message-ID: <20100112185037.GA5000@comet.dominikbrodowski.net> (raw)
In-Reply-To: <9841a0471001112244g24d732f7t73ec1a25d59bf430@mail.gmail.com>

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

      reply	other threads:[~2010-01-12 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-12  6:44 Query: CPU Freq Framework Deepak Sikri
2010-01-12 18:50 ` Dominik Brodowski [this message]

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=20100112185037.GA5000@comet.dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=armando.visconti@st.com \
    --cc=deepak.sikri79@gmail.com \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=shiraz.hashim@st.com \
    /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