Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpf_prog_pack allocator #2373

Closed
wants to merge 8 commits into from
Closed

Conversation

kernel-patches-bot
Copy link

Pull request for series with
subject: bpf_prog_pack allocator
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086

@kernel-patches-bot
Copy link
Author

Master branch: 640a171
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am -3
  stdout: 'Applying: x86/Kconfig: select HAVE_ARCH_HUGE_VMALLOC with HAVE_ARCH_HUGE_VMAP
Applying: bpf: use bytes instead of pages for bpf_jit_[charge|uncharge]_modmem
Applying: bpf: use size instead of pages in bpf_binary_header
Applying: x86/alternative: introduce text_poke_jit
Applying: bpf: introduce bpf_prog_pack allocator
Applying: bpf, x86_64: use bpf_prog_pack allocator
Patch failed at 0006 bpf, x86_64: use bpf_prog_pack allocator
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".'
  stderr: 'error: sha1 information is lacking or useless (arch/x86/net/bpf_jit_comp.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch'

conflict:


@kernel-patches-bot
Copy link
Author

Master branch: 640a171
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: 1372d34
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: 70bc793
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: e59618f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: 44bab87
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: eff14fc
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: e4a3d6a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: c25af83
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: 8134b50
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: 242db6c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: 81b8e12
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: 775a64e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

Nobody and others added 7 commits January 10, 2022 20:43
This enables module_alloc() to allocate huge page for 2MB+ requests.
To check the difference of this change, we need enable config
CONFIG_PTDUMP_DEBUGFS, and call module_alloc(2MB). Before the change,
/sys/kernel/debug/page_tables/kernel shows pte for this map. With the
change, /sys/kernel/debug/page_tables/ show pmd for thie map.

Signed-off-by: Song Liu <songliubraving@fb.com>
This enables sub-page memory charge and allocation.

Signed-off-by: Song Liu <songliubraving@fb.com>
This is necessary to charge sub page memory for the BPF program.

Signed-off-by: Song Liu <songliubraving@fb.com>
With sub page allocation, we cannot simply use bpf_func & PAGE_MASK to
find the bpf_binary_header. Add a pointer to struct bpf_prog to avoid
this logic.

Use this point for x86_64. If the pointer is not set by the jit engine,
fall back to original logic.

Signed-off-by: Song Liu <songliubraving@fb.com>
This will be used by BPF jit compiler to dump JITed binary to a RX huge
page, and thus allow multiple BPF programs sharing the a huge (2MB) page.

Signed-off-by: Song Liu <song@kernel.org>
Most BPF programs are small, but they consume a page each. For systems
with busy traffic and many BPF programs, this could add significant
pressure to instruction TLB.

Introduce bpf_prog_pack allocator to pack multiple BPF programs in a huge
page. The memory is then allocated in 64 byte chunks.

Memory allocated by bpf_prog_pack allocator is RO protected after initial
allocation. To write to it, the user (jit engine) need to use text poke
API.

Signed-off-by: Song Liu <songliubraving@fb.com>
@kernel-patches-bot
Copy link
Author

Master branch: 775a64e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603086
version: 3

Use bpf_prog_pack allocator in x86_64 jit.

The program header from bpf_prog_pack is read only during the jit process.
Therefore, the binary is first written to a temporary buffer, and later
copied to final location with text_poke_jit().

Similarly, jit_fill_hole() is updated to fill the hole with 0xcc using
text_poke_jit().

Signed-off-by: Song Liu <songliubraving@fb.com>
@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=603086 expired. Closing PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants