From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Alan Maguire <alan.maguire@oracle.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
dwarves@vger.kernel.org
Cc: bpf@vger.kernel.org, Andrii Nakryiko <andrii@kernel.org>,
Alexei Starovoitov <ast@kernel.org>, Tejun Heo <tj@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>
Subject: Re: [PATCH dwarves] btf_encoder: Infer arena kfunc arguments from suffixes
Date: Tue, 4 Aug 2026 15:57:28 -0700 [thread overview]
Message-ID: <7c5a6e06-87e3-4025-8243-b8d08d785ce6@linux.dev> (raw)
In-Reply-To: <56590122d4901653aa2827088b9a83447ee745e0.camel@gmail.com>
On 8/4/26 2:51 PM, Eduard Zingerman wrote:
> On Tue, 2026-08-04 at 23:46 +0200, Kumar Kartikeya Dwivedi wrote:
>> On Tue Aug 4, 2026 at 11:34 PM CEST, Eduard Zingerman wrote:
>>> On Tue, 2026-08-04 at 14:19 -0700, Ihor Solodrai wrote:
>>>> On 8/4/26 1:22 PM, Eduard Zingerman wrote:
>>>> [...]
>>>> What am I missing?
>>>
>>> At the moment we have two consumers:
>>> - Planned sched_ext related kfuncs that need kernel space pointers.
>>> - Existing kfuncs with KF_ARENA_ARG:
>>> - bpf_arena_alloc_pages
>>> - bpf_arena_free_pages
>>> - bpf_arena_reserve_pages
>>> They, take a user space address. Looking at the code is appears that
>>> all three can be changed to handle kernel space address.
>>> On the other hand, neither of these *needs* the passed pointer to be
>>> converted to a kernel side arena pointer. So that would be just some
>>> useless work.
>>
>> I don't think it's useless work, they translate manually because the actual page
>> table operations happen using the kernel address anyway. IMO they probably need
>> access to both, and having one gives other, but kaddr is more important for them
>> to actually carry out the page table manipulation.
>
> From what I see these function compute the page number by subtracting
> user vm start from the pointer. So, if switched to a kernel pointer
> that would uaddr -> kaddr -> (kaddr - start) / page_size.
> Compared to current (uaddr - ustart) / page_size.
> But we can live with that.
>
> What's an overall conclusion? A single __arena suffix and modified
> existing consumers? What would be the semantics for __nullable?
Apparently, we also have btf_decl_tag("arg:arena") and a type tag.
So that's three different arena annotations already:
- decl tag for PTR_TO_ARENA for global funcs [1]
- type tags for BPF declarations [2]
- KF_ARENA_* flags to pass through the address_space(1)
and now we are adding __arena suffix for auto-rebasing
It's a mess, gentlemen.
Since the verifier already recognizes the type tags, shouldn't we
be using them?..
[1] https://lore.kernel.org/bpf/20240209040608.98927-11-alexei.starovoitov@gmail.com/
[2] https://lore.kernel.org/bpf/20260602004120.17087-1-emil@etsalapatis.com/
next prev parent reply other threads:[~2026-08-04 22:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 12:55 [PATCH dwarves] btf_encoder: Infer arena kfunc arguments from suffixes Kumar Kartikeya Dwivedi
2026-08-04 18:43 ` Ihor Solodrai
2026-08-04 19:27 ` Kumar Kartikeya Dwivedi
2026-08-04 20:22 ` Eduard Zingerman
2026-08-04 21:19 ` Ihor Solodrai
2026-08-04 21:34 ` Eduard Zingerman
2026-08-04 21:46 ` Kumar Kartikeya Dwivedi
2026-08-04 21:51 ` Eduard Zingerman
2026-08-04 21:57 ` Kumar Kartikeya Dwivedi
2026-08-04 22:57 ` Ihor Solodrai [this message]
2026-08-04 23:17 ` Kumar Kartikeya Dwivedi
2026-08-04 21:55 ` Ihor Solodrai
2026-08-04 22:05 ` Eduard Zingerman
2026-08-04 22:13 ` Ihor Solodrai
2026-08-04 21:36 ` Kumar Kartikeya Dwivedi
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=7c5a6e06-87e3-4025-8243-b8d08d785ce6@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=acme@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=memxor@gmail.com \
--cc=tj@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