linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] tracing: drivers: devfreq: add basic trace mechanism
       [not found] <CGME20190218182128eucas1p1bac39e9f11572143697b5cb854b2eb87@eucas1p1.samsung.com>
@ 2019-02-18 18:21 ` Lukasz Luba
       [not found]   ` <CGME20190218182129eucas1p236fc8ccddd9a8cde25c15f7545276885@eucas1p2.samsung.com>
                     ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Lukasz Luba @ 2019-02-18 18:21 UTC (permalink / raw)
  To: linux-kernel, linux-pm
  Cc: b.zolnierkie, myungjoo.ham, cw00.choi, kyungmin.park,
	m.szyprowski, s.nawrocki, mka, rostedt, mingo, Lukasz Luba

Hi all,

This is v3 which addresses suggestions from reviews.

This patch set adds support for tracing in devfreq framework. It is related
to the discussion regarding devfreq workqueue mechanism and wake-ups.
These two tracing patches have been submitted in larger patch set, which
needs more discussion. For the further discussion and development there
is a need of measurements/testing, though. It was agreed that trace events
would help. The whole discussion is here [1].

With these patches it is possible to capture current behaviour for the 
devfreq subsystem and devices such as when and which workqueue is used,
on which CPU, what is the load and frequency of the device.

v3:
- change 'load' value to 0 when 'total_time' is equal to 0,
- re-base on top of v5.0-rc7
v2:
- simplified arguments list, according to Steven's comments, with only
  one arg: 'devfreq' and the rest fields taken from there,
v1:
- moved long '/' operation to post-processing phase, according to Seven's
  comments [2] 
- re-ordered fields in the structure to avoid holes, according to Seven's
  comments [3] 
- removed unneeded variable, according to Chanwoo's comment [4]
basic in larget patch set:
- added support for trace events

I did not dare to add 'Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>'
for the 1st patch, which was in [5], since the code slightly changed.
The 2nd patch has it. 

Regards,
Lukasz Luba

[1] https://lkml.org/lkml/2019/2/12/1179
[2] https://lkml.org/lkml/2019/2/12/1201
[3] https://lkml.org/lkml/2019/2/13/532
[4] https://lkml.org/lkml/2019/2/13/1587
[5] https://lkml.org/lkml/2019/2/14/2

Lukasz Luba (2):
  trace: events: add devfreq trace event file
  drivers: devfreq: add tracing for scheduling work

 MAINTAINERS                    |  1 +
 drivers/devfreq/devfreq.c      |  5 +++++
 include/trace/events/devfreq.h | 40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+)
 create mode 100644 include/trace/events/devfreq.h

-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/2] trace: events: add devfreq trace event file
       [not found]   ` <CGME20190218182129eucas1p236fc8ccddd9a8cde25c15f7545276885@eucas1p2.samsung.com>
@ 2019-02-18 18:21     ` Lukasz Luba
  2019-02-19  0:25       ` Chanwoo Choi
  0 siblings, 1 reply; 7+ messages in thread
From: Lukasz Luba @ 2019-02-18 18:21 UTC (permalink / raw)
  To: linux-kernel, linux-pm
  Cc: b.zolnierkie, myungjoo.ham, cw00.choi, kyungmin.park,
	m.szyprowski, s.nawrocki, mka, rostedt, mingo, Lukasz Luba

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 | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 include/trace/events/devfreq.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 41ce5f4..9c44076 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..cf5b877
--- /dev/null
+++ b/include/trace/events/devfreq.h
@@ -0,0 +1,40 @@
+/* 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(struct devfreq *devfreq),
+
+	TP_ARGS(devfreq),
+
+	TP_STRUCT__entry(
+		__field(unsigned long, freq)
+		__field(unsigned long, busy_time)
+		__field(unsigned long, total_time)
+		__field(unsigned int, polling_ms)
+		__string(dev_name, dev_name(&devfreq->dev))
+	),
+
+	TP_fast_assign(
+		__entry->freq = devfreq->previous_freq;
+		__entry->busy_time = devfreq->last_status.busy_time;
+		__entry->total_time = devfreq->last_status.total_time;
+		__entry->polling_ms = devfreq->profile->polling_ms;
+		__assign_str(dev_name, dev_name(&devfreq->dev));
+	),
+
+	TP_printk("dev_name=%s freq=%lu polling_ms=%u load=%lu",
+		__get_str(dev_name), __entry->freq, __entry->polling_ms,
+		__entry->total_time == 0 ? 0 :
+			(100 * __entry->busy_time) / __entry->total_time)
+);
+#endif /* _TRACE_DEVFREQ_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/2] drivers: devfreq: add tracing for scheduling work
       [not found]   ` <CGME20190218182129eucas1p1804530445570fc73af89ed46b9a448b9@eucas1p1.samsung.com>
@ 2019-02-18 18:21     ` Lukasz Luba
  2019-02-19  0:28       ` Chanwoo Choi
  0 siblings, 1 reply; 7+ messages in thread
From: Lukasz Luba @ 2019-02-18 18:21 UTC (permalink / raw)
  To: linux-kernel, linux-pm
  Cc: b.zolnierkie, myungjoo.ham, cw00.choi, kyungmin.park,
	m.szyprowski, s.nawrocki, mka, rostedt, mingo, Lukasz Luba

This patch add basic tracing of the devfreq workqueue and delayed work.
It aims to capture changes of the polling intervals and device state.

Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
---
 drivers/devfreq/devfreq.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 0ae3de7..660365a 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -29,6 +29,9 @@
 #include <linux/of.h>
 #include "governor.h"
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/devfreq.h>
+
 static struct class *devfreq_class;
 
 /*
@@ -394,6 +397,8 @@ static void devfreq_monitor(struct work_struct *work)
 	queue_delayed_work(devfreq_wq, &devfreq->work,
 				msecs_to_jiffies(devfreq->profile->polling_ms));
 	mutex_unlock(&devfreq->lock);
+
+	trace_devfreq_monitor(devfreq);
 }
 
 /**
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/2] trace: events: add devfreq trace event file
  2019-02-18 18:21     ` [PATCH v3 1/2] trace: events: add devfreq trace event file Lukasz Luba
@ 2019-02-19  0:25       ` Chanwoo Choi
  0 siblings, 0 replies; 7+ messages in thread
From: Chanwoo Choi @ 2019-02-19  0:25 UTC (permalink / raw)
  To: Lukasz Luba, linux-kernel, linux-pm
  Cc: b.zolnierkie, myungjoo.ham, kyungmin.park, m.szyprowski,
	s.nawrocki, mka, rostedt, mingo

Hi Lukasz,

On 19. 2. 19. 오전 3:21, Lukasz Luba 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 | 40 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 41 insertions(+)
>  create mode 100644 include/trace/events/devfreq.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 41ce5f4..9c44076 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..cf5b877
> --- /dev/null
> +++ b/include/trace/events/devfreq.h
> @@ -0,0 +1,40 @@
> +/* 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(struct devfreq *devfreq),
> +
> +	TP_ARGS(devfreq),
> +
> +	TP_STRUCT__entry(
> +		__field(unsigned long, freq)
> +		__field(unsigned long, busy_time)
> +		__field(unsigned long, total_time)
> +		__field(unsigned int, polling_ms)
> +		__string(dev_name, dev_name(&devfreq->dev))
> +	),
> +
> +	TP_fast_assign(
> +		__entry->freq = devfreq->previous_freq;
> +		__entry->busy_time = devfreq->last_status.busy_time;
> +		__entry->total_time = devfreq->last_status.total_time;
> +		__entry->polling_ms = devfreq->profile->polling_ms;
> +		__assign_str(dev_name, dev_name(&devfreq->dev));
> +	),
> +
> +	TP_printk("dev_name=%s freq=%lu polling_ms=%u load=%lu",
> +		__get_str(dev_name), __entry->freq, __entry->polling_ms,
> +		__entry->total_time == 0 ? 0 :
> +			(100 * __entry->busy_time) / __entry->total_time)
> +);
> +#endif /* _TRACE_DEVFREQ_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> 

I think that it is necessary for devfreq. Looks good to me.

Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] drivers: devfreq: add tracing for scheduling work
  2019-02-18 18:21     ` [PATCH v3 2/2] drivers: devfreq: add tracing for scheduling work Lukasz Luba
@ 2019-02-19  0:28       ` Chanwoo Choi
  0 siblings, 0 replies; 7+ messages in thread
From: Chanwoo Choi @ 2019-02-19  0:28 UTC (permalink / raw)
  To: Lukasz Luba, linux-kernel, linux-pm
  Cc: b.zolnierkie, myungjoo.ham, kyungmin.park, m.szyprowski,
	s.nawrocki, mka, rostedt, mingo

Hi Lukasz,

On 19. 2. 19. 오전 3:21, Lukasz Luba wrote:
> This patch add basic tracing of the devfreq workqueue and delayed work.
> It aims to capture changes of the polling intervals and device state.
> 
> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
> ---
>  drivers/devfreq/devfreq.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 0ae3de7..660365a 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -29,6 +29,9 @@
>  #include <linux/of.h>
>  #include "governor.h"
>  
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/devfreq.h>
> +
>  static struct class *devfreq_class;
>  
>  /*
> @@ -394,6 +397,8 @@ static void devfreq_monitor(struct work_struct *work)
>  	queue_delayed_work(devfreq_wq, &devfreq->work,
>  				msecs_to_jiffies(devfreq->profile->polling_ms));
>  	mutex_unlock(&devfreq->lock);
> +
> +	trace_devfreq_monitor(devfreq);
>  }
>  
>  /**
> 

Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v3 1/2] trace: events: add devfreq trace event file
       [not found]   ` <CGME20190218182129eucas1p236fc8ccddd9a8cde25c15f7545276885@epcms1p7>
@ 2019-02-21  4:21     ` MyungJoo Ham
  0 siblings, 0 replies; 7+ messages in thread
From: MyungJoo Ham @ 2019-02-21  4:21 UTC (permalink / raw)
  To: Lukasz Luba, linux-kernel, linux-pm
  Cc: Bartlomiej Zolnierkiewicz, Chanwoo Choi, Kyungmin Park,
	Marek Szyprowski, Sylwester Nawrocki, mka, rostedt, mingo

>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 | 40 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 41 insertions(+)
> create mode 100644 include/trace/events/devfreq.h

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

Thanks!


Cheers,
MyungJoo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v3 2/2] drivers: devfreq: add tracing for scheduling work
       [not found]   ` <CGME20190218182129eucas1p1804530445570fc73af89ed46b9a448b9@epcms1p1>
@ 2019-02-21  4:26     ` MyungJoo Ham
  0 siblings, 0 replies; 7+ messages in thread
From: MyungJoo Ham @ 2019-02-21  4:26 UTC (permalink / raw)
  To: Lukasz Luba, linux-kernel, linux-pm
  Cc: Bartlomiej Zolnierkiewicz, Chanwoo Choi, Kyungmin Park,
	Marek Szyprowski, Sylwester Nawrocki, mka, rostedt, mingo

>This patch add basic tracing of the devfreq workqueue and delayed work.
>It aims to capture changes of the polling intervals and device state.
>
>Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
>---
> drivers/devfreq/devfreq.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
>index 0ae3de7..660365a 100644
>--- a/drivers/devfreq/devfreq.c
>+++ b/drivers/devfreq/devfreq.c

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-02-21  4:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190218182128eucas1p1bac39e9f11572143697b5cb854b2eb87@eucas1p1.samsung.com>
2019-02-18 18:21 ` [PATCH v3 0/2] tracing: drivers: devfreq: add basic trace mechanism Lukasz Luba
     [not found]   ` <CGME20190218182129eucas1p236fc8ccddd9a8cde25c15f7545276885@eucas1p2.samsung.com>
2019-02-18 18:21     ` [PATCH v3 1/2] trace: events: add devfreq trace event file Lukasz Luba
2019-02-19  0:25       ` Chanwoo Choi
     [not found]   ` <CGME20190218182129eucas1p1804530445570fc73af89ed46b9a448b9@eucas1p1.samsung.com>
2019-02-18 18:21     ` [PATCH v3 2/2] drivers: devfreq: add tracing for scheduling work Lukasz Luba
2019-02-19  0:28       ` Chanwoo Choi
     [not found]   ` <CGME20190218182129eucas1p236fc8ccddd9a8cde25c15f7545276885@epcms1p7>
2019-02-21  4:21     ` [PATCH v3 1/2] trace: events: add devfreq trace event file MyungJoo Ham
     [not found]   ` <CGME20190218182129eucas1p1804530445570fc73af89ed46b9a448b9@epcms1p1>
2019-02-21  4:26     ` [PATCH v3 2/2] drivers: devfreq: add tracing for scheduling work MyungJoo Ham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).