mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Lukasz Luba <l.luba@partner.samsung.com>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	b.zolnierkie@samsung.com, myungjoo.ham@samsung.com,
	kyungmin.park@samsung.com, m.szyprowski@samsung.com,
	s.nawrocki@samsung.com, joel@joelfernandes.org,
	chris.diamand@arm.com, mka@chromium.org, mingo@redhat.com
Subject: Re: [PATCH v3 6/7] trace: events: add devfreq trace event file
Date: Thu, 14 Feb 2019 14:01:53 +0900	[thread overview]
Message-ID: <3e44ca8a-a72b-8bdd-e702-00c927bd3c06@samsung.com> (raw)
In-Reply-To: <fb5d5359-7663-f119-f28f-7be820e1108d@partner.samsung.com>

Hi Lukasz,

On 19. 2. 13. 오후 10:35, Lukasz Luba wrote:
> Hi Steven,
> 
> On 2/13/19 12:14 AM, Steven Rostedt wrote:
>> On Tue, 12 Feb 2019 23:23:57 +0100
>> Lukasz Luba <l.luba@partner.samsung.com> wrote:
>>
>>> The patch adds a new file for with trace events for devfreq
>>> framework. They are used for performance analysis of the framework.
>>> It also contains updates in MAINTAINERS file adding new entry for
>>> devfreq maintainers.
>>>
>>> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
>>> ---
>>>   MAINTAINERS                    |  1 +
>>>   include/trace/events/devfreq.h | 39 +++++++++++++++++++++++++++++++++++++++
>>>   2 files changed, 40 insertions(+)
>>>   create mode 100644 include/trace/events/devfreq.h
>>>
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index 9919840..c042fda 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -4447,6 +4447,7 @@ S:	Maintained
>>>   F:	drivers/devfreq/
>>>   F:	include/linux/devfreq.h
>>>   F:	Documentation/devicetree/bindings/devfreq/
>>> +F:	include/trace/events/devfreq.h
>>>   
>>>   DEVICE FREQUENCY EVENT (DEVFREQ-EVENT)
>>>   M:	Chanwoo Choi <cw00.choi@samsung.com>
>>> diff --git a/include/trace/events/devfreq.h b/include/trace/events/devfreq.h
>>> new file mode 100644
>>> index 0000000..fec9304
>>> --- /dev/null
>>> +++ b/include/trace/events/devfreq.h
>>> @@ -0,0 +1,39 @@
>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>> +#undef TRACE_SYSTEM
>>> +#define TRACE_SYSTEM devfreq
>>> +
>>> +#if !defined(_TRACE_DEVFREQ_H) || defined(TRACE_HEADER_MULTI_READ)
>>> +#define _TRACE_DEVFREQ_H
>>> +
>>> +#include <linux/devfreq.h>
>>> +#include <linux/tracepoint.h>
>>> +
>>> +TRACE_EVENT(devfreq_monitor,
>>> +	TP_PROTO(const char *dev_name, unsigned long freq,
>>> +		 unsigned int polling_ms, unsigned long busy_time,
>>> +		 unsigned long total_time),
>>> +
>>> +	TP_ARGS(dev_name, freq, polling_ms, busy_time, total_time),
>>> +
>>> +	TP_STRUCT__entry(
>>> +		__string(dev_name, dev_name)
>>> +		__field(unsigned long, freq)
>>> +		__field(unsigned int, polling_ms)
>>> +		__field(unsigned int, load)
>>> +	),
>>> +
>>> +	TP_fast_assign(
>>> +		__assign_str(dev_name, dev_name);
>>> +		__entry->freq = freq;
>>> +		__entry->polling_ms = polling_ms;
>>> +		__entry->load = (100 * busy_time) / total_time;
>>
>> How critical is the code that this trace event is called in. If it is
>> not that critical (it is a slow path), then this is fine, but if this
>> is not a slow path (something triggered 100 HZ or less), then I would
>> recommend moving the above calculation to TP_printk(). A divide is a
>> slow operation, and is best to do that in the post processing. The
>> current location does the divide at the time of the tracepoint is
>> called.
> I wasn't aware of these two stages, good to know.
> I will move it to TP_printk().
>>
>> I would also have a check to make sure that total_time is not zero
>> here, otherwise that could be bad.
>>
>> 		__entry->busy_time = busy_time;
>> 		__entry->total_time = total_time;
>>
> 
>>> +	),
>>> +
>>> +	TP_printk("dev_name=%s freq=%lu polling_ms=%u load=%u",
>>
>>
>>> +		__get_str(dev_name), __entry->freq, __entry->polling_ms,
>>
>> 		__entry->total_time == 0 ? 100 :
>> 			__entry->busy_time / __entry->total_time)
> Thank you for the review.
> I will add this check.
> 
> Regards,
> Lukasz
>>
>> -- Steve
>>
>>> +		__entry->load)
>>> +);
>>> +#endif /* _TRACE_DEVFREQ_H */
>>> +
>>> +/* This part must be outside protection */
>>> +#include <trace/define_trace.h>
>>
>>
>>
> 
> 

I agree that trace point is necessary for devfreq framework.
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

  reply	other threads:[~2019-02-14  5:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190212222422eucas1p1624203db4db3e495035820dea542e23a@eucas1p1.samsung.com>
2019-02-12 22:23 ` [PATCH v3 0/7] drivers: devfreq: fix and optimize workqueue mechanism Lukasz Luba
     [not found]   ` <CGME20190212222430eucas1p1ad7992e29d224790c1e20ef7442e62fe@eucas1p1.samsung.com>
2019-02-12 22:23     ` [PATCH v3 1/7] drivers: devfreq: change deferred work into delayed Lukasz Luba
2019-02-14  4:10       ` Chanwoo Choi
     [not found]   ` <CGME20190212222431eucas1p1697607e6536a90283cf7dad37fa74dbb@eucas1p1.samsung.com>
2019-02-12 22:23     ` [PATCH v3 2/7] drivers: devfreq: change devfreq workqueue mechanism Lukasz Luba
2019-02-14  4:11       ` Chanwoo Choi
     [not found]   ` <CGME20190212222433eucas1p264602d67a916c644c7eb5012932fc17a@eucas1p2.samsung.com>
2019-02-12 22:23     ` [PATCH v3 3/7] Kconfig: drivers: devfreq: add default idle polling Lukasz Luba
     [not found]   ` <CGME20190212222434eucas1p134dcdce827df19704c698fd6452b0a06@eucas1p1.samsung.com>
2019-02-12 22:23     ` [PATCH v3 4/7] include: devfreq: add polling_idle_ms to 'profile' Lukasz Luba
2019-02-14  4:51       ` Chanwoo Choi
     [not found]   ` <CGME20190212222436eucas1p21eebc80796406787a2ebf9a84ee5b868@eucas1p2.samsung.com>
2019-02-12 22:23     ` [PATCH v3 5/7] drivers: devfreq: add longer polling interval in idle Lukasz Luba
     [not found]   ` <CGME20190212222437eucas1p198db6fca1f1ba3056d93c57327dd48ed@eucas1p1.samsung.com>
2019-02-12 22:23     ` [PATCH v3 6/7] trace: events: add devfreq trace event file Lukasz Luba
2019-02-12 23:14       ` Steven Rostedt
2019-02-13 13:35         ` Lukasz Luba
2019-02-14  5:01           ` Chanwoo Choi [this message]
2019-02-13 13:56       ` Steven Rostedt
2019-02-13 14:37         ` Lukasz Luba
     [not found]   ` <CGME20190212222438eucas1p27e020c2b36f2e5a2188e4df6fb18488b@eucas1p2.samsung.com>
2019-02-12 22:23     ` [PATCH v3 7/7] drivers: devfreq: add tracing for scheduling work Lukasz Luba
2019-02-14  4:57       ` Chanwoo Choi
2019-02-13  0:18   ` [PATCH v3 0/7] drivers: devfreq: fix and optimize workqueue mechanism Chanwoo Choi
2019-02-13 11:14     ` Lukasz Luba
2019-02-13 14:52       ` Lukasz Luba
2019-02-14  0:41       ` Chanwoo Choi
     [not found]   ` <CGME20190212222436eucas1p21eebc80796406787a2ebf9a84ee5b868@epcms1p3>
2019-02-18  4:33     ` [PATCH v3 5/7] drivers: devfreq: add longer polling interval in idle MyungJoo Ham
2019-02-19  8:33       ` Lukasz Luba
     [not found]       ` <CGME20190212222436eucas1p21eebc80796406787a2ebf9a84ee5b868@epcms1p7>
2019-02-21  5:56         ` MyungJoo Ham
2019-02-22 16:03           ` Lukasz Luba

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=3e44ca8a-a72b-8bdd-e702-00c927bd3c06@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=chris.diamand@arm.com \
    --cc=joel@joelfernandes.org \
    --cc=kyungmin.park@samsung.com \
    --cc=l.luba@partner.samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mingo@redhat.com \
    --cc=mka@chromium.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=rostedt@goodmis.org \
    --cc=s.nawrocki@samsung.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

all inboxes | Powered by JetHome®