Skip to content

Commit

Permalink
tools: fix runqslower warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeromemarchand committed Jul 3, 2019
1 parent bb47703 commit bac633a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/runqslower.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
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);
Expand Down

0 comments on commit bac633a

Please sign in to comment.