Hello, On Fri, Mar 11, 2022 at 2:23 PM Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > > On Thu, Mar 10, 2022 at 12:22 AM Namhyung Kim <namhyung@xxxxxxxxxx> wrote: > > +SEC("tracepoint/sched/sched_switch") > > +int oncpu(struct sched_switch_args *ctx) > > +{ > > + __u32 max_len = TEST_STACK_DEPTH * sizeof(__u64); > > + __u32 key = 0, val = 0, *value_p; > > + __u64 *stack_p; > > + > > please also add filtering by PID to avoid interference from other > selftests when run in parallel mode Will do! Thanks, Namhyung > > > + value_p = bpf_map_lookup_elem(&control_map, &key); > > + if (value_p && *value_p) > > + return 0; /* skip if non-zero *value_p */ > > + > > + /* it should allow skipping whole buffer size entries */ > > + key = bpf_get_stackid(ctx, &stackmap, TEST_STACK_DEPTH); > > + if ((int)key >= 0) { > > + /* The size of stackmap and stack_amap should be the same */ > > + bpf_map_update_elem(&stackid_hmap, &key, &val, 0); > > + stack_p = bpf_map_lookup_elem(&stack_amap, &key); > > + if (stack_p) { > > + bpf_get_stack(ctx, stack_p, max_len, TEST_STACK_DEPTH); > > + /* it wrongly skipped all the entries and filled zero */ > > + if (stack_p[0] == 0) > > + failed = 1; > > + } > > + } else if ((int)key == -14/*EFAULT*/) { > > + /* old kernel doesn't support skipping that many entries */ > > + failed = 2; > > + } > > + > > + return 0; > > +} > > + > > +char _license[] SEC("license") = "GPL"; > > -- > > 2.35.1.723.g4982287a31-goog > >