From: Alan Maguire <alan.maguire@oracle.com>
To: Tao Chen <chen.dylane@linux.dev>,
ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com,
song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org,
sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH bpf-next 0/2] fentry supports function optimized by complier
Date: Wed, 30 Apr 2025 18:58:54 +0100 [thread overview]
Message-ID: <a38362a2-a414-45f7-85d6-4be2df15807c@oracle.com> (raw)
In-Reply-To: <20250430164608.3790552-1-chen.dylane@linux.dev>
On 30/04/2025 17:46, Tao Chen wrote:
> The previous discussion about fentry invalid on function optimeized by complier
> is as follows:
> https://lore.kernel.org/bpf/3c6f539b-b498-4587-b0dc-5fdeba717600@oracle.com/
>
> This seems to be something that pahole needs to resolve. However, Alan
> mentioned that there are many situations involved in this, and he proposed
> that the available_filter_functions_addr can be used to find the address of
> the real function. If we can get the real address from user, maybe this address
> can be used when the function obtained from the BTF is invalid.
>
> The specific selftest has not been added yet. I just wrote a simple test
> program and ran it.
>
> This is the initial RFC patch, feedback is welcome.
>
There's some discussion around this in the context of inlines and
optimized functions at [1] that might be of interest. Ultimately for
more complicated cases like this I'd really like to see us have a
name/address relationship encoded in BTF so that we can be clear about
relationships between a function site and its BTF.
The current state of affairs though is that a function will only make it
into BTF if its function signature is consistent with the prototype, so
unless I'm missing something the approach of passing an address to
clarify the relationship seems like a valid one.
It would be great to have a test, can we try adding a function to
bpf_testmod that a compiler will likely optimize to .isra.0 and trace
it? This won't work in all cases, but we could skip the test if the
function isn't optimized as wanted.
[1]
https://lore.kernel.org/dwarves/20250416-btf_inline-v1-0-e4bd2f8adae5@meta.com/
> Tao Chen (2):
> libbpf: Try get fentry func addr from available_filter_functions_addr
> bpf: Get fentry func addr from user when BTF info invalid
>
> include/linux/bpf.h | 1 +
> include/uapi/linux/bpf.h | 1 +
> kernel/bpf/syscall.c | 1 +
> kernel/bpf/verifier.c | 9 ++++++
> tools/include/uapi/linux/bpf.h | 1 +
> tools/lib/bpf/bpf.c | 1 +
> tools/lib/bpf/bpf.h | 1 +
> tools/lib/bpf/gen_loader.c | 1 +
> tools/lib/bpf/libbpf.c | 53 ++++++++++++++++++++++++++++++++++
> 9 files changed, 69 insertions(+)
>
prev parent reply other threads:[~2025-04-30 17:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 16:46 Tao Chen
2025-04-30 16:46 ` [RFC PATCH bpf-next 1/2] libbpf: Try get fentry func addr from available_filter_functions_addr Tao Chen
2025-04-30 16:46 ` [RFC PATCH bpf-next 2/2] bpf: Get fentry func addr from user when BTF info invalid Tao Chen
2025-04-30 17:57 ` Alan Maguire
2025-04-30 22:23 ` Alexei Starovoitov
2025-05-06 3:17 ` Tao Chen
2025-04-30 17:58 ` Alan Maguire [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=a38362a2-a414-45f7-85d6-4be2df15807c@oracle.com \
--to=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chen.dylane@linux.dev \
--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=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®