From: Martin KaFai Lau <martin.lau@linux.dev>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@kernel.org>,
KP Singh <kpsingh@kernel.org>,
bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Use separate RCU callbacks for freeing selem
Date: Fri, 3 Mar 2023 09:55:22 -0800 [thread overview]
Message-ID: <51a62deb-93bd-7f84-c9f7-f2ccffb38567@linux.dev> (raw)
In-Reply-To: <CAP01T77XW-XenFnqz4aruFKzLWVHhyL0vE9cJEK_OuyRVW+Bww@mail.gmail.com>
On 3/3/23 9:45 AM, Kumar Kartikeya Dwivedi wrote:
> On Fri, 3 Mar 2023 at 16:40, Martin KaFai Lau <martin.lau@linux.dev> wrote:
>>
>> On 3/3/23 6:15 AM, Kumar Kartikeya Dwivedi wrote:
>>> Martin suggested that instead of using a byte in the hole (which he has
>>> a use for in his future patch) in bpf_local_storage_elem, we can
>>> dispatch a different call_rcu callback based on whether we need to free
>>> special fields in bpf_local_storage_elem data. The free path, described
>>> in commit 9db44fdd8105 ("bpf: Support kptrs in local storage maps"),
>>> only waits for call_rcu callbacks when there are special (kptrs, etc.)
>>> fields in the map value, hence it is necessary that we only access
>>> smap in this case.
>>>
>>> Therefore, dispatch different RCU callbacks based on the BPF map has a
>>> valid btf_record, which dereference and use smap's btf_record only when
>>> it is valid.
>>>
>>> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
>>
>> Thanks for your patch. I have already made a similar change in my local branch
>> which has some differences like refactored it a little for my work. The set is
>> almost ready. Do you mind if I include your patch in my set and keep your SOB?
>>
>
> No problem, please do.
Please ignore my previous message. I will make some adjustments on my set.
Applied with some changes on de-referencing SDATA(selem)->smap to address these
warnings:
# this is addressed by rcu_dereference_protected(..., true)
../kernel/bpf/bpf_local_storage.c:117:41: warning: dereference of noderef expression
# this is addressed by directly using the earlier dereferenced smap pointer
../kernel/bpf/bpf_local_storage.c:200:27: warning: dereference of noderef expression
prev parent reply other threads:[~2023-03-03 17:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 14:15 [PATCH bpf-next] bpf: Use separate RCU callbacks for freeing selem Kumar Kartikeya Dwivedi
2023-03-03 15:40 ` Martin KaFai Lau
2023-03-03 17:45 ` Kumar Kartikeya Dwivedi
2023-03-03 17:55 ` Martin KaFai Lau [this message]
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=51a62deb-93bd-7f84-c9f7-f2ccffb38567@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kpsingh@kernel.org \
--cc=martin.lau@kernel.org \
--cc=memxor@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.