linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing
@ 2019-06-04 11:14 Qais Yousef
  2019-06-04 11:14 ` [PATCH v3 1/6] sched: autogroup: Make autogroup_path() always available Qais Yousef
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Qais Yousef @ 2019-06-04 11:14 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Steven Rostedt
  Cc: linux-kernel, Pavankumar Kondeti, Sebastian Andrzej Siewior,
	Uwe Kleine-Konig, Dietmar Eggemann, Quentin Perret, Qais Yousef

Changes in v3:
	- Split pelt_rq TP into pelt_cfs, pelt_rq, pelt_dl and pelt_irq
	- Replace the fatty preprocessing wrappers with exported helper
	  functions to access data in unexported structures.
	- Remove the now unnecessary headers that were introduced in the
	  previous versions.
	- Postfix the tracepoints with '_tp' to make them standout more in the
	  code as bare tracepoints with no events associated.
	- Updated the example module in [2]
		- It demonstrates now how to convert the tracepoints into trace
		  events that extend the sched events subsystem in tracefs.

Changes in v2:
	- Add include guards to the newly added headers
	- Rename tracepoints:
		sched_load_rq -> pelt_rq
		sched_load_se -> pelt_se
	- Rename helper functions: s/sched_tp/sched_trace/
	- Make sched_trace*() less fat by reducing path size to 20 bytes from
	  64.
	- Fix compilation error when building on UP


The following patches add the bare minimum tracepoints required to perform EAS
testing in Lisa[1].

The new tracepoints are bare in a sense that they don't export any info in
tracefs, hence shouldn't introduce any ABI. The intended way to use them is by
loading a module that will probe the tracepoints and extract the info required
for userspace testing.

It is done in this way because adding new TRACE_EVENTS() is no longer accepted
AFAIU.

The tracepoints are focused around tracking PELT signals which is what EAS uses
to make its decision, hence knowing the value of PELT as it changes allows
verifying that EAS is doing the right thing based on synthetic tests that
simulate different scenarios.

Beside EAS, the new tracepoints can help investigate CFS load balancer and CFS
taskgroup handling as they are both based on PELT signals too.

Patch 1 exports autogroup_path function.

Patch 2 adds helper/accessor functions to extract info from unexported data
structures that are passed in the tracepoints. eg: access to sched_avg inside
cfs_rq.

Patches 3-5 add the new tracepoints.

Patch 6 exports the tracepoints so that out of tree modules can probe the new
tracepoints with least amount of effort - which extends the usefulness of the
tracepoints since creating a module to probe them is the only way to access
them.

An example module that uses these tracepoints is available in [2].

[1] https://github.com/ARM-software/lisa
[2] https://github.com/qais-yousef/tracepoints-helpers/tree/pelt-tps-v3-create-events/sched_tp


Qais Yousef (6):
  sched: autogroup: Make autogroup_path() always available
  sched: add a new sched_trace_*() helper functions
  sched: Add new tracepoints to track pelt at rq level
  sched: Add new tracepoint to track pelt at se level
  sched: Add sched_overutilized tracepoint
  sched: export the newly added tracepoints

 include/linux/sched.h        |  16 ++++-
 include/trace/events/sched.h |  31 ++++++++++
 kernel/sched/autogroup.c     |   2 -
 kernel/sched/core.c          |  11 ++++
 kernel/sched/fair.c          | 117 ++++++++++++++++++++++++++++++++++-
 kernel/sched/pelt.c          |  11 +++-
 6 files changed, 182 insertions(+), 6 deletions(-)

-- 
2.17.1


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

* [PATCH v3 1/6] sched: autogroup: Make autogroup_path() always available
  2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
@ 2019-06-04 11:14 ` Qais Yousef
  2019-06-25  8:24   ` [tip:sched/core] sched/autogroup: " tip-bot for Qais Yousef
  2019-06-04 11:14 ` [PATCH v3 2/6] sched: add a new sched_trace_*() helper functions Qais Yousef
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Qais Yousef @ 2019-06-04 11:14 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Steven Rostedt
  Cc: linux-kernel, Pavankumar Kondeti, Sebastian Andrzej Siewior,
	Uwe Kleine-Konig, Dietmar Eggemann, Quentin Perret, Qais Yousef

By removing the #ifdef CONFIG_SCHED_DEBUG

Some of the tracepoints to be introduced in later patches need to access
this function. Hence make it always available since the tracepoints are
not protected by CONFIG_SCHED_DEBUG.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
---
 kernel/sched/autogroup.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/autogroup.c b/kernel/sched/autogroup.c
index 2d4ff5353ded..2067080bb235 100644
--- a/kernel/sched/autogroup.c
+++ b/kernel/sched/autogroup.c
@@ -259,7 +259,6 @@ void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m)
 }
 #endif /* CONFIG_PROC_FS */
 
-#ifdef CONFIG_SCHED_DEBUG
 int autogroup_path(struct task_group *tg, char *buf, int buflen)
 {
 	if (!task_group_is_autogroup(tg))
@@ -267,4 +266,3 @@ int autogroup_path(struct task_group *tg, char *buf, int buflen)
 
 	return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id);
 }
-#endif
-- 
2.17.1


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

* [PATCH v3 2/6] sched: add a new sched_trace_*() helper functions
  2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
  2019-06-04 11:14 ` [PATCH v3 1/6] sched: autogroup: Make autogroup_path() always available Qais Yousef
@ 2019-06-04 11:14 ` Qais Yousef
  2019-06-25  8:25   ` [tip:sched/core] sched/debug: Add " tip-bot for Qais Yousef
  2019-06-04 11:14 ` [PATCH v3 3/6] sched: Add new tracepoints to track pelt at rq level Qais Yousef
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Qais Yousef @ 2019-06-04 11:14 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Steven Rostedt
  Cc: linux-kernel, Pavankumar Kondeti, Sebastian Andrzej Siewior,
	Uwe Kleine-Konig, Dietmar Eggemann, Quentin Perret, Qais Yousef

The new functions allow modules to access internal data structures of
unexported struct cfs_rq and struct rq to extract important information
from the tracepoints to be introduced in later patches.

While at it fix alphabetical order of struct declarations in sched.h

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
---
 include/linux/sched.h | 16 ++++++-
 kernel/sched/fair.c   | 99 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 11837410690f..5079ab584066 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -35,6 +35,7 @@ struct audit_context;
 struct backing_dev_info;
 struct bio_list;
 struct blk_plug;
+struct capture_control;
 struct cfs_rq;
 struct fs_struct;
 struct futex_pi_state;
@@ -47,8 +48,9 @@ struct pid_namespace;
 struct pipe_inode_info;
 struct rcu_node;
 struct reclaim_state;
-struct capture_control;
 struct robust_list_head;
+struct root_domain;
+struct rq;
 struct sched_attr;
 struct sched_param;
 struct seq_file;
@@ -1919,4 +1921,16 @@ static inline void rseq_syscall(struct pt_regs *regs)
 
 #endif
 
+const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq);
+char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len);
+int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq);
+
+const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq);
+const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq);
+const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq);
+
+int sched_trace_rq_cpu(struct rq *rq);
+
+const struct cpumask *sched_trace_rd_span(struct root_domain *rd);
+
 #endif
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f35930f5e528..18c89ebadfc7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -275,6 +275,19 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp)
 	return grp->my_q;
 }
 
+static inline void cfs_rq_tg_path(struct cfs_rq *cfs_rq, char *path, int len)
+{
+	if (!path)
+		return;
+
+	if (cfs_rq && task_group_is_autogroup(cfs_rq->tg))
+		autogroup_path(cfs_rq->tg, path, len);
+	else if (cfs_rq && cfs_rq->tg->css.cgroup)
+		cgroup_path(cfs_rq->tg->css.cgroup, path, len);
+	else
+		strlcpy(path, "(null)", len);
+}
+
 static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
 {
 	struct rq *rq = rq_of(cfs_rq);
@@ -449,6 +462,12 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp)
 	return NULL;
 }
 
+static inline void cfs_rq_tg_path(struct cfs_rq *cfs_rq, char *path, int len)
+{
+	if (path)
+		strlcpy(path, "(null)", len);
+}
+
 static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
 {
 	return true;
@@ -10737,3 +10756,83 @@ __init void init_sched_fair_class(void)
 #endif /* SMP */
 
 }
+
+/*
+ * Helper functions to facilitate extracting info from tracepoints.
+ */
+
+const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq)
+{
+#ifdef CONFIG_SMP
+	return cfs_rq ? &cfs_rq->avg : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_avg);
+
+char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len)
+{
+	if (!cfs_rq) {
+		if (str)
+			strlcpy(str, "(null)", len);
+		else
+			return NULL;
+	}
+
+	cfs_rq_tg_path(cfs_rq, str, len);
+	return str;
+}
+EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_path);
+
+int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq)
+{
+	return cfs_rq ? cpu_of(rq_of(cfs_rq)) : -1;
+}
+EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_cpu);
+
+const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq)
+{
+#ifdef CONFIG_SMP
+	return rq ? &rq->avg_rt : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_rq_avg_rt);
+
+const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq)
+{
+#ifdef CONFIG_SMP
+	return rq ? &rq->avg_dl : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_rq_avg_dl);
+
+const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq)
+{
+#if defined(CONFIG_SMP) && defined(CONFIG_HAVE_SCHED_AVG_IRQ)
+	return rq ? &rq->avg_irq : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_rq_avg_irq);
+
+int sched_trace_rq_cpu(struct rq *rq)
+{
+	return rq ? cpu_of(rq) : -1;
+}
+EXPORT_SYMBOL_GPL(sched_trace_rq_cpu);
+
+const struct cpumask *sched_trace_rd_span(struct root_domain *rd)
+{
+#ifdef CONFIG_SMP
+	return rd ? rd->span : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_rd_span);
-- 
2.17.1


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

* [PATCH v3 3/6] sched: Add new tracepoints to track pelt at rq level
  2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
  2019-06-04 11:14 ` [PATCH v3 1/6] sched: autogroup: Make autogroup_path() always available Qais Yousef
  2019-06-04 11:14 ` [PATCH v3 2/6] sched: add a new sched_trace_*() helper functions Qais Yousef
@ 2019-06-04 11:14 ` Qais Yousef
  2019-06-25  8:26   ` [tip:sched/core] sched/debug: Add new tracepoints to track PELT " tip-bot for Qais Yousef
  2019-06-04 11:14 ` [PATCH v3 4/6] sched: Add new tracepoint to track pelt at se level Qais Yousef
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Qais Yousef @ 2019-06-04 11:14 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Steven Rostedt
  Cc: linux-kernel, Pavankumar Kondeti, Sebastian Andrzej Siewior,
	Uwe Kleine-Konig, Dietmar Eggemann, Quentin Perret, Qais Yousef

The new tracepoints allow tracking PELT signals at rq level for all
scheduling classes + irq.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
---
 include/trace/events/sched.h | 23 +++++++++++++++++++++++
 kernel/sched/fair.c          |  6 ++++++
 kernel/sched/pelt.c          |  9 ++++++++-
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index c8c7c7efb487..520b89d384ec 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -594,6 +594,29 @@ TRACE_EVENT(sched_wake_idle_without_ipi,
 
 	TP_printk("cpu=%d", __entry->cpu)
 );
+
+/*
+ * Following tracepoints are not exported in tracefs and provide hooking
+ * mechanisms only for testing and debugging purposes.
+ *
+ * Postfixed with _tp to make them easily identifiable in the code.
+ */
+DECLARE_TRACE(pelt_cfs_tp,
+	TP_PROTO(struct cfs_rq *cfs_rq),
+	TP_ARGS(cfs_rq));
+
+DECLARE_TRACE(pelt_rt_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
+DECLARE_TRACE(pelt_dl_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
+DECLARE_TRACE(pelt_irq_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 18c89ebadfc7..dee1338ec4a9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3353,6 +3353,8 @@ static inline int propagate_entity_load_avg(struct sched_entity *se)
 	update_tg_cfs_util(cfs_rq, se, gcfs_rq);
 	update_tg_cfs_runnable(cfs_rq, se, gcfs_rq);
 
+	trace_pelt_cfs_tp(cfs_rq);
+
 	return 1;
 }
 
@@ -3505,6 +3507,8 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
 	add_tg_cfs_propagate(cfs_rq, se->avg.load_sum);
 
 	cfs_rq_util_change(cfs_rq, flags);
+
+	trace_pelt_cfs_tp(cfs_rq);
 }
 
 /**
@@ -3524,6 +3528,8 @@ static void detach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
 	add_tg_cfs_propagate(cfs_rq, -se->avg.load_sum);
 
 	cfs_rq_util_change(cfs_rq, 0);
+
+	trace_pelt_cfs_tp(cfs_rq);
 }
 
 /*
diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
index befce29bd882..c9d4945861a4 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -28,6 +28,8 @@
 #include "sched.h"
 #include "pelt.h"
 
+#include <trace/events/sched.h>
+
 /*
  * Approximate:
  *   val * y^n,    where y^32 ~= 0.5 (~1 scheduling period)
@@ -292,6 +294,7 @@ int __update_load_avg_cfs_rq(u64 now, struct cfs_rq *cfs_rq)
 				cfs_rq->curr != NULL)) {
 
 		___update_load_avg(&cfs_rq->avg, 1, 1);
+		trace_pelt_cfs_tp(cfs_rq);
 		return 1;
 	}
 
@@ -317,6 +320,7 @@ int update_rt_rq_load_avg(u64 now, struct rq *rq, int running)
 				running)) {
 
 		___update_load_avg(&rq->avg_rt, 1, 1);
+		trace_pelt_rt_tp(rq);
 		return 1;
 	}
 
@@ -340,6 +344,7 @@ int update_dl_rq_load_avg(u64 now, struct rq *rq, int running)
 				running)) {
 
 		___update_load_avg(&rq->avg_dl, 1, 1);
+		trace_pelt_dl_tp(rq);
 		return 1;
 	}
 
@@ -388,8 +393,10 @@ int update_irq_load_avg(struct rq *rq, u64 running)
 				1,
 				1);
 
-	if (ret)
+	if (ret) {
 		___update_load_avg(&rq->avg_irq, 1, 1);
+		trace_pelt_irq_tp(rq);
+	}
 
 	return ret;
 }
-- 
2.17.1


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

* [PATCH v3 4/6] sched: Add new tracepoint to track pelt at se level
  2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
                   ` (2 preceding siblings ...)
  2019-06-04 11:14 ` [PATCH v3 3/6] sched: Add new tracepoints to track pelt at rq level Qais Yousef
@ 2019-06-04 11:14 ` Qais Yousef
  2019-06-25  8:27   ` [tip:sched/core] sched/debug: Add new tracepoint to track PELT " tip-bot for Qais Yousef
  2019-06-04 11:14 ` [PATCH v3 5/6] sched: Add sched_overutilized tracepoint Qais Yousef
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Qais Yousef @ 2019-06-04 11:14 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Steven Rostedt
  Cc: linux-kernel, Pavankumar Kondeti, Sebastian Andrzej Siewior,
	Uwe Kleine-Konig, Dietmar Eggemann, Quentin Perret, Qais Yousef

The new tracepoint allows tracking PELT signals at sched_entity level.
Which is supported in CFS tasks and taskgroups only.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
---
 include/trace/events/sched.h | 4 ++++
 kernel/sched/fair.c          | 1 +
 kernel/sched/pelt.c          | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 520b89d384ec..c7dd9bc7f001 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -617,6 +617,10 @@ DECLARE_TRACE(pelt_irq_tp,
 	TP_PROTO(struct rq *rq),
 	TP_ARGS(rq));
 
+DECLARE_TRACE(pelt_se_tp,
+	TP_PROTO(struct sched_entity *se),
+	TP_ARGS(se));
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index dee1338ec4a9..8e0015ebf109 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3354,6 +3354,7 @@ static inline int propagate_entity_load_avg(struct sched_entity *se)
 	update_tg_cfs_runnable(cfs_rq, se, gcfs_rq);
 
 	trace_pelt_cfs_tp(cfs_rq);
+	trace_pelt_se_tp(se);
 
 	return 1;
 }
diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
index c9d4945861a4..7f1a1f641866 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -267,6 +267,7 @@ int __update_load_avg_blocked_se(u64 now, struct sched_entity *se)
 {
 	if (___update_load_sum(now, &se->avg, 0, 0, 0)) {
 		___update_load_avg(&se->avg, se_weight(se), se_runnable(se));
+		trace_pelt_se_tp(se);
 		return 1;
 	}
 
@@ -280,6 +281,7 @@ int __update_load_avg_se(u64 now, struct cfs_rq *cfs_rq, struct sched_entity *se
 
 		___update_load_avg(&se->avg, se_weight(se), se_runnable(se));
 		cfs_se_util_change(&se->avg);
+		trace_pelt_se_tp(se);
 		return 1;
 	}
 
-- 
2.17.1


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

* [PATCH v3 5/6] sched: Add sched_overutilized tracepoint
  2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
                   ` (3 preceding siblings ...)
  2019-06-04 11:14 ` [PATCH v3 4/6] sched: Add new tracepoint to track pelt at se level Qais Yousef
@ 2019-06-04 11:14 ` Qais Yousef
  2019-06-17 15:50   ` Peter Zijlstra
  2019-06-25  8:27   ` [tip:sched/core] sched/debug: " tip-bot for Qais Yousef
  2019-06-04 11:14 ` [PATCH v3 6/6] sched: export the newly added tracepoints Qais Yousef
                   ` (2 subsequent siblings)
  7 siblings, 2 replies; 21+ messages in thread
From: Qais Yousef @ 2019-06-04 11:14 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Steven Rostedt
  Cc: linux-kernel, Pavankumar Kondeti, Sebastian Andrzej Siewior,
	Uwe Kleine-Konig, Dietmar Eggemann, Quentin Perret, Qais Yousef

The new tracepoint allows us to track the changes in overutilized
status.

Overutilized status is associated with EAS. It indicates that the system
is in high performance state. EAS is disabled when the system is in this
state since there's not much energy savings while high performance tasks
are pushing the system to the limit and it's better to default to the
spreading behavior of the scheduler.

This tracepoint helps understanding and debugging the conditions under
which this happens.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
---
 include/trace/events/sched.h |  4 ++++
 kernel/sched/fair.c          | 11 +++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index c7dd9bc7f001..edd96e04049f 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -621,6 +621,10 @@ DECLARE_TRACE(pelt_se_tp,
 	TP_PROTO(struct sched_entity *se),
 	TP_ARGS(se));
 
+DECLARE_TRACE(sched_overutilized_tp,
+	TP_PROTO(int overutilized, struct root_domain *rd),
+	TP_ARGS(overutilized, rd));
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8e0015ebf109..e2418741608e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5179,8 +5179,10 @@ static inline bool cpu_overutilized(int cpu)
 
 static inline void update_overutilized_status(struct rq *rq)
 {
-	if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu))
+	if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu)) {
 		WRITE_ONCE(rq->rd->overutilized, SG_OVERUTILIZED);
+		trace_sched_overutilized_tp(1, rq->rd);
+	}
 }
 #else
 static inline void update_overutilized_status(struct rq *rq) { }
@@ -8542,8 +8544,13 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
 
 		/* Update over-utilization (tipping point, U >= 0) indicator */
 		WRITE_ONCE(rd->overutilized, sg_status & SG_OVERUTILIZED);
+
+		trace_sched_overutilized_tp(!!(sg_status & SG_OVERUTILIZED), rd);
 	} else if (sg_status & SG_OVERUTILIZED) {
-		WRITE_ONCE(env->dst_rq->rd->overutilized, SG_OVERUTILIZED);
+		struct root_domain *rd = env->dst_rq->rd;
+
+		WRITE_ONCE(rd->overutilized, SG_OVERUTILIZED);
+		trace_sched_overutilized_tp(1, rd);
 	}
 }
 
-- 
2.17.1


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

* [PATCH v3 6/6] sched: export the newly added tracepoints
  2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
                   ` (4 preceding siblings ...)
  2019-06-04 11:14 ` [PATCH v3 5/6] sched: Add sched_overutilized tracepoint Qais Yousef
@ 2019-06-04 11:14 ` Qais Yousef
  2019-06-25  8:28   ` [tip:sched/core] sched/debug: Export " tip-bot for Qais Yousef
  2019-06-05  6:17 ` [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Christoph Hellwig
  2019-06-17 12:51 ` Qais Yousef
  7 siblings, 1 reply; 21+ messages in thread
From: Qais Yousef @ 2019-06-04 11:14 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Steven Rostedt
  Cc: linux-kernel, Pavankumar Kondeti, Sebastian Andrzej Siewior,
	Uwe Kleine-Konig, Dietmar Eggemann, Quentin Perret, Qais Yousef

So that external modules can hook into them and extract the info they
need. Since these new tracepoints have no events associated with them
exporting these tracepoints make them useful for external modules to
perform testing and debugging. There's no other way otherwise to access
them.

BPF doesn't have infrastructure to access these bare tracepoints either.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
---
 kernel/sched/core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 874c427742a9..bc831d913088 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -23,6 +23,17 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/sched.h>
 
+/*
+ * Export tracepoints that act as a bare tracehook (ie: have no trace event
+ * associated with them) to allow external modules to probe them.
+ */
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_cfs_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_rt_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_dl_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_irq_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_se_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp);
+
 DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
 
 #if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL)
-- 
2.17.1


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

* Re: [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing
  2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
                   ` (5 preceding siblings ...)
  2019-06-04 11:14 ` [PATCH v3 6/6] sched: export the newly added tracepoints Qais Yousef
@ 2019-06-05  6:17 ` Christoph Hellwig
  2019-06-05  7:22   ` Peter Zijlstra
  2019-06-05 22:33   ` Qais Yousef
  2019-06-17 12:51 ` Qais Yousef
  7 siblings, 2 replies; 21+ messages in thread
From: Christoph Hellwig @ 2019-06-05  6:17 UTC (permalink / raw)
  To: Qais Yousef
  Cc: Peter Zijlstra, Ingo Molnar, Steven Rostedt, linux-kernel,
	Pavankumar Kondeti, Sebastian Andrzej Siewior, Uwe Kleine-Konig,
	Dietmar Eggemann, Quentin Perret

> The following patches add the bare minimum tracepoints required to perform EAS
> testing in Lisa[1].

What is EAS?  Whhy is "Lisa" not part of the patch submission?
submission.

> It is done in this way because adding new TRACE_EVENTS() is no longer accepted
> AFAIU.

Huh?  We keep adding trace events all the time.  And they actually
are useful because they are testable.

This series on the other hand adds exports not used in tree, which is
a big no-go.

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

* Re: [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing
  2019-06-05  6:17 ` [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Christoph Hellwig
@ 2019-06-05  7:22   ` Peter Zijlstra
  2019-06-05 22:33   ` Qais Yousef
  1 sibling, 0 replies; 21+ messages in thread
From: Peter Zijlstra @ 2019-06-05  7:22 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Qais Yousef, Ingo Molnar, Steven Rostedt, linux-kernel,
	Pavankumar Kondeti, Sebastian Andrzej Siewior, Uwe Kleine-Konig,
	Dietmar Eggemann, Quentin Perret

On Tue, Jun 04, 2019 at 11:17:48PM -0700, Christoph Hellwig wrote:
> > The following patches add the bare minimum tracepoints required to perform EAS
> > testing in Lisa[1].
> 
> What is EAS?  Whhy is "Lisa" not part of the patch submission?
> submission.
> 
> > It is done in this way because adding new TRACE_EVENTS() is no longer accepted
> > AFAIU.
> 
> Huh?  We keep adding trace events all the time.  And they actually
> are useful because they are testable.

They also form an implicit API/ABI with userspace, and I've been bitten
by that crap before. No more tracepoints. IIRC viro is also not having
tracepoints in the vfs.

> This series on the other hand adds exports not used in tree, which is
> a big no-go.

I much prefer a few unused exports that expose data in a controlled
fashion than commit to an implicit ABI through tracepoints. By keeping
it all in kernel, we're punting to the no-in-kernel-ABI rule.

Basically nobody gives a crap if we break (out-of-tree) modules, but the
moment we break something userspace we're fscked.


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

* Re: [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing
  2019-06-05  6:17 ` [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Christoph Hellwig
  2019-06-05  7:22   ` Peter Zijlstra
@ 2019-06-05 22:33   ` Qais Yousef
  1 sibling, 0 replies; 21+ messages in thread
From: Qais Yousef @ 2019-06-05 22:33 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Peter Zijlstra, Ingo Molnar, Steven Rostedt, linux-kernel,
	Pavankumar Kondeti, Sebastian Andrzej Siewior, Uwe Kleine-Konig,
	Dietmar Eggemann, Quentin Perret

On 06/04/19 23:17, Christoph Hellwig wrote:
> > The following patches add the bare minimum tracepoints required to perform EAS
> > testing in Lisa[1].
> 
> What is EAS?  Whhy is "Lisa" not part of the patch submission?
> submission.

EAS is Energy Aware Scheduling. It was merged in 5.0.

Lisa is a python based testing platform that has dependency on other binaries
like trace-cmd, rt-app, etc. It is not suitable for kernel submission.

Lisa, or any userspace based testing for that matter, requires to know what's
happening inside the scheduler to test its behavior. I don't know know of any
other scheduler centric testing framework. I didn't intend to specify Lisa as
the sole user and reason for these tracepoints, I know others are interested in
these tracepoints in general for anyone who wants to achieve a similar goal of
studying scheduler PELT behavior and how it affects some of the decisions it
makes.

We had a talk in OSPM a couple of weeks ago to cover this topic if you're
interested to learn more

	https://www.youtube.com/watch?v=I_MZ9XS3_zc

> 
> > It is done in this way because adding new TRACE_EVENTS() is no longer accepted
> > AFAIU.
> 
> Huh?  We keep adding trace events all the time.  And they actually
> are useful because they are testable.
> 
> This series on the other hand adds exports not used in tree, which is
> a big no-go.

I see that Peter has already covered this part.

Thanks

--
Qais Yousef

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

* Re: [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing
  2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
                   ` (6 preceding siblings ...)
  2019-06-05  6:17 ` [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Christoph Hellwig
@ 2019-06-17 12:51 ` Qais Yousef
  2019-06-17 15:55   ` Peter Zijlstra
  7 siblings, 1 reply; 21+ messages in thread
From: Qais Yousef @ 2019-06-17 12:51 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Steven Rostedt
  Cc: linux-kernel, Pavankumar Kondeti, Sebastian Andrzej Siewior,
	Uwe Kleine-Konig, Dietmar Eggemann, Quentin Perret

Hi Peter

On 06/04/19 12:14, Qais Yousef wrote:
> Changes in v3:
> 	- Split pelt_rq TP into pelt_cfs, pelt_rq, pelt_dl and pelt_irq
> 	- Replace the fatty preprocessing wrappers with exported helper
> 	  functions to access data in unexported structures.
> 	- Remove the now unnecessary headers that were introduced in the
> 	  previous versions.
> 	- Postfix the tracepoints with '_tp' to make them standout more in the
> 	  code as bare tracepoints with no events associated.
> 	- Updated the example module in [2]
> 		- It demonstrates now how to convert the tracepoints into trace
> 		  events that extend the sched events subsystem in tracefs.

Does this look okay now? If you have further comments please let me know so
I can address them in time in hope it'd make it to the next merge window.

Thanks

--
Qais Yousef

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

* Re: [PATCH v3 5/6] sched: Add sched_overutilized tracepoint
  2019-06-04 11:14 ` [PATCH v3 5/6] sched: Add sched_overutilized tracepoint Qais Yousef
@ 2019-06-17 15:50   ` Peter Zijlstra
  2019-06-17 16:31     ` Qais Yousef
  2019-06-25  8:27   ` [tip:sched/core] sched/debug: " tip-bot for Qais Yousef
  1 sibling, 1 reply; 21+ messages in thread
From: Peter Zijlstra @ 2019-06-17 15:50 UTC (permalink / raw)
  To: Qais Yousef
  Cc: Ingo Molnar, Steven Rostedt, linux-kernel, Pavankumar Kondeti,
	Sebastian Andrzej Siewior, Uwe Kleine-Konig, Dietmar Eggemann,
	Quentin Perret

On Tue, Jun 04, 2019 at 12:14:58PM +0100, Qais Yousef wrote:
> The new tracepoint allows us to track the changes in overutilized
> status.
> 
> Overutilized status is associated with EAS. It indicates that the system
> is in high performance state. EAS is disabled when the system is in this
> state since there's not much energy savings while high performance tasks
> are pushing the system to the limit and it's better to default to the
> spreading behavior of the scheduler.
> 
> This tracepoint helps understanding and debugging the conditions under
> which this happens.
> 
> Signed-off-by: Qais Yousef <qais.yousef@arm.com>
> ---
>  include/trace/events/sched.h |  4 ++++
>  kernel/sched/fair.c          | 11 +++++++++--
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index c7dd9bc7f001..edd96e04049f 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -621,6 +621,10 @@ DECLARE_TRACE(pelt_se_tp,
>  	TP_PROTO(struct sched_entity *se),
>  	TP_ARGS(se));
>  
> +DECLARE_TRACE(sched_overutilized_tp,
> +	TP_PROTO(int overutilized, struct root_domain *rd),
> +	TP_ARGS(overutilized, rd));
> +

strictly speaking you only need @rd :-)

>  #endif /* _TRACE_SCHED_H */
>  
>  /* This part must be outside protection */
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 8e0015ebf109..e2418741608e 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5179,8 +5179,10 @@ static inline bool cpu_overutilized(int cpu)
>  
>  static inline void update_overutilized_status(struct rq *rq)
>  {
> -	if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu))
> +	if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu)) {
>  		WRITE_ONCE(rq->rd->overutilized, SG_OVERUTILIZED);
> +		trace_sched_overutilized_tp(1, rq->rd);
> +	}
>  }
>  #else
>  static inline void update_overutilized_status(struct rq *rq) { }
> @@ -8542,8 +8544,13 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
>  
>  		/* Update over-utilization (tipping point, U >= 0) indicator */
>  		WRITE_ONCE(rd->overutilized, sg_status & SG_OVERUTILIZED);
> +
> +		trace_sched_overutilized_tp(!!(sg_status & SG_OVERUTILIZED), rd);
>  	} else if (sg_status & SG_OVERUTILIZED) {
> -		WRITE_ONCE(env->dst_rq->rd->overutilized, SG_OVERUTILIZED);
> +		struct root_domain *rd = env->dst_rq->rd;
> +
> +		WRITE_ONCE(rd->overutilized, SG_OVERUTILIZED);
> +		trace_sched_overutilized_tp(1, rd);
>  	}
>  }

But I figure since we need both values anyway, this isn't too much of a
bother.

I'm going to flip the argument order though.

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

* Re: [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing
  2019-06-17 12:51 ` Qais Yousef
@ 2019-06-17 15:55   ` Peter Zijlstra
  2019-06-17 16:22     ` Qais Yousef
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Zijlstra @ 2019-06-17 15:55 UTC (permalink / raw)
  To: Qais Yousef
  Cc: Ingo Molnar, Steven Rostedt, linux-kernel, Pavankumar Kondeti,
	Sebastian Andrzej Siewior, Uwe Kleine-Konig, Dietmar Eggemann,
	Quentin Perret

On Mon, Jun 17, 2019 at 01:51:23PM +0100, Qais Yousef wrote:
> Hi Peter
> 
> On 06/04/19 12:14, Qais Yousef wrote:
> > Changes in v3:
> > 	- Split pelt_rq TP into pelt_cfs, pelt_rq, pelt_dl and pelt_irq
> > 	- Replace the fatty preprocessing wrappers with exported helper
> > 	  functions to access data in unexported structures.
> > 	- Remove the now unnecessary headers that were introduced in the
> > 	  previous versions.
> > 	- Postfix the tracepoints with '_tp' to make them standout more in the
> > 	  code as bare tracepoints with no events associated.
> > 	- Updated the example module in [2]
> > 		- It demonstrates now how to convert the tracepoints into trace
> > 		  events that extend the sched events subsystem in tracefs.
> 
> Does this look okay now? If you have further comments please let me know so
> I can address them in time in hope it'd make it to the next merge window.

Picked them up (with some minor edits). I feel there is far too much
#ifdef in patch #2, but I couldn't quickly come up with anything much
saner either.

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

* Re: [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing
  2019-06-17 15:55   ` Peter Zijlstra
@ 2019-06-17 16:22     ` Qais Yousef
  0 siblings, 0 replies; 21+ messages in thread
From: Qais Yousef @ 2019-06-17 16:22 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, Steven Rostedt, linux-kernel, Pavankumar Kondeti,
	Sebastian Andrzej Siewior, Uwe Kleine-Konig, Dietmar Eggemann,
	Quentin Perret

On 06/17/19 17:55, Peter Zijlstra wrote:
> On Mon, Jun 17, 2019 at 01:51:23PM +0100, Qais Yousef wrote:
> > Hi Peter
> > 
> > On 06/04/19 12:14, Qais Yousef wrote:
> > > Changes in v3:
> > > 	- Split pelt_rq TP into pelt_cfs, pelt_rq, pelt_dl and pelt_irq
> > > 	- Replace the fatty preprocessing wrappers with exported helper
> > > 	  functions to access data in unexported structures.
> > > 	- Remove the now unnecessary headers that were introduced in the
> > > 	  previous versions.
> > > 	- Postfix the tracepoints with '_tp' to make them standout more in the
> > > 	  code as bare tracepoints with no events associated.
> > > 	- Updated the example module in [2]
> > > 		- It demonstrates now how to convert the tracepoints into trace
> > > 		  events that extend the sched events subsystem in tracefs.
> > 
> > Does this look okay now? If you have further comments please let me know so
> > I can address them in time in hope it'd make it to the next merge window.
> 
> Picked them up (with some minor edits). I feel there is far too much

Thanks!

> #ifdef in patch #2, but I couldn't quickly come up with anything much
> saner either.

We can protect the whole lot with #ifdef CONFIG_SMP? It means the external
module will fail to compile for UP configurations - which is fine I think since
we're just returning NULL anyway..

--
Qais Yousef

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

* Re: [PATCH v3 5/6] sched: Add sched_overutilized tracepoint
  2019-06-17 15:50   ` Peter Zijlstra
@ 2019-06-17 16:31     ` Qais Yousef
  0 siblings, 0 replies; 21+ messages in thread
From: Qais Yousef @ 2019-06-17 16:31 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, Steven Rostedt, linux-kernel, Pavankumar Kondeti,
	Sebastian Andrzej Siewior, Uwe Kleine-Konig, Dietmar Eggemann,
	Quentin Perret

On 06/17/19 17:50, Peter Zijlstra wrote:
> On Tue, Jun 04, 2019 at 12:14:58PM +0100, Qais Yousef wrote:
> > The new tracepoint allows us to track the changes in overutilized
> > status.
> > 
> > Overutilized status is associated with EAS. It indicates that the system
> > is in high performance state. EAS is disabled when the system is in this
> > state since there's not much energy savings while high performance tasks
> > are pushing the system to the limit and it's better to default to the
> > spreading behavior of the scheduler.
> > 
> > This tracepoint helps understanding and debugging the conditions under
> > which this happens.
> > 
> > Signed-off-by: Qais Yousef <qais.yousef@arm.com>
> > ---
> >  include/trace/events/sched.h |  4 ++++
> >  kernel/sched/fair.c          | 11 +++++++++--
> >  2 files changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> > index c7dd9bc7f001..edd96e04049f 100644
> > --- a/include/trace/events/sched.h
> > +++ b/include/trace/events/sched.h
> > @@ -621,6 +621,10 @@ DECLARE_TRACE(pelt_se_tp,
> >  	TP_PROTO(struct sched_entity *se),
> >  	TP_ARGS(se));
> >  
> > +DECLARE_TRACE(sched_overutilized_tp,
> > +	TP_PROTO(int overutilized, struct root_domain *rd),
> > +	TP_ARGS(overutilized, rd));
> > +
> 
> strictly speaking you only need @rd :-)

Yes. Sorry my brain was hardwired this is overutilized event so we need to
pass this info :-)

> 
> >  #endif /* _TRACE_SCHED_H */
> >  
> >  /* This part must be outside protection */
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 8e0015ebf109..e2418741608e 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -5179,8 +5179,10 @@ static inline bool cpu_overutilized(int cpu)
> >  
> >  static inline void update_overutilized_status(struct rq *rq)
> >  {
> > -	if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu))
> > +	if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu)) {
> >  		WRITE_ONCE(rq->rd->overutilized, SG_OVERUTILIZED);
> > +		trace_sched_overutilized_tp(1, rq->rd);
> > +	}
> >  }
> >  #else
> >  static inline void update_overutilized_status(struct rq *rq) { }
> > @@ -8542,8 +8544,13 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
> >  
> >  		/* Update over-utilization (tipping point, U >= 0) indicator */
> >  		WRITE_ONCE(rd->overutilized, sg_status & SG_OVERUTILIZED);
> > +
> > +		trace_sched_overutilized_tp(!!(sg_status & SG_OVERUTILIZED), rd);
> >  	} else if (sg_status & SG_OVERUTILIZED) {
> > -		WRITE_ONCE(env->dst_rq->rd->overutilized, SG_OVERUTILIZED);
> > +		struct root_domain *rd = env->dst_rq->rd;
> > +
> > +		WRITE_ONCE(rd->overutilized, SG_OVERUTILIZED);
> > +		trace_sched_overutilized_tp(1, rd);
> >  	}
> >  }
> 
> But I figure since we need both values anyway, this isn't too much of a
> bother.
> 
> I'm going to flip the argument order though.

Sounds good to me. The good news is that changing the signature should be
doable in the future if we felt the need to evolve it :-)

Thanks

--
Qais Yousef

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

* [tip:sched/core] sched/autogroup: Make autogroup_path() always available
  2019-06-04 11:14 ` [PATCH v3 1/6] sched: autogroup: Make autogroup_path() always available Qais Yousef
@ 2019-06-25  8:24   ` tip-bot for Qais Yousef
  0 siblings, 0 replies; 21+ messages in thread
From: tip-bot for Qais Yousef @ 2019-06-25  8:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, quentin.perret, qais.yousef, rostedt, pkondeti, mingo,
	u.kleine-koenig, torvalds, dietmar.eggemann, tglx, linux-kernel,
	peterz, bigeasy

Commit-ID:  9ba5090aecac08ff3ae54ac3bd94b61db7708ffc
Gitweb:     https://git.kernel.org/tip/9ba5090aecac08ff3ae54ac3bd94b61db7708ffc
Author:     Qais Yousef <qais.yousef@arm.com>
AuthorDate: Tue, 4 Jun 2019 12:14:54 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 24 Jun 2019 19:23:40 +0200

sched/autogroup: Make autogroup_path() always available

Remove the #ifdef CONFIG_SCHED_DEBUG.

Some of the tracepoints to be introduced in later patches need to access
this function. Hence make it always available since the tracepoints are
not protected by CONFIG_SCHED_DEBUG.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Perret <quentin.perret@arm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Link: https://lkml.kernel.org/r/20190604111459.2862-2-qais.yousef@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/autogroup.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/autogroup.c b/kernel/sched/autogroup.c
index 2d4ff5353ded..2067080bb235 100644
--- a/kernel/sched/autogroup.c
+++ b/kernel/sched/autogroup.c
@@ -259,7 +259,6 @@ out:
 }
 #endif /* CONFIG_PROC_FS */
 
-#ifdef CONFIG_SCHED_DEBUG
 int autogroup_path(struct task_group *tg, char *buf, int buflen)
 {
 	if (!task_group_is_autogroup(tg))
@@ -267,4 +266,3 @@ int autogroup_path(struct task_group *tg, char *buf, int buflen)
 
 	return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id);
 }
-#endif

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

* [tip:sched/core] sched/debug: Add a new sched_trace_*() helper functions
  2019-06-04 11:14 ` [PATCH v3 2/6] sched: add a new sched_trace_*() helper functions Qais Yousef
@ 2019-06-25  8:25   ` tip-bot for Qais Yousef
  0 siblings, 0 replies; 21+ messages in thread
From: tip-bot for Qais Yousef @ 2019-06-25  8:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, pkondeti, hpa, quentin.perret, torvalds, qais.yousef,
	tglx, rostedt, dietmar.eggemann, linux-kernel, peterz,
	u.kleine-koenig, bigeasy

Commit-ID:  3c93a0c04dfdcba199982b53b97488b1b1d90eff
Gitweb:     https://git.kernel.org/tip/3c93a0c04dfdcba199982b53b97488b1b1d90eff
Author:     Qais Yousef <qais.yousef@arm.com>
AuthorDate: Tue, 4 Jun 2019 12:14:55 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 24 Jun 2019 19:23:41 +0200

sched/debug: Add a new sched_trace_*() helper functions

The new functions allow modules to access internal data structures of
unexported struct cfs_rq and struct rq to extract important information
from the tracepoints to be introduced in later patches.

While at it fix alphabetical order of struct declarations in sched.h

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Perret <quentin.perret@arm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Link: https://lkml.kernel.org/r/20190604111459.2862-3-qais.yousef@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/sched.h | 16 ++++++++-
 kernel/sched/fair.c   | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1b2590a8d038..044c023875e8 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -35,6 +35,7 @@ struct audit_context;
 struct backing_dev_info;
 struct bio_list;
 struct blk_plug;
+struct capture_control;
 struct cfs_rq;
 struct fs_struct;
 struct futex_pi_state;
@@ -47,8 +48,9 @@ struct pid_namespace;
 struct pipe_inode_info;
 struct rcu_node;
 struct reclaim_state;
-struct capture_control;
 struct robust_list_head;
+struct root_domain;
+struct rq;
 struct sched_attr;
 struct sched_param;
 struct seq_file;
@@ -1920,4 +1922,16 @@ static inline void rseq_syscall(struct pt_regs *regs)
 
 #endif
 
+const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq);
+char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len);
+int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq);
+
+const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq);
+const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq);
+const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq);
+
+int sched_trace_rq_cpu(struct rq *rq);
+
+const struct cpumask *sched_trace_rd_span(struct root_domain *rd);
+
 #endif
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4f8754157763..461c3e9a67b2 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -275,6 +275,19 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp)
 	return grp->my_q;
 }
 
+static inline void cfs_rq_tg_path(struct cfs_rq *cfs_rq, char *path, int len)
+{
+	if (!path)
+		return;
+
+	if (cfs_rq && task_group_is_autogroup(cfs_rq->tg))
+		autogroup_path(cfs_rq->tg, path, len);
+	else if (cfs_rq && cfs_rq->tg->css.cgroup)
+		cgroup_path(cfs_rq->tg->css.cgroup, path, len);
+	else
+		strlcpy(path, "(null)", len);
+}
+
 static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
 {
 	struct rq *rq = rq_of(cfs_rq);
@@ -449,6 +462,12 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp)
 	return NULL;
 }
 
+static inline void cfs_rq_tg_path(struct cfs_rq *cfs_rq, char *path, int len)
+{
+	if (path)
+		strlcpy(path, "(null)", len);
+}
+
 static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
 {
 	return true;
@@ -10408,3 +10427,83 @@ __init void init_sched_fair_class(void)
 #endif /* SMP */
 
 }
+
+/*
+ * Helper functions to facilitate extracting info from tracepoints.
+ */
+
+const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq)
+{
+#ifdef CONFIG_SMP
+	return cfs_rq ? &cfs_rq->avg : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_avg);
+
+char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len)
+{
+	if (!cfs_rq) {
+		if (str)
+			strlcpy(str, "(null)", len);
+		else
+			return NULL;
+	}
+
+	cfs_rq_tg_path(cfs_rq, str, len);
+	return str;
+}
+EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_path);
+
+int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq)
+{
+	return cfs_rq ? cpu_of(rq_of(cfs_rq)) : -1;
+}
+EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_cpu);
+
+const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq)
+{
+#ifdef CONFIG_SMP
+	return rq ? &rq->avg_rt : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_rq_avg_rt);
+
+const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq)
+{
+#ifdef CONFIG_SMP
+	return rq ? &rq->avg_dl : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_rq_avg_dl);
+
+const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq)
+{
+#if defined(CONFIG_SMP) && defined(CONFIG_HAVE_SCHED_AVG_IRQ)
+	return rq ? &rq->avg_irq : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_rq_avg_irq);
+
+int sched_trace_rq_cpu(struct rq *rq)
+{
+	return rq ? cpu_of(rq) : -1;
+}
+EXPORT_SYMBOL_GPL(sched_trace_rq_cpu);
+
+const struct cpumask *sched_trace_rd_span(struct root_domain *rd)
+{
+#ifdef CONFIG_SMP
+	return rd ? rd->span : NULL;
+#else
+	return NULL;
+#endif
+}
+EXPORT_SYMBOL_GPL(sched_trace_rd_span);

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

* [tip:sched/core] sched/debug: Add new tracepoints to track PELT at rq level
  2019-06-04 11:14 ` [PATCH v3 3/6] sched: Add new tracepoints to track pelt at rq level Qais Yousef
@ 2019-06-25  8:26   ` tip-bot for Qais Yousef
  0 siblings, 0 replies; 21+ messages in thread
From: tip-bot for Qais Yousef @ 2019-06-25  8:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, pkondeti, quentin.perret, bigeasy, u.kleine-koenig,
	mingo, dietmar.eggemann, peterz, tglx, hpa, rostedt, qais.yousef,
	torvalds

Commit-ID:  ba19f51fcb549c7ee6261da243eea55a47e98d78
Gitweb:     https://git.kernel.org/tip/ba19f51fcb549c7ee6261da243eea55a47e98d78
Author:     Qais Yousef <qais.yousef@arm.com>
AuthorDate: Tue, 4 Jun 2019 12:14:56 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 24 Jun 2019 19:23:41 +0200

sched/debug: Add new tracepoints to track PELT at rq level

The new tracepoints allow tracking PELT signals at rq level for all
scheduling classes + irq.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Perret <quentin.perret@arm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Link: https://lkml.kernel.org/r/20190604111459.2862-4-qais.yousef@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/trace/events/sched.h | 23 +++++++++++++++++++++++
 kernel/sched/fair.c          |  6 ++++++
 kernel/sched/pelt.c          |  9 ++++++++-
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index c8c7c7efb487..520b89d384ec 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -594,6 +594,29 @@ TRACE_EVENT(sched_wake_idle_without_ipi,
 
 	TP_printk("cpu=%d", __entry->cpu)
 );
+
+/*
+ * Following tracepoints are not exported in tracefs and provide hooking
+ * mechanisms only for testing and debugging purposes.
+ *
+ * Postfixed with _tp to make them easily identifiable in the code.
+ */
+DECLARE_TRACE(pelt_cfs_tp,
+	TP_PROTO(struct cfs_rq *cfs_rq),
+	TP_ARGS(cfs_rq));
+
+DECLARE_TRACE(pelt_rt_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
+DECLARE_TRACE(pelt_dl_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
+DECLARE_TRACE(pelt_irq_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 461c3e9a67b2..e883d7e17e36 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3347,6 +3347,8 @@ static inline int propagate_entity_load_avg(struct sched_entity *se)
 	update_tg_cfs_util(cfs_rq, se, gcfs_rq);
 	update_tg_cfs_runnable(cfs_rq, se, gcfs_rq);
 
+	trace_pelt_cfs_tp(cfs_rq);
+
 	return 1;
 }
 
@@ -3499,6 +3501,8 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
 	add_tg_cfs_propagate(cfs_rq, se->avg.load_sum);
 
 	cfs_rq_util_change(cfs_rq, flags);
+
+	trace_pelt_cfs_tp(cfs_rq);
 }
 
 /**
@@ -3518,6 +3522,8 @@ static void detach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
 	add_tg_cfs_propagate(cfs_rq, -se->avg.load_sum);
 
 	cfs_rq_util_change(cfs_rq, 0);
+
+	trace_pelt_cfs_tp(cfs_rq);
 }
 
 /*
diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
index 42ea66b07b1d..4e961b55b5ea 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -28,6 +28,8 @@
 #include "sched.h"
 #include "pelt.h"
 
+#include <trace/events/sched.h>
+
 /*
  * Approximate:
  *   val * y^n,    where y^32 ~= 0.5 (~1 scheduling period)
@@ -292,6 +294,7 @@ int __update_load_avg_cfs_rq(u64 now, struct cfs_rq *cfs_rq)
 				cfs_rq->curr != NULL)) {
 
 		___update_load_avg(&cfs_rq->avg, 1, 1);
+		trace_pelt_cfs_tp(cfs_rq);
 		return 1;
 	}
 
@@ -317,6 +320,7 @@ int update_rt_rq_load_avg(u64 now, struct rq *rq, int running)
 				running)) {
 
 		___update_load_avg(&rq->avg_rt, 1, 1);
+		trace_pelt_rt_tp(rq);
 		return 1;
 	}
 
@@ -340,6 +344,7 @@ int update_dl_rq_load_avg(u64 now, struct rq *rq, int running)
 				running)) {
 
 		___update_load_avg(&rq->avg_dl, 1, 1);
+		trace_pelt_dl_tp(rq);
 		return 1;
 	}
 
@@ -388,8 +393,10 @@ int update_irq_load_avg(struct rq *rq, u64 running)
 				1,
 				1);
 
-	if (ret)
+	if (ret) {
 		___update_load_avg(&rq->avg_irq, 1, 1);
+		trace_pelt_irq_tp(rq);
+	}
 
 	return ret;
 }

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

* [tip:sched/core] sched/debug: Add new tracepoint to track PELT at se level
  2019-06-04 11:14 ` [PATCH v3 4/6] sched: Add new tracepoint to track pelt at se level Qais Yousef
@ 2019-06-25  8:27   ` tip-bot for Qais Yousef
  0 siblings, 0 replies; 21+ messages in thread
From: tip-bot for Qais Yousef @ 2019-06-25  8:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: dietmar.eggemann, bigeasy, linux-kernel, hpa, rostedt, tglx,
	mingo, quentin.perret, u.kleine-koenig, qais.yousef, torvalds,
	peterz, pkondeti

Commit-ID:  8de6242cca17d9299e654e29c966d8612d397272
Gitweb:     https://git.kernel.org/tip/8de6242cca17d9299e654e29c966d8612d397272
Author:     Qais Yousef <qais.yousef@arm.com>
AuthorDate: Tue, 4 Jun 2019 12:14:57 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 24 Jun 2019 19:23:42 +0200

sched/debug: Add new tracepoint to track PELT at se level

The new tracepoint allows tracking PELT signals at sched_entity level.
Which is supported in CFS tasks and taskgroups only.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Perret <quentin.perret@arm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Link: https://lkml.kernel.org/r/20190604111459.2862-5-qais.yousef@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/trace/events/sched.h | 4 ++++
 kernel/sched/fair.c          | 1 +
 kernel/sched/pelt.c          | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 520b89d384ec..c7dd9bc7f001 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -617,6 +617,10 @@ DECLARE_TRACE(pelt_irq_tp,
 	TP_PROTO(struct rq *rq),
 	TP_ARGS(rq));
 
+DECLARE_TRACE(pelt_se_tp,
+	TP_PROTO(struct sched_entity *se),
+	TP_ARGS(se));
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e883d7e17e36..75218ab1fa07 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3348,6 +3348,7 @@ static inline int propagate_entity_load_avg(struct sched_entity *se)
 	update_tg_cfs_runnable(cfs_rq, se, gcfs_rq);
 
 	trace_pelt_cfs_tp(cfs_rq);
+	trace_pelt_se_tp(se);
 
 	return 1;
 }
diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
index 4e961b55b5ea..a96db50d40e0 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -267,6 +267,7 @@ int __update_load_avg_blocked_se(u64 now, struct sched_entity *se)
 {
 	if (___update_load_sum(now, &se->avg, 0, 0, 0)) {
 		___update_load_avg(&se->avg, se_weight(se), se_runnable(se));
+		trace_pelt_se_tp(se);
 		return 1;
 	}
 
@@ -280,6 +281,7 @@ int __update_load_avg_se(u64 now, struct cfs_rq *cfs_rq, struct sched_entity *se
 
 		___update_load_avg(&se->avg, se_weight(se), se_runnable(se));
 		cfs_se_util_change(&se->avg);
+		trace_pelt_se_tp(se);
 		return 1;
 	}
 

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

* [tip:sched/core] sched/debug: Add sched_overutilized tracepoint
  2019-06-04 11:14 ` [PATCH v3 5/6] sched: Add sched_overutilized tracepoint Qais Yousef
  2019-06-17 15:50   ` Peter Zijlstra
@ 2019-06-25  8:27   ` tip-bot for Qais Yousef
  1 sibling, 0 replies; 21+ messages in thread
From: tip-bot for Qais Yousef @ 2019-06-25  8:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: quentin.perret, linux-kernel, tglx, bigeasy, mingo,
	u.kleine-koenig, peterz, dietmar.eggemann, hpa, rostedt,
	torvalds, qais.yousef, pkondeti

Commit-ID:  f9f240f96efc5bcec62379eac701523e11fbb45b
Gitweb:     https://git.kernel.org/tip/f9f240f96efc5bcec62379eac701523e11fbb45b
Author:     Qais Yousef <qais.yousef@arm.com>
AuthorDate: Tue, 4 Jun 2019 12:14:58 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 24 Jun 2019 19:23:42 +0200

sched/debug: Add sched_overutilized tracepoint

The new tracepoint allows us to track the changes in overutilized
status.

Overutilized status is associated with EAS. It indicates that the system
is in high performance state. EAS is disabled when the system is in this
state since there's not much energy savings while high performance tasks
are pushing the system to the limit and it's better to default to the
spreading behavior of the scheduler.

This tracepoint helps understanding and debugging the conditions under
which this happens.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Perret <quentin.perret@arm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Link: https://lkml.kernel.org/r/20190604111459.2862-6-qais.yousef@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/trace/events/sched.h |  4 ++++
 kernel/sched/fair.c          | 10 ++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index c7dd9bc7f001..420e80e56e55 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -621,6 +621,10 @@ DECLARE_TRACE(pelt_se_tp,
 	TP_PROTO(struct sched_entity *se),
 	TP_ARGS(se));
 
+DECLARE_TRACE(sched_overutilized_tp,
+	TP_PROTO(struct root_domain *rd, bool overutilized),
+	TP_ARGS(rd, overutilized));
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 75218ab1fa07..11ec52709323 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5181,8 +5181,10 @@ static inline bool cpu_overutilized(int cpu)
 
 static inline void update_overutilized_status(struct rq *rq)
 {
-	if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu))
+	if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu)) {
 		WRITE_ONCE(rq->rd->overutilized, SG_OVERUTILIZED);
+		trace_sched_overutilized_tp(rq->rd, SG_OVERUTILIZED);
+	}
 }
 #else
 static inline void update_overutilized_status(struct rq *rq) { }
@@ -8214,8 +8216,12 @@ next_group:
 
 		/* Update over-utilization (tipping point, U >= 0) indicator */
 		WRITE_ONCE(rd->overutilized, sg_status & SG_OVERUTILIZED);
+		trace_sched_overutilized_tp(rd, sg_status & SG_OVERUTILIZED);
 	} else if (sg_status & SG_OVERUTILIZED) {
-		WRITE_ONCE(env->dst_rq->rd->overutilized, SG_OVERUTILIZED);
+		struct root_domain *rd = env->dst_rq->rd;
+
+		WRITE_ONCE(rd->overutilized, SG_OVERUTILIZED);
+		trace_sched_overutilized_tp(rd, SG_OVERUTILIZED);
 	}
 }
 

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

* [tip:sched/core] sched/debug: Export the newly added tracepoints
  2019-06-04 11:14 ` [PATCH v3 6/6] sched: export the newly added tracepoints Qais Yousef
@ 2019-06-25  8:28   ` tip-bot for Qais Yousef
  0 siblings, 0 replies; 21+ messages in thread
From: tip-bot for Qais Yousef @ 2019-06-25  8:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: u.kleine-koenig, bigeasy, peterz, pkondeti, quentin.perret,
	torvalds, tglx, hpa, dietmar.eggemann, rostedt, mingo,
	qais.yousef, linux-kernel

Commit-ID:  a056a5bed7fa67706574b00cf1122c38596b2be1
Gitweb:     https://git.kernel.org/tip/a056a5bed7fa67706574b00cf1122c38596b2be1
Author:     Qais Yousef <qais.yousef@arm.com>
AuthorDate: Tue, 4 Jun 2019 12:14:59 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 24 Jun 2019 19:23:43 +0200

sched/debug: Export the newly added tracepoints

So that external modules can hook into them and extract the info they
need. Since these new tracepoints have no events associated with them
exporting these tracepoints make them useful for external modules to
perform testing and debugging. There's no other way otherwise to access
them.

BPF doesn't have infrastructure to access these bare tracepoints either.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Perret <quentin.perret@arm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Link: https://lkml.kernel.org/r/20190604111459.2862-7-qais.yousef@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 83bd6bb32a34..e5e02d23e693 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -23,6 +23,17 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/sched.h>
 
+/*
+ * Export tracepoints that act as a bare tracehook (ie: have no trace event
+ * associated with them) to allow external modules to probe them.
+ */
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_cfs_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_rt_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_dl_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_irq_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_se_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp);
+
 DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
 
 #if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL)

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

end of thread, other threads:[~2019-06-25  8:29 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
2019-06-04 11:14 ` [PATCH v3 1/6] sched: autogroup: Make autogroup_path() always available Qais Yousef
2019-06-25  8:24   ` [tip:sched/core] sched/autogroup: " tip-bot for Qais Yousef
2019-06-04 11:14 ` [PATCH v3 2/6] sched: add a new sched_trace_*() helper functions Qais Yousef
2019-06-25  8:25   ` [tip:sched/core] sched/debug: Add " tip-bot for Qais Yousef
2019-06-04 11:14 ` [PATCH v3 3/6] sched: Add new tracepoints to track pelt at rq level Qais Yousef
2019-06-25  8:26   ` [tip:sched/core] sched/debug: Add new tracepoints to track PELT " tip-bot for Qais Yousef
2019-06-04 11:14 ` [PATCH v3 4/6] sched: Add new tracepoint to track pelt at se level Qais Yousef
2019-06-25  8:27   ` [tip:sched/core] sched/debug: Add new tracepoint to track PELT " tip-bot for Qais Yousef
2019-06-04 11:14 ` [PATCH v3 5/6] sched: Add sched_overutilized tracepoint Qais Yousef
2019-06-17 15:50   ` Peter Zijlstra
2019-06-17 16:31     ` Qais Yousef
2019-06-25  8:27   ` [tip:sched/core] sched/debug: " tip-bot for Qais Yousef
2019-06-04 11:14 ` [PATCH v3 6/6] sched: export the newly added tracepoints Qais Yousef
2019-06-25  8:28   ` [tip:sched/core] sched/debug: Export " tip-bot for Qais Yousef
2019-06-05  6:17 ` [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Christoph Hellwig
2019-06-05  7:22   ` Peter Zijlstra
2019-06-05 22:33   ` Qais Yousef
2019-06-17 12:51 ` Qais Yousef
2019-06-17 15:55   ` Peter Zijlstra
2019-06-17 16:22     ` Qais Yousef

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).