Skip to contentSkip to conversation

sched/deadline: add GRUB bw change tracepoints

PATCH In review Claudio Scordino 3 participants 4 messages Jul 4, 2017 – Jul 6, 2017 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/deadline: add GRUB bw change tracepoints

This patch adds a tracepoint for tracing the total and running bandwidths of GRUB's runqueue.

---
 include/trace/events/sched.h | 32 ++++++++++++++++++++++++++++++++
 kernel/sched/deadline.c      | 11 +++++++++++
 2 files changed, 43 insertions(+)
include/trace/events/sched.h +32 -0
index ae1409f..050fcb2 100644
@@ -545,6 +545,38 @@ TRACE_EVENT(sched_swap_numa,
 			__entry->dst_cpu, __entry->dst_nid)
 );
 
+DECLARE_EVENT_CLASS(sched_dl_grub_template,
+
+	TP_PROTO(u64 this_bw, u64 running_bw, unsigned int cpu_id),
+
+	TP_ARGS(this_bw, running_bw, cpu_id),
+
+	TP_STRUCT__entry(
+		__field(u64,		this_bw)
+		__field(u64,		running_bw)
+		__field(u32,		cpu_id)
+	),
+
+	TP_fast_assign(
+		__entry->this_bw = this_bw;
+		__entry->running_bw = running_bw;
+		__entry->cpu_id = cpu_id;
+	),
+
+	TP_printk("total_bw=%llu running_bw=%llu cpu_id=%lu",
+		(unsigned long long)__entry->this_bw,
+		(unsigned long long)__entry->running_bw,
+		(unsigned long)__entry->cpu_id)
+);
+
+
+DEFINE_EVENT(sched_dl_grub_template, sched_dl_grub,
+
+	TP_PROTO(u64 this_bw, u64 running_bw, unsigned int cpu_id),
+
+	TP_ARGS(this_bw, running_bw, cpu_id)
+);
+
 /*
  * Tracepoint for waking a polling cpu without an IPI.
  */
kernel/sched/deadline.c +11 -0
index a84299f..ae5c7ef 100644
@@ -17,6 +17,7 @@
 #include "sched.h"
 
 #include <linux/slab.h>
+#include <trace/events/sched.h>
 #include <uapi/linux/sched/types.h>
 
 struct dl_bandwidth def_dl_bandwidth;
@@ -85,6 +86,8 @@ void add_running_bw(u64 dl_bw, struct dl_rq *dl_rq)
 	dl_rq->running_bw += dl_bw;
 	SCHED_WARN_ON(dl_rq->running_bw < old); /* overflow */
 	SCHED_WARN_ON(dl_rq->running_bw > dl_rq->this_bw);
+	trace_sched_dl_grub(dl_rq->this_bw, dl_rq->running_bw,
+			rq_of_dl_rq(dl_rq)->cpu);
 }
 
 static inline
@@ -97,6 +100,8 @@ void sub_running_bw(u64 dl_bw, struct dl_rq *dl_rq)
 	SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */
 	if (dl_rq->running_bw > old)
 		dl_rq->running_bw = 0;
+	trace_sched_dl_grub(dl_rq->this_bw, dl_rq->running_bw,
+			rq_of_dl_rq(dl_rq)->cpu);
 }
 
 static inline
@@ -107,6 +112,9 @@ void add_rq_bw(u64 dl_bw, struct dl_rq *dl_rq)
 	lockdep_assert_held(&(rq_of_dl_rq(dl_rq))->lock);
 	dl_rq->this_bw += dl_bw;
 	SCHED_WARN_ON(dl_rq->this_bw < old); /* overflow */
+	trace_sched_dl_grub(dl_rq->this_bw, dl_rq->running_bw,
+			rq_of_dl_rq(dl_rq)->cpu);
+
 }
 
 static inline
@@ -120,6 +128,9 @@ void sub_rq_bw(u64 dl_bw, struct dl_rq *dl_rq)
 	if (dl_rq->this_bw > old)
 		dl_rq->this_bw = 0;
 	SCHED_WARN_ON(dl_rq->running_bw > dl_rq->this_bw);
+	trace_sched_dl_grub(dl_rq->this_bw, dl_rq->running_bw,
+			rq_of_dl_rq(dl_rq)->cpu);
+
 }
 
 void dl_change_utilization(struct task_struct *p, u64 new_bw)
Signature · 1 line
2.7.4
#5 lore raw
In reply to a message not in the archive

Ouch, you'right.

Now that I recall, you provided the first draft for internal debugging but it was Luca who agreed to add it to the patchset. Sorry for the mistake guys.

Best,

Claudio

2017-07-04 15:12 GMT+02:00 Claudio Scordino <[email protected]>:

Quoted 30 lines

Ouch, you'right.

Now that I recall, you provided the first draft for internal debugging but it was Luca who agreed to add it to the patchset. Sorry for the mistake guys.

Best,

Claudio

Il 04/lug/2017 14:49, "Juri Lelli" <[email protected]> ha scritto:

Hi Claudio,

Quoted 5 lines · Claudio Scordino

This patch adds a tracepoint for tracing the total and running bandwidths of GRUB's runqueue.

Don't remember signing this off.
Or if I did it was maybe for internal debugging?

Best,

- Juri

Signature · 10 lines
Claudio Scordino, Ph.D.
Project Manager - Funded research projects

Evidence Srl
Via Carducci 56
56010 S.Giuliano Terme - Pisa - Italy
Phone:  +39 050 99 11 122
Mobile: + 39 393 811 7491
Fax:   +39 050 99 10 812
http://www.evidence.eu.com
#6 lore raw
In reply to Claudio Scordino
url: https://github.com/0day-ci/linux/commits/Claudio-Scordino/sched-deadline-add-GRUB-bw-change-tracepoints/20170706-091701 config: xtensa-allyesconfig (attached as .config) compiler…

Hi Claudio,

[auto build test ERROR on tip/auto-latest]
[cannot apply to v4.12]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Claudio-Scordino/sched-deadline-add-GRUB-bw-change-tracepoints/20170706-091701
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa

All errors (new ones prefixed by >>):

kernel/sched/deadline.c: In function 'add_running_bw':

>> kernel/sched/deadline.c:90:22: error: 'struct rq' has no member named 'cpu'
       rq_of_dl_rq(dl_rq)->cpu);
                         ^
   kernel/sched/deadline.c: In function 'sub_running_bw':
   kernel/sched/deadline.c:104:22: error: 'struct rq' has no member named 'cpu'
       rq_of_dl_rq(dl_rq)->cpu);
                         ^
   kernel/sched/deadline.c: In function 'add_rq_bw':
   kernel/sched/deadline.c:116:22: error: 'struct rq' has no member named 'cpu'
       rq_of_dl_rq(dl_rq)->cpu);
                         ^
   kernel/sched/deadline.c: In function 'sub_rq_bw':
   kernel/sched/deadline.c:132:22: error: 'struct rq' has no member named 'cpu'
       rq_of_dl_rq(dl_rq)->cpu);
                         ^

vim +90 kernel/sched/deadline.c

    84	
    85		lockdep_assert_held(&(rq_of_dl_rq(dl_rq))->lock);
    86		dl_rq->running_bw += dl_bw;
    87		SCHED_WARN_ON(dl_rq->running_bw < old); /* overflow */
    88		SCHED_WARN_ON(dl_rq->running_bw > dl_rq->this_bw);
    89		trace_sched_dl_grub(dl_rq->this_bw, dl_rq->running_bw,
  > 90				rq_of_dl_rq(dl_rq)->cpu);
    91	}
    92	
    93	static inline

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation