Thread (7 messages) flat view 7 messages, 4 authors, 2021-07-07

Re: [PATCH] tools/runqslower: use __state instead of state

From: Andrii Nakryiko <hidden>
Date: 2021-07-07 04:23:28
Also in: bpf

On Tue, Jul 6, 2021 at 11:26 AM Yonghong Song [off-list ref] wrote:


On 7/6/21 10:44 AM, SanjayKumar J wrote:
quoted
      task->state is renamed to task->__state in task_struct
Could you add a reference to
   2f064a59a11f ("sched: Change task_struct::state")
which added this change?

I think this should go to bpf tree as the change is in linus tree now.
Could you annotate the tag as "[PATCH bpf]" ("[PATCH bpf v2]")?

Please align comments to the left without margins.
quoted
      Signed-off-by: SanjayKumar J [off-list ref]
This Singed-off-by is not needed.

You can add my Ack in the next revision:
Acked-by: Yonghong Song <redacted>
quoted
Signed-off-by: SanjayKumar J <redacted>
Please use a full and proper name in Signed-off-by.

This currently breaks selftests build in bpf tree, so please
prioritize sending v2. Alternatively, we can apply Jiri's fix instead.
quoted
---
  tools/bpf/runqslower/runqslower.bpf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bpf/runqslower/runqslower.bpf.c b/tools/bpf/runqslower/runqslower.bpf.c
index 645530ca7e98..ab9353f2fd46 100644
--- a/tools/bpf/runqslower/runqslower.bpf.c
+++ b/tools/bpf/runqslower/runqslower.bpf.c
@@ -74,7 +74,7 @@ int handle__sched_switch(u64 *ctx)
      u32 pid;

      /* ivcsw: treat like an enqueue event and store timestamp */
-     if (prev->state == TASK_RUNNING)
+     if (prev->__state == TASK_RUNNING)
Currently, runqslower.bpf.c uses vmlinux.h.
I am thinking to use bpf_core_field_exists(), but we need to
single out task_struct structure from vmlinux.h
with both state and __state fields, we could make it work
by *changes* like

#define task_struct task_struct_orig
#include "vmlinux.h"
#undef task_struct

struct task_struct {
    ... state;
    ... __state;
...
};

Considering tools/bpf/runqslower is tied with a particular
kernel source, and vmlinux.h mostly derived from that
kernel source, I feel the above change is not necessary.
quoted
              trace_enqueue(prev);

      pid = next->pid;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help