bcc/SOURCES/bcc-0.8.0-tools-fix-runqslower-warning.patch

38 lines
1.4 KiB
Diff
Raw Normal View History

2019-11-05 18:16:40 +00:00
From bac633a6bb60b6b8542348ea3f61c367eae14f7c Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Wed, 3 Jul 2019 11:12:08 +0200
Subject: [PATCH] tools: fix runqslower warning
The state member of task_struct is volatile and it's use as the last
parameter of bpf_probe_read (const void *) triggers the following
clang warning (LLVM 8):
/virtual/main.c:56:42: warning: passing 'volatile long *' to parameter of type 'const void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
bpf_probe_read(&state, sizeof(long), &prev->state);
^~~~~~~~~~~~
1 warning generated.
Tracing run queue latency higher than 10000 us
TIME COMM PID LAT(us)
An explicit cast fixes the warning.
---
tools/runqslower.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/runqslower.py b/tools/runqslower.py
index 1d48be8a..5f5c3b9b 100755
--- a/tools/runqslower.py
+++ b/tools/runqslower.py
@@ -167,7 +167,7 @@ RAW_TRACEPOINT_PROBE(sched_switch)
long state;
// ivcsw: treat like an enqueue event and store timestamp
- bpf_probe_read(&state, sizeof(long), &prev->state);
+ bpf_probe_read(&state, sizeof(long), (const void *)&prev->state);
if (state == TASK_RUNNING) {
bpf_probe_read(&tgid, sizeof(prev->tgid), &prev->tgid);
bpf_probe_read(&pid, sizeof(prev->pid), &prev->pid);
--
2.20.1