bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Alan Maguire <alan.maguire@oracle.com>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Andrea Righi <arighi@nvidia.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	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>, David Vernet <void@manifault.com>,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bpf: Mark kfuncs as __noclone
Date: Wed, 27 Aug 2025 15:28:00 -0700	[thread overview]
Message-ID: <7f29deaa-e426-457f-8e93-1fdaa111d3d0@linux.dev> (raw)
In-Reply-To: <53ab50de-04e0-48b1-af19-f1dbf60b0927@oracle.com>



On 8/27/25 12:52 PM, Alan Maguire wrote:
> On 27/08/2025 20:41, Eduard Zingerman wrote:
>> On Wed, 2025-08-27 at 20:28 +0100, Alan Maguire wrote:
>>
>> [...]
>>
>>> I'm working on a small 2-patch series at the moment to improve this. The
>>> problem is we currently have no way to associate the DWARF with the
>>> relevant ELF function; DWARF representations of functions do not have
>>> "." suffixes either so we are just matching by name prefix when we
>>> collect DWARF info about a particular function.
>> Oh, I see, there is no way to associate DWARF info with either
>> 'bpf_strnchr' or 'bpf_strnchr.constprop.0' w/o checking address.
>> Thank you.
>>
>>> The series I'm working on uses DWARF addresses to improve the DWARF/ELF
>>> association, ensuring that we don't toss functions that look
>>> inconsistent but just have .part or .cold suffixed components that have
>>> non-matching DWARF function signatures. ".constprop" isn't covered yet
>>> however.
>> Is ".constprop" special, or just has to be allowed as one of the prefixes?
>>
> Yonghong can remind me if I've got this wrong, but .constprop is
> somewhat different from .part/.cold in that the latter aren't really on

For symbol with .cold, it is not a function. It is just a jump target
from another function.

For symbol with .part, it is a actual function, but mostly like its
function signature has changed as it is part of the original
function.

For symbol with .constprop, is a clone of another function but
with less parameters, i.e., some parameters become a constant
inside the .constprop.<n> function.

With gcc build, you can see even more complicated suffixes:
   ffffffff81825bf0 t __remove_instance.part.0.constprop.0
   ffffffff81ed07c0 t eventfd_ctx_fileget.part.0.isra.0
   ...

> function boundaries. Sometimes we want to retain .constprop
> representations since they are function boundaries and sometimes do not
> mess with parameters in incompatible ways. If we can find a good
> heuristic for tossing them when they are not helpful as in the above
> case that would be great, but I'm not sure how to do that without losing

It is indeed very hard to have a good heuristic for those function
with suffixes. '<func>.constprop.<n>' might be easier as you can
check location in the subprogrm, if there is no location, most
likely that parameter has become a constant inside the function.

Currently I am working on llvm to add
   - function with suffixes
   - function with changed signature and without suffixes.

Such infomation should have better mapping from func to
its type.

> BTF representations which are useful. Any suggestions on that would be
> really great; in the meantime I'll try and get the series dealing with
> .part and .cold functions out ASAP. Thanks!
>
> Alan


  reply	other threads:[~2025-08-27 22:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22 14:05 [PATCH] bpf: Mark kfuncs as __noclone Andrea Righi
2025-08-26 20:17 ` Yonghong Song
2025-08-27  5:02   ` Eduard Zingerman
2025-08-27  5:41     ` Andrea Righi
2025-08-27  6:52       ` Eduard Zingerman
2025-08-27  7:01         ` Eduard Zingerman
2025-08-27  7:45           ` Andrea Righi
2025-08-27 17:03         ` Yonghong Song
2025-08-27 17:00     ` Yonghong Song
2025-08-27 19:13       ` Eduard Zingerman
2025-08-27 19:28         ` Alan Maguire
2025-08-27 19:41           ` Eduard Zingerman
2025-08-27 19:52             ` Alan Maguire
2025-08-27 22:28               ` Yonghong Song [this message]
2025-08-27 22:10         ` Yonghong Song
2025-08-27  2:10 ` David Vernet

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=7f29deaa-e426-457f-8e93-1fdaa111d3d0@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=arighi@nvidia.com \
    --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=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=void@manifault.com \
    /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).