bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hou Tao <houtao@huaweicloud.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Hao Luo <haoluo@google.com>,
	Yonghong Song <yonghong.song@linux.dev>,
	Daniel Borkmann <daniel@iogearbox.net>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Jiri Olsa <jolsa@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Hou Tao <houtao1@huawei.com>, Xu Kuohai <xukuohai@huawei.com>
Subject: Re: [PATCH bpf-next v2 02/20] bpf: Parse bpf_dynptr in map key
Date: Fri, 14 Feb 2025 12:04:38 +0800	[thread overview]
Message-ID: <25e0116d-a0d5-00f0-ea3a-1269a8601bdc@huaweicloud.com> (raw)
In-Reply-To: <CAADnVQLOfWZ_5U9ZN4QaQQR1-OHdgDT3GJ1bP-QNPNRZNHbn+A@mail.gmail.com>

Hi,

On 2/14/2025 1:59 AM, Alexei Starovoitov wrote:
> On Sat, Jan 25, 2025 at 2:59 AM Hou Tao <houtao@huaweicloud.com> wrote:
>> From: Hou Tao <houtao1@huawei.com>
>>
>> To support variable-length key or strings in map key, use bpf_dynptr to
>> represent these variable-length objects and save these bpf_dynptr
>> fields in the map key. As shown in the examples below, a map key with an
>> integer and a string is defined:

SNIP
>> @@ -271,7 +271,14 @@ struct bpf_map {
>>         u64 map_extra; /* any per-map-type extra fields */
>>         u32 map_flags;
>>         u32 id;
>> +       /* BTF record for special fields in map value. bpf_dynptr is disallowed
>> +        * at present.
>> +        */
> Maybe drop 'at present' to fit on one line.
> I would also capitalize Value to make the difference more obvious...

Will do.
>
>>         struct btf_record *record;
>> +       /* BTF record for special fields in map key. Only bpf_dynptr is allowed
>> +        * at present.
> ...with this line. Key.

Will do.
>
>> +

SNIP
>> +       btf_record_free(key_rec);
>>         btf_record_free(rec);
>>         /* Delay freeing of btf for maps, as map_free callback may need
>>          * struct_meta info which will be freed with btf_put().
>> @@ -1180,6 +1188,8 @@ int map_check_no_btf(const struct bpf_map *map,
>>         return -ENOTSUPP;
>>  }
>>
>> +#define MAX_DYNPTR_CNT_IN_MAP_KEY 1
> I remember we discussed to allow 2 dynptr-s in a key.
> And in patch 11 you already do:
> +       record = map->key_record;
> +       for (i = 0; i < record->cnt; i++) {
>
> so the support for multiple dynptr-s is almost there?

I misunderstood the discussion. However, the change is simple. Only need
to change it from 1 to 2 because the following patches has already
supported multiple dynptrs.


  reply	other threads:[~2025-02-14  4:04 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-25 11:10 [PATCH bpf-next v2 00/20] Support dynptr key for hash map Hou Tao
2025-01-25 11:10 ` [PATCH bpf-next v2 01/20] bpf: Add two helpers to facilitate the parsing of bpf_dynptr Hou Tao
2025-02-04 23:17   ` Alexei Starovoitov
2025-02-05  1:33     ` Hou Tao
2025-01-25 11:10 ` [PATCH bpf-next v2 02/20] bpf: Parse bpf_dynptr in map key Hou Tao
2025-02-13 17:59   ` Alexei Starovoitov
2025-02-14  4:04     ` Hou Tao [this message]
2025-01-25 11:10 ` [PATCH bpf-next v2 03/20] bpf: Factor out get_map_btf() helper Hou Tao
2025-01-25 11:10 ` [PATCH bpf-next v2 04/20] bpf: Move the initialization of btf before ->map_alloc_check Hou Tao
2025-01-25 11:10 ` [PATCH bpf-next v2 05/20] bpf: Introduce an internal map flag BPF_INT_F_DYNPTR_IN_KEY Hou Tao
2025-01-25 11:10 ` [PATCH bpf-next v2 06/20] bpf: Set BPF_INT_F_DYNPTR_IN_KEY conditionally Hou Tao
2025-02-13 23:56   ` Alexei Starovoitov
2025-02-14  4:12     ` Hou Tao
2025-02-14  4:17       ` Alexei Starovoitov
2025-02-14  6:49         ` Hou Tao
2025-02-14  7:25           ` Hou Tao
2025-02-14 17:30             ` Alexei Starovoitov
2025-02-27 21:10               ` Alexei Starovoitov
2025-02-28  0:58                 ` Hou Tao
2025-02-28  2:43                   ` Alexei Starovoitov
2025-01-25 11:10 ` [PATCH bpf-next v2 07/20] bpf: Use map_extra to indicate the max data size of dynptrs in map key Hou Tao
2025-02-13 18:02   ` Alexei Starovoitov
2025-02-14  6:13     ` Hou Tao
2025-02-14 15:57       ` Alexei Starovoitov
2025-01-25 11:10 ` [PATCH bpf-next v2 08/20] bpf: Split check_stack_range_initialized() into small functions Hou Tao
2025-01-25 11:10 ` [PATCH bpf-next v2 09/20] bpf: Support map key with dynptr in verifier Hou Tao
2025-01-25 11:10 ` [PATCH bpf-next v2 10/20] bpf: Introduce bpf_dynptr_user Hou Tao
2025-02-14  0:13   ` Alexei Starovoitov
2025-02-14  7:03     ` Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 11/20] bpf: Handle bpf_dynptr_user in bpf syscall when it is used as input Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 12/20] bpf: Handle bpf_dynptr_user in bpf syscall when it is used as output Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 13/20] bpf: Support basic operations for dynptr key in hash map Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 14/20] bpf: Export bpf_dynptr_set_size Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 15/20] bpf: Support get_next_key operation for dynptr key in hash map Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 16/20] bpf: Disable unsupported operations for map with dynptr key Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 17/20] bpf: Enable BPF_INT_F_DYNPTR_IN_KEY for hash map Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 18/20] selftests/bpf: Add bpf_dynptr_user_init() helper Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 19/20] selftests/bpf: Add test cases for hash map with dynptr key Hou Tao
2025-01-25 11:11 ` [PATCH bpf-next v2 20/20] selftests/bpf: Add benchmark for dynptr key support in hash map Hou Tao

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=25e0116d-a0d5-00f0-ea3a-1269a8601bdc@huaweicloud.com \
    --to=houtao@huaweicloud.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=houtao1@huawei.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=xukuohai@huawei.com \
    --cc=yonghong.song@linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).