On Sat, Nov 20, 2021 at 09:02:55AM IST, Alexei Starovoitov wrote: > From: Alexei Starovoitov <ast@xxxxxxxxxx> > > The commit 087cba799ced ("selftests/bpf: Add weak/typeless ksym test for light skeleton") > added test_ksyms_weak to light skeleton testing, but remove CO-RE access. > Revert that part of commit, since light skeleton can use CO-RE in the kernel. > > Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> > --- > tools/testing/selftests/bpf/prog_tests/ksyms_btf.c | 4 ++-- > tools/testing/selftests/bpf/progs/test_ksyms_weak.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/bpf/prog_tests/ksyms_btf.c b/tools/testing/selftests/bpf/prog_tests/ksyms_btf.c > index 79f6bd1e50d6..988f5db3e342 100644 > --- a/tools/testing/selftests/bpf/prog_tests/ksyms_btf.c > +++ b/tools/testing/selftests/bpf/prog_tests/ksyms_btf.c > @@ -101,7 +101,7 @@ static void test_weak_syms(void) > usleep(1); > > data = skel->data; > - ASSERT_EQ(data->out__existing_typed, 0, "existing typed ksym"); > + ASSERT_GE(data->out__existing_typed, 0, "existing typed ksym"); I think original test (2211c825e7b6b) was doing ASSERT_EQ, since per cpu ptr for runqueue is from CPU 0. > ASSERT_NEQ(data->out__existing_typeless, -1, "existing typeless ksym"); > ASSERT_EQ(data->out__non_existent_typeless, 0, "nonexistent typeless ksym"); > ASSERT_EQ(data->out__non_existent_typed, 0, "nonexistent typed ksym"); > @@ -128,7 +128,7 @@ static void test_weak_syms_lskel(void) > usleep(1); > > data = skel->data; > - ASSERT_EQ(data->out__existing_typed, 0, "existing typed ksym"); > + ASSERT_GE(data->out__existing_typed, 0, "existing typed ksym"); > ASSERT_NEQ(data->out__existing_typeless, -1, "existing typeless ksym"); > ASSERT_EQ(data->out__non_existent_typeless, 0, "nonexistent typeless ksym"); > ASSERT_EQ(data->out__non_existent_typed, 0, "nonexistent typed ksym"); > diff --git a/tools/testing/selftests/bpf/progs/test_ksyms_weak.c b/tools/testing/selftests/bpf/progs/test_ksyms_weak.c > index 8eadbd4caf7a..5f8379aadb29 100644 > --- a/tools/testing/selftests/bpf/progs/test_ksyms_weak.c > +++ b/tools/testing/selftests/bpf/progs/test_ksyms_weak.c > @@ -38,7 +38,7 @@ int pass_handler(const void *ctx) > /* tests existing symbols. */ > rq = (struct rq *)bpf_per_cpu_ptr(&runqueues, 0); > if (rq) > - out__existing_typed = 0; > + out__existing_typed = rq->cpu; > out__existing_typeless = (__u64)&bpf_prog_active; > > /* tests non-existent symbols. */ > -- > 2.30.2 > -- Kartikeya