From: Martin KaFai Lau <martin.lau@linux.dev>
To: Kui-Feng Lee <sinquersw@gmail.com>, thinker.li@gmail.com
Cc: kuifeng@meta.com, bpf@vger.kernel.org, ast@kernel.org,
song@kernel.org, kernel-team@meta.com, andrii@kernel.org
Subject: Re: [PATCH bpf-next v2 2/3] bpf: struct_ops supports more than one page for trampolines.
Date: Fri, 23 Feb 2024 10:42:51 -0800 [thread overview]
Message-ID: <ded8001c-2437-48f4-88ff-4c0633f1da7c@linux.dev> (raw)
In-Reply-To: <c938c3b1-8cce-4563-930d-7e8150365117@gmail.com>
On 2/23/24 10:29 AM, Kui-Feng Lee wrote:
> One thing I forgot to mention is that bpf_dummy_ops has to call
> bpf_jit_uncharge_modmem(PAGE_SIZE) as well. The other option is to move
> bpf_jit_charge_modmem() out of bpf_struct_ops_prepare_trampoline(),
> meaning bpf_struct_ops_map_update_elem() should handle the case that the
> allocation in bpf_struct_ops_prepare_trampoline() successes, but
> bpf_jit_charge_modmem() fails.
Keep the charge/uncharge in bpf_struct_ops_prepare_trampoline().
It is fine to have bpf_dummy_ops charge and then uncharge a PAGE_SIZE. There is
no need to optimize for bpf_dummy_ops. Use bpf_struct_ops_free_trampoline() in
bpf_dummy_ops to uncharge and free.
>>> void bpf_struct_ops_free_trampoline(void *image)
>>> {
>>> bpf_jit_uncharge_modmem(PAGE_SIZE);
>>> arch_free_bpf_trampoline(image, PAGE_SIZE);
>>> }
>>>
next prev parent reply other threads:[~2024-02-23 18:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 22:59 [PATCH bpf-next v2 0/3] Allow struct_ops maps with a large number of programs thinker.li
2024-02-21 22:59 ` [PATCH bpf-next v2 1/3] bpf, net: validate struct_ops when updating value thinker.li
2024-02-21 22:59 ` [PATCH bpf-next v2 2/3] bpf: struct_ops supports more than one page for trampolines thinker.li
2024-02-23 0:33 ` Martin KaFai Lau
2024-02-23 1:35 ` Kui-Feng Lee
2024-02-23 2:16 ` Martin KaFai Lau
2024-02-23 3:01 ` Kui-Feng Lee
2024-02-23 5:25 ` Martin KaFai Lau
2024-02-23 17:36 ` Kui-Feng Lee
2024-02-23 18:29 ` Kui-Feng Lee
2024-02-23 18:42 ` Martin KaFai Lau [this message]
2024-02-23 19:05 ` Kui-Feng Lee
2024-02-23 19:15 ` Martin KaFai Lau
2024-02-23 22:06 ` Kui-Feng Lee
2024-02-24 3:20 ` Martin KaFai Lau
2024-02-23 18:32 ` Martin KaFai Lau
2024-02-21 22:59 ` [PATCH bpf-next v2 3/3] selftests/bpf: Test struct_ops maps with a large number of program links thinker.li
2024-02-21 23:02 ` [PATCH bpf-next v2 0/3] Allow struct_ops maps with a large number of programs Kui-Feng Lee
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=ded8001c-2437-48f4-88ff-4c0633f1da7c@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kernel-team@meta.com \
--cc=kuifeng@meta.com \
--cc=sinquersw@gmail.com \
--cc=song@kernel.org \
--cc=thinker.li@gmail.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