All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: "Robert Schöne" <robert.schoene@tu-dresden.de>
Cc: "Langsdorf, Mark" <mark.langsdorf@amd.com>,
	cpufreq@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing: add event power_frequency to powernow-k8 driver
Date: Fri, 26 Feb 2010 11:33:57 +0800	[thread overview]
Message-ID: <4B874125.7040003@cn.fujitsu.com> (raw)
In-Reply-To: <1267093075.3369.5.camel@localhost>

Robert Schöne wrote:
> This patch adds frequency tracing to the powernow-k8 cpufreq driver
> 
> diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
> b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
> index 6e44519..99034e7 100644
> --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
> +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
> @@ -37,6 +37,10 @@
>  #include <linux/io.h>
>  #include <linux/delay.h>
>  
> +#ifdef CONFIG_POWER_TRACER
> +#include <trace/events/power.h> /* tracing power events */
> +# endif /* CONFIG_POWER_TRACER */
> +
>  #include <asm/msr.h>
>  
>  #include <linux/acpi.h>
> @@ -54,6 +58,25 @@ static DEFINE_PER_CPU(struct powernow_k8_data *,
> powernow_data);
>  
>  static int cpu_family = CPU_OPTERON;
>  
> +
> +/* only trace power if it is selected */
> +#ifdef CONFIG_POWER_TRACER
> +       /* trace power event on a specific cpu/core */
> +       static void trace_power_event(unsigned int *freq){
> +               trace_power_frequency(POWER_PSTATE, *freq);
> +       }
> +
> +       #define TRACE_POWER_FREQUENCY_EVENT(i,avail_cores, frequency)

ERROR: space required after that ','

> \
> +        for_each_cpu(i,avail_cores)
> \
> +               smp_call_function_single(i, trace_power_event,
> &frequency, 1);

CONFIG_POWER_TRACER has gone. I don't know if smp_call_function_single()
is necessary, if not necessary, those #ifs are not needed, otherwise
you can use CONFIG_TRACING instead of CONFIG_POWER_TRACER.

> +
> +#else /* !CONFIG_POWER_TRACER */
> +
> +       #define TRACE_POWER_FREQUENCY_EVENT(i,avail_cores, frequency) ;
> +
> +# endif /* end CONFIG_POWER_TRACER */
> +
> +
>  #ifndef CONFIG_SMP
>  static inline const struct cpumask *cpu_core_mask(int cpu)
>  {
> @@ -1074,6 +1097,8 @@ static int transition_frequency_fidvid(struct
> powernow_k8_data *data,
>         res = transition_fid_vid(data, fid, vid);
>         freqs.new = find_khz_freq_from_fid(data->currfid);
>  
> +       TRACE_POWER_FREQUENCY_EVENT(i,data->available_cores, freqs.new);
> +
>         for_each_cpu(i, data->available_cores) {
>                 freqs.cpu = i;
>                 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
> @@ -1107,6 +1132,8 @@ static int transition_frequency_pstate(struct
> powernow_k8_data *data,
>         res = transition_pstate(data, pstate);
>         freqs.new = find_khz_freq_from_pstate(data->powernow_table,
> pstate);
>  
> +       TRACE_POWER_FREQUENCY_EVENT(i,data->available_cores, freqs.new);
> +
>         for_each_cpu(i, data->available_cores) {
>                 freqs.cpu = i;
>                 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
> 
> 
> 
> 

  parent reply	other threads:[~2010-02-26  3:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-25 10:17 [PATCH] tracing: add event power_frequency to powernow-k8 driver Robert Schöne
2010-02-25 18:21 ` Langsdorf, Mark
2010-02-26  3:33 ` Li Zefan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-02-26 11:17 Robert Schöne

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=4B874125.7040003@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.langsdorf@amd.com \
    --cc=robert.schoene@tu-dresden.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.