mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Matthias Kaehlcke <mka@chromium.org>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Douglas Anderson <dianders@chromium.org>
Subject: Re: [PATCH v2] devfreq: Add tracepoint for frequency changes
Date: Fri, 20 Sep 2019 10:15:57 +0900	[thread overview]
Message-ID: <62b2228b-e198-2558-2afc-e5687935742b@samsung.com> (raw)
In-Reply-To: <20190919174423.105030-1-mka@chromium.org>

Hi,

On 19. 9. 20. 오전 2:44, Matthias Kaehlcke wrote:
> Add a tracepoint for frequency changes of devfreq devices and
> use it.
> 
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
> (sending v2 without much delay wrt v1, since the change in devfreq
>  probably isn't controversial, and I'll be offline a few days)
> 
> Changes in v2:
> - included trace_devfreq_frequency_enabled() in the condition
>   to avoid unnecessary evaluation when the trace point is
>   disabled
> ---
>  drivers/devfreq/devfreq.c      |  3 +++
>  include/trace/events/devfreq.h | 18 ++++++++++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index ab22bf8a12d6..e9f04dcafb01 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -317,6 +317,9 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq,
>  
>  	devfreq->previous_freq = new_freq;
>  
> +	if (trace_devfreq_frequency_enabled() && new_freq != cur_freq)
> +		trace_devfreq_frequency(devfreq, new_freq);

You can change as following without 'new_freq' variable
because devfreq->previous_freq is the new frequency.	
	trace_devfreq_frequency(devfreq);

> +
>  	if (devfreq->suspend_freq)
>  		devfreq->resume_freq = cur_freq;
>  
> diff --git a/include/trace/events/devfreq.h b/include/trace/events/devfreq.h
> index cf5b8772175d..a62d32fe3c33 100644
> --- a/include/trace/events/devfreq.h
> +++ b/include/trace/events/devfreq.h
> @@ -8,6 +8,24 @@
>  #include <linux/devfreq.h>
>  #include <linux/tracepoint.h>
>  
> +TRACE_EVENT(devfreq_frequency,
> +	TP_PROTO(struct devfreq *devfreq, unsigned long freq),

'unsigned long freq' parameter is not necessary.

> +
> +	TP_ARGS(devfreq, freq),
> +
> +	TP_STRUCT__entry(
> +		__string(dev_name, dev_name(&devfreq->dev))
> +		__field(unsigned long, freq)
> +	),
> +
> +	TP_fast_assign(
> +		__assign_str(dev_name, dev_name(&devfreq->dev));
> +		__entry->freq = freq;

Initialize the new frequency with 'devfreq->previous_freq' as following:

		__entry->freq = devfreq->previous_freq;

> +	),
> +
> +	TP_printk("dev_name=%s freq=%lu", __get_str(dev_name), __entry->freq)
> +);
> +
>  TRACE_EVENT(devfreq_monitor,
>  	TP_PROTO(struct devfreq *devfreq),
>  
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

  parent reply	other threads:[~2019-09-20  1:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190919174436epcas4p17bf0528950813d3326237fcc56fd9b21@epcas4p1.samsung.com>
2019-09-19 17:44 ` Matthias Kaehlcke
2019-09-19 19:27   ` Steven Rostedt
2019-09-20  1:15   ` Chanwoo Choi [this message]
2019-09-24 19:37     ` Matthias Kaehlcke
2019-09-25  1:56       ` Chanwoo Choi
2019-09-25 17:45         ` Matthias Kaehlcke

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=62b2228b-e198-2558-2afc-e5687935742b@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=dianders@chromium.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mka@chromium.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®