From: Jiri Olsa <olsajiri@gmail.com>
To: Rong Tao <rtoax@foxmail.com>
Cc: olsajiri@gmail.com, andrii@kernel.org, ast@kernel.org,
bpf@vger.kernel.org, daniel@iogearbox.net, haoluo@google.com,
john.fastabend@gmail.com, kpsingh@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
martin.lau@linux.dev, mykolal@fb.com, rongtao@cestc.cn,
sdf@google.com, shuah@kernel.org, song@kernel.org,
yonghong.song@linux.dev
Subject: Re: [PATCH bpf-next v6] selftests/bpf: trace_helpers.c: optimize kallsyms cache
Date: Fri, 25 Aug 2023 11:08:22 +0200 [thread overview]
Message-ID: <ZOhvhnUTxtD6YYzl@krava> (raw)
In-Reply-To: <tencent_492BE2E81E62BEC199106096C025954AFD06@qq.com>
On Tue, Aug 22, 2023 at 08:38:58AM +0800, Rong Tao wrote:
> > I think you need to fix this on samples/bpf side
> >
> > I tried to play with the samples/bpf/ includes, but couldn't find a way to
> > make this work.. selftests base includes on tools/include, while samples
> > have $(objtree)/usr/include as first include and AFAICS the __must_check is
> > defined under __KERNEL__ ifdef
> >
> > I guess the reason samples use $(objtree)/usr/include is to get some struct
> > definitions which are not in tools/include, but looks like some samples objects
> > already use vmlinux.h include, so that could be the way forward to fix that
>
> I tried the method you suggested, and some unexpected problems occurred. Maybe,
> we can apply v5 [0] first, and then solve this problem?
how about change below, seem to work for me
jirka
---
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 151ec320818b..3115f054dca7 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -316,6 +316,8 @@ XDP_SAMPLE_CFLAGS += -Wall -O2 \
$(obj)/$(XDP_SAMPLE): TPROGS_CFLAGS = $(XDP_SAMPLE_CFLAGS)
$(obj)/$(XDP_SAMPLE): $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h
+$(obj)/$(TRACE_HELPERS): TPROGS_CFLAGS := $(TPROGS_CFLAGS) -D__must_check=
+
-include $(BPF_SAMPLES_PATH)/Makefile.target
VMLINUX_BTF_PATHS ?= $(abspath $(if $(O),$(O)/vmlinux)) \
diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
index 316a7874a12b..551547ba6829 100644
--- a/tools/testing/selftests/bpf/trace_helpers.c
+++ b/tools/testing/selftests/bpf/trace_helpers.c
@@ -14,9 +14,6 @@
#include <linux/limits.h>
#include <libelf.h>
#include <gelf.h>
-#ifndef __must_check
-#define __must_check
-#endif
#include "bpf/libbpf_internal.h"
#define TRACEFS_PIPE "/sys/kernel/tracing/trace_pipe"
next prev parent reply other threads:[~2023-08-25 9:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-21 6:45 [PATCH bpf-next v6] selftests/bpf: trace_helpers.c: optimize kallsyms cache Rong Tao
2023-08-21 8:39 ` Jiri Olsa
2023-08-22 0:38 ` Rong Tao
2023-08-25 9:08 ` Jiri Olsa [this message]
2023-08-25 10:40 ` Rong Tao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZOhvhnUTxtD6YYzl@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=rongtao@cestc.cn \
--cc=rtoax@foxmail.com \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.