tools/runqslower: use __state instead of state
Subsystems (3)
PATCH 1/1 tools/runqslower: use __state instead of state
task->state is renamed to task->__state in task_struct Signed-off-by: SanjayKumar J <[email protected]>
--- tools/bpf/runqslower/runqslower.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/runqslower/runqslower.bpf.c +1 -1
@@ -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 )trace_enqueue (prev); pid = next->pid;
Signature · 1 line
2.32.0
Quoted 1 line · SanjayKumar J
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 2 lines
Signed-off-by SanjayKumar J <[email protected]>
This Singed-off-by is not needed.
You can add my Ack in the next revision:
Quoted 11 lines
Signed-off-by SanjayKumar J <[email protected]>--- tools/bpf/runqslower/runqslower.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/bpf/runqslower/runqslower.bpf.c +0
-0
tools/bpf/runqslower/runqslower.bpf.c int handle__sched_switch(u64 *ctx) · line 77
Quoted 5 lines
tools/bpf/runqslower/runqslower.bpf.c +1
-1@@ -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 4 lines
tools/bpf/runqslower/runqslower.bpf.c +0
-0trace_enqueue (prev); pid = next->pid;
Quoted 50 lines · Yonghong Song
Quoted 1 line · SanjayKumar J
task->state is renamed to task->__state in task_structCould you add a reference to
2f064a59a11f("sched: Changetask_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 2 lines
Signed-off-by SanjayKumar J <[email protected]>This Singed-off-by is not needed.
You can add my Ack in the next revision:
Acked-by Yonghong Song <[email protected]>Quoted 11 lines
Signed-off-by SanjayKumar J <[email protected]>--- tools/bpf/runqslower/runqslower.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/bpf/runqslower/runqslower.bpf.c +0
-0tools/bpf/runqslower/runqslower.bpf.c int handle__sched_switch(u64 *ctx) · line 77
Quoted 5 lines
tools/bpf/runqslower/runqslower.bpf.c +1
-1@@ -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.cusesvmlinux.h.
I am thinking to usebpf_core_field_exists(), but we need to single outtask_structstructure fromvmlinux.hwith both state and__statefields, we could make it work by *changes* like#define
task_structtask_struct_orig
#include "vmlinux.h"
#undeftask_struct
Quoted 5 lines
struct task_struct { ... state; ... __state;...
};
no need for such surgery, recommended way is to use ___suffix to declare incompatible struct definition:
struct task_struct___old {
int state;
};Then do casting in BPF code. We don't have to do it in kernel tree's runqslower, but we'll definitely have to do that for libbpf-tools' runqslower and runqlat.
Quoted 9 lines
Considering
tools/bpf/runqsloweris tied with a particular kernel source, andvmlinux.hmostly derived from that kernel source, I feel the above change is not necessary.Quoted 4 lines
tools/bpf/runqslower/runqslower.bpf.c +0
-0trace_enqueue (prev); pid = next->pid;
Song Liu
reviewerQuoted 62 lines · Andrii Nakryiko
Quoted 50 lines · Yonghong Song
Quoted 1 line · SanjayKumar J
task->state is renamed to task->__state in task_structCould you add a reference to
2f064a59a11f("sched: Changetask_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 2 lines
Signed-off-by SanjayKumar J <[email protected]>This Singed-off-by is not needed.
You can add my Ack in the next revision:
Acked-by Yonghong Song <[email protected]>Quoted 11 lines
Signed-off-by SanjayKumar J <[email protected]>--- tools/bpf/runqslower/runqslower.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/bpf/runqslower/runqslower.bpf.c +0
-0tools/bpf/runqslower/runqslower.bpf.c int handle__sched_switch(u64 *ctx) · line 77
Quoted 5 lines
tools/bpf/runqslower/runqslower.bpf.c +1
-1@@ -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.cusesvmlinux.h.
I am thinking to usebpf_core_field_exists(), but we need to single outtask_structstructure fromvmlinux.hwith both state and__statefields, we could make it work by *changes* like#define
task_structtask_struct_orig
#include "vmlinux.h"
#undeftask_structQuoted 5 lines
struct task_struct { ... state; ... __state;...
};no need for such surgery, recommended way is to use
___suffixto declare incompatible struct definition:
Quoted 7 lines
struct task_struct___old { int state; };Then do casting in BPF code. We don't have to do it in kernel tree's runqslower, but we'll definitely have to do that for libbpf-tools' runqslower and runqlat.
Question on this topic: state and __state are of different sizes here. IIUC, bpf_core_types_are_compat() does allow size mismatch. But it may cause problems in some cases, no? For example, would some combination make task->state return 32 extra bits from another field and cause confusion?
Thanks,
Song
Quoted 69 lines · Song Liu
Quoted 66 lines · Andrii Nakryiko
Quoted 50 lines · Yonghong Song
Quoted 1 line · SanjayKumar J
task->state is renamed to task->__state in task_structCould you add a reference to
2f064a59a11f("sched: Changetask_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 2 lines
Signed-off-by SanjayKumar J <[email protected]>This Singed-off-by is not needed.
You can add my Ack in the next revision:
Acked-by Yonghong Song <[email protected]>Quoted 11 lines
Signed-off-by SanjayKumar J <[email protected]>--- tools/bpf/runqslower/runqslower.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/bpf/runqslower/runqslower.bpf.c +0
-0tools/bpf/runqslower/runqslower.bpf.c int handle__sched_switch(u64 *ctx) · line 77
Quoted 5 lines
tools/bpf/runqslower/runqslower.bpf.c +1
-1@@ -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.cusesvmlinux.h.
I am thinking to usebpf_core_field_exists(), but we need to single outtask_structstructure fromvmlinux.hwith both state and__statefields, we could make it work by *changes* like#define
task_structtask_struct_orig
#include "vmlinux.h"
#undeftask_structQuoted 5 lines
struct task_struct { ... state; ... __state;...
};no need for such surgery, recommended way is to use
___suffixto declare incompatible struct definition:struct task_struct___old { int state; };
Quoted 8 lines
Quoted 3 lines
Then do casting in BPF code. We don't have to do it in kernel tree's runqslower, but we'll definitely have to do that for libbpf-tools' runqslower and runqlat.
Question on this topic: state and
__stateare of different sizes here. IIUC,bpf_core_types_are_compat()does allow size mismatch. But it may cause problems in some cases, no? For example, would some combination maketask->statereturn 32 extra bits from another field and cause confusion?
In this case it's two different fields, long state vs int __state, so there is no confusion, you'd be using either one or another. But even if it was the same field and its type changed from long to int, libbpf will still try to accommodate that. Worst case, BPF_CORE_READ_BITFIELD() is able to read any bitfield or integer field, regardless of its size.
Quoted 3 lines
Thanks,
Song
Quoted 16 lines · Yonghong Song
Quoted 1 line · SanjayKumar J
task->state is renamed to task->__state in task_structCould you add a reference to
2f064a59a11f("sched: Changetask_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 1 line
Quoted 9 lines
Quoted 1 line
Signed-off-by SanjayKumar J <[email protected]>This Singed-off-by is not needed.
You can add my Ack in the next revision:
Acked-by Yonghong Song <[email protected]>Quoted 2 lines
Signed-off-by SanjayKumar J <[email protected]>
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 39 lines
Quoted 9 lines
--- tools/bpf/runqslower/runqslower.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/bpf/runqslower/runqslower.bpf.c +0
-0tools/bpf/runqslower/runqslower.bpf.c int handle__sched_switch(u64 *ctx) · line 77
Quoted 5 lines
tools/bpf/runqslower/runqslower.bpf.c +1
-1@@ -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.cusesvmlinux.h.
I am thinking to usebpf_core_field_exists(), but we need to single outtask_structstructure fromvmlinux.hwith both state and__statefields, we could make it work by *changes* like#define
task_structtask_struct_orig
#include "vmlinux.h"
#undeftask_structstruct task_struct { ... state; ... __state;...
};Considering
tools/bpf/runqsloweris tied with a particular kernel source, andvmlinux.hmostly derived from that kernel source, I feel the above change is not necessary.Quoted 4 lines
tools/bpf/runqslower/runqslower.bpf.c +0
-0trace_enqueue (prev); pid = next->pid;
Quoted 26 lines · Andrii Nakryiko
Quoted 24 lines · Yonghong Song
Quoted 1 line · SanjayKumar J
task->state is renamed to task->__state in task_structCould you add a reference to
2f064a59a11f("sched: Changetask_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 2 lines
Signed-off-by SanjayKumar J <[email protected]>This Singed-off-by is not needed.
You can add my Ack in the next revision:
Acked-by Yonghong Song <[email protected]>Quoted 1 line
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Signed-off-by SanjayKumar J <[email protected]>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.
I have send v4 .. apologies for the iterations.
Quoted 39 lines
Quoted 39 lines
Quoted 9 lines
--- tools/bpf/runqslower/runqslower.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/bpf/runqslower/runqslower.bpf.c +0
-0tools/bpf/runqslower/runqslower.bpf.c int handle__sched_switch(u64 *ctx) · line 77
Quoted 5 lines
tools/bpf/runqslower/runqslower.bpf.c +1
-1@@ -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.cusesvmlinux.h.
I am thinking to usebpf_core_field_exists(), but we need to single outtask_structstructure fromvmlinux.hwith both state and__statefields, we could make it work by *changes* like#define
task_structtask_struct_orig
#include "vmlinux.h"
#undeftask_structstruct task_struct { ... state; ... __state;...
};Considering
tools/bpf/runqsloweris tied with a particular kernel source, andvmlinux.hmostly derived from that kernel source, I feel the above change is not necessary.Quoted 4 lines
tools/bpf/runqslower/runqslower.bpf.c +0
-0trace_enqueue (prev); pid = next->pid;