public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Rong Tao <rtoax@foxmail.com>, olsajiri@gmail.com
Cc: 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
Subject: Re: [PATCH bpf-next v5] selftests/bpf: trace_helpers.c: optimize kallsyms cache
Date: Fri, 18 Aug 2023 10:50:30 -0700	[thread overview]
Message-ID: <817af9ec-0ba3-fab0-6d8a-4529ede337b5@linux.dev> (raw)
In-Reply-To: <tencent_6F0CBE858CB29E2E63544C5FF7461710E909@qq.com>



On 8/18/23 8:36 AM, Rong Tao wrote:
> Hi, jirka
> 
> Sadly, we can't include libbpf_internal.h in trace_helpers.{h,c}.
> we only have the following headers when compile samples/bpf/:
> 
> tree of samples/bpf/libbpf/
>      +-- bpf_helper_defs.h
>      +-- include
>      |   '-- bpf
>      |       +-- bpf_core_read.h
>      |       +-- bpf_endian.h
>      |       +-- bpf.h
>      |       +-- bpf_helper_defs.h
>      |       +-- bpf_helpers.h
>      |       +-- bpf_tracing.h
>      |       +-- btf.h
>      |       +-- libbpf_common.h
>      |       +-- libbpf.h
>      |       +-- libbpf_legacy.h
>      |       +-- libbpf_version.h
>      |       +-- skel_internal.h
>      |       '-- usdt.bpf.h
>      +-- libbpf.a
> 
> No libbpf_internal.h here.
> 
> What if we add a declaration to libbpf_ensure_mem() in trace_helpers.c?

[~/work/bpf-next/tools/testing/selftests/bpf/prog_tests (master)]$ grep 
libbpf_internal.h *
cpu_mask.c:#include "bpf/libbpf_internal.h"
kprobe_multi_test.c:#include "bpf/libbpf_internal.h"
kprobe_multi_testmod_test.c:#include "bpf/libbpf_internal.h"
module_fentry_shadow.c:#include "bpf/libbpf_internal.h"
perf_branches.c:#include "bpf/libbpf_internal.h"
perf_buffer.c:#include "bpf/libbpf_internal.h"
raw_tp_test_run.c:#include "bpf/libbpf_internal.h"
[~/work/bpf-next/tools/testing/selftests/bpf/prog_tests (master)]$ grep 
libbpf_ensure_mem *.c
kprobe_multi_test.c:            err = libbpf_ensure_mem((void **) &syms, 
&cap,
[~/work/bpf-next/tools/testing/selftests/bpf/prog_tests (master)]$

Looks like it is already used for selftets.

The libbpf_internal.h exists in the following directory when you build
the selftest.

[~/work/bpf-next/tools/testing/selftests/bpf/tools/include/bpf (master)]$ ls
bpf_core_read.h  bpf.h              bpf_helpers.h  btf.h 
libbpf_common.h  libbpf_internal.h  libbpf_version.h  relo_core.h 
usdt.bpf.h
bpf_endian.h     bpf_helper_defs.h  bpf_tracing.h  hashmap.h  libbpf.h 
       libbpf_legacy.h    nlattr.h          skel_internal.h


> 
> Good Day,
> Rong Tao
> 
> 

  reply	other threads:[~2023-08-18 17:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17  5:03 [PATCH bpf-next v5] selftests/bpf: trace_helpers.c: optimize kallsyms cache Rong Tao
2023-08-17  8:21 ` Jiri Olsa
2023-08-18  1:39   ` Rong Tao
2023-08-18 12:20     ` Jiri Olsa
2023-08-18 15:36       ` Rong Tao
2023-08-18 17:50         ` Yonghong Song [this message]
2023-08-21  2:03           ` Rong Tao
2023-08-21  4:34             ` Yonghong Song
2023-08-21  6:49               ` 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=817af9ec-0ba3-fab0-6d8a-4529ede337b5@linux.dev \
    --to=yonghong.song@linux.dev \
    --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=olsajiri@gmail.com \
    --cc=rongtao@cestc.cn \
    --cc=rtoax@foxmail.com \
    --cc=sdf@google.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox