2017-07-04 12:31:33

by Claudio Scordino

[permalink] [raw]
Subject: [PATCH] sched/deadline: add GRUB bw change tracepoints

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

Signed-off-by: Claudio Scordino <[email protected]>
Signed-off-by: Juri Lelli <[email protected]>
Signed-off-by: Luca Abeni <[email protected]>
---
include/trace/events/sched.h | 32 ++++++++++++++++++++++++++++++++
kernel/sched/deadline.c | 11 +++++++++++
2 files changed, 43 insertions(+)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index ae1409f..050fcb2 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -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.
*/
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index a84299f..ae5c7ef 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -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)
--
2.7.4


2017-07-04 12:49:25

by Juri Lelli

[permalink] [raw]
Subject: Re: [PATCH] sched/deadline: add GRUB bw change tracepoints

Hi Claudio,

On 04/07/17 14:29, Claudio Scordino wrote:
> This patch adds a tracepoint for tracing the total and running
> bandwidths of GRUB's runqueue.
>
> Signed-off-by: Claudio Scordino <[email protected]>
> Signed-off-by: Juri Lelli <[email protected]>

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

Best,

- Juri

2017-07-04 13:16:47

by Claudio Scordino

[permalink] [raw]
Subject: Re: [PATCH] sched/deadline: add GRUB bw change tracepoints

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]>:
> 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,
>
> On 04/07/17 14:29, Claudio Scordino wrote:
>> This patch adds a tracepoint for tracing the total and running
>> bandwidths of GRUB's runqueue.
>>
>> Signed-off-by: Claudio Scordino <[email protected]>
>> Signed-off-by: Juri Lelli <[email protected]>
>
> Don't remember signing this off.
> Or if I did it was maybe for internal debugging?
>
> Best,
>
> - Juri
>
>



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

2017-07-06 03:40:25

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] sched/deadline: add GRUB bw change tracepoints

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


Attachments:
(No filename) (1.97 kB)
.config.gz (49.01 kB)
Download all attachments