linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Lin Yikai <yikai.lin@vivo.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Matt Bobrowski <mattbobrowski@google.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Mykola Lysenko <mykolal@fb.com>, Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, opensource.kernel@vivo.com
Subject: Re: [PATCH bpf-next v1 0/3] add bpf_file_d_path helper and selftests
Date: Thu, 18 Jul 2024 10:16:54 -0700	[thread overview]
Message-ID: <9642ad1d-e227-417e-a9ff-b69b2cb2d0d9@linux.dev> (raw)
In-Reply-To: <20240718115153.1967859-1-yikai.lin@vivo.com>

On 7/18/24 4:51 AM, Lin Yikai wrote:
> v1:
>   - patch 2:
>     - [1/2] add bpf_file_d_path helper
>     - [2/2] add selftest to it
> 
> Hi, we are looking to add the "bpf_file_d_path" helper,
> used to retrieve the path from a struct file object.
> 	bpf_file_d_path(void *file, char *dst, u32 size);
> 	
> It's worth noting that the "file" parameter is defined as "void*" type.
> 
> * Our problems *
> Previously, we encountered issues
> on some user-space operating systems(OS):
> 
> 1.Difficulty using vmlinux.h
> (1) The OS lacks support for bpftool.
> We can not use:
> "bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h".
> Bpftool need a separate complex cross-compilation environment to build.
> 
> (2) Many duplicate definitions between OS and vmlinux.h.
> 
> (3) The vmlinux.h size is large (2.8MB on arm64/Android),
> causing increased ebpf prog size and user space consumption.

The compiled bpf prog size is increased by 2.8MB because it included vmlinux.h?

> 
> 2.The "struct file" has many internal variables and definitions,
> and maybe change along with Linux version iterations,
> making it hard to copy it to OS.

If vmlinux.h is not convenience in your use case, you can try to define "struct 
file" with __attribute__((preserve_access_index)) and the libbpf will adjust the 
bpf prog against the running kernel.

There was a discussion a year ago about bpf helpers freeze. No new helper can be 
added since then. The same goes for this one.

pw-bot: cr

      parent reply	other threads:[~2024-07-18 17:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 11:51 [PATCH bpf-next v1 0/3] add bpf_file_d_path helper and selftests Lin Yikai
2024-07-18 11:51 ` [PATCH bpf-next v1 1/3] bpf: Add bpf_file_d_path helper Lin Yikai
2024-07-19 18:55   ` Andrii Nakryiko
2024-07-18 11:51 ` [PATCH bpf-next v1 2/3] selftests/bpf:Adding test for " Lin Yikai
2024-07-18 17:16 ` Martin KaFai Lau [this message]

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=9642ad1d-e227-417e-a9ff-b69b2cb2d0d9@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mattbobrowski@google.com \
    --cc=mhiramat@kernel.org \
    --cc=mykolal@fb.com \
    --cc=opensource.kernel@vivo.com \
    --cc=rostedt@goodmis.org \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yikai.lin@vivo.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).