Re: [PATCH 3/5] bpf: Let kernel code import pages into an arena
From: Alexei Starovoitov
Date: Wed Dec 02 2026 - 23:25:43 EST
On Wed Dec 2, 2026 at 6:23 PM UTC, Andrea Righi wrote:
> A paravirt transport, such as pvsched, can share guest memory with the
> host without a file: the guest registers ordinary pages with a device,
> and the host driver pins them. Such a driver needs to map the pages into
> an arena, and to revoke them synchronously when the guest detaches or
> the VM goes away, without waiting for BPF programs to free them.
>
> Add a kernel API around the imports of the arena:
>
> int bpf_arena_map_ext_pages(struct bpf_map *map, u64 addr,
> struct page **pages, u32 page_cnt,
> void (*release)(struct page **pages,
> u32 page_cnt, void *priv),
> void *priv);
> int bpf_arena_unmap_ext_pages(struct bpf_map *map, u64 addr,
> void *priv);
>
> The pages are mapped like the ones of a memfd and stay the caller's:
> the arena calls release once it no longer maps them, whether
> bpf_arena_unmap_ext_pages() revoked them, a BPF program freed them or
> the arena was destroyed. bpf_arena_unmap_ext_pages() returns after the
> release, so the caller can free the pages then. BPF accesses to revoked
> pages fault like the ones to free arena pages.
>
> Suggested-by: Vineeth Pillai <vineethrp@xxxxxxxxxx>
> Signed-off-by: Andrea Righi <arighi@xxxxxxxxxx>
Only half of the patches reached bpf list.
In this shape is unreviewable.
pw-bot: cr