public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: "Emil Tsalapatis" <emil@etsalapatis.com>
To: "Mykyta Yatsenko" <mykyta.yatsenko5@gmail.com>,
	<bpf@vger.kernel.org>, <ast@kernel.org>, <andrii@kernel.org>,
	<daniel@iogearbox.net>, <kafai@meta.com>, <kernel-team@meta.com>,
	<eddyz87@gmail.com>, <memxor@gmail.com>,
	<herbert@gondor.apana.org.au>
Cc: "Mykyta Yatsenko" <yatsenko@meta.com>
Subject: Re: [PATCH RFC bpf-next v2 01/18] bpf: Register rhash map
Date: Fri, 10 Apr 2026 18:31:39 -0400	[thread overview]
Message-ID: <DHPTXQZL4ERG.3QCBWTRWKFNN@etsalapatis.com> (raw)
In-Reply-To: <20260408-rhash-v2-1-3b3675da1f6e@meta.com>

On Wed Apr 8, 2026 at 11:10 AM EDT, Mykyta Yatsenko wrote:
> From: Mykyta Yatsenko <yatsenko@meta.com>
>
> Add resizable hash map into enums where it is needed.
>

These changes in isolation are difficult to reason about,
can we roll this into subsequent patches? Right now this
adds a the BPF_MAP_TYPE_RHASH without there being a way
to create one.

> Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
> ---
>  include/uapi/linux/bpf.h       | 1 +
>  kernel/bpf/map_iter.c          | 3 ++-
>  kernel/bpf/syscall.c           | 3 +++
>  kernel/bpf/verifier.c          | 1 +
>  tools/include/uapi/linux/bpf.h | 1 +
>  5 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 552bc5d9afbd..822582c04f22 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -1046,6 +1046,7 @@ enum bpf_map_type {
>  	BPF_MAP_TYPE_CGRP_STORAGE,
>  	BPF_MAP_TYPE_ARENA,
>  	BPF_MAP_TYPE_INSN_ARRAY,
> +	BPF_MAP_TYPE_RHASH,
>  	__MAX_BPF_MAP_TYPE
>  };
>  
> diff --git a/kernel/bpf/map_iter.c b/kernel/bpf/map_iter.c
> index 261a03ea73d3..4a2aafbe28b4 100644
> --- a/kernel/bpf/map_iter.c
> +++ b/kernel/bpf/map_iter.c
> @@ -119,7 +119,8 @@ static int bpf_iter_attach_map(struct bpf_prog *prog,
>  		is_percpu = true;
>  	else if (map->map_type != BPF_MAP_TYPE_HASH &&
>  		 map->map_type != BPF_MAP_TYPE_LRU_HASH &&
> -		 map->map_type != BPF_MAP_TYPE_ARRAY)
> +		 map->map_type != BPF_MAP_TYPE_ARRAY &&
> +		 map->map_type != BPF_MAP_TYPE_RHASH)
>  		goto put_map;
>  
>  	key_acc_size = prog->aux->max_rdonly_access;
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 51ade3cde8bb..0a5ec417638d 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -1287,6 +1287,7 @@ static int map_check_btf(struct bpf_map *map, struct bpf_token *token,
>  			case BPF_SPIN_LOCK:
>  			case BPF_RES_SPIN_LOCK:
>  				if (map->map_type != BPF_MAP_TYPE_HASH &&
> +				    map->map_type != BPF_MAP_TYPE_RHASH &&
>  				    map->map_type != BPF_MAP_TYPE_ARRAY &&
>  				    map->map_type != BPF_MAP_TYPE_CGROUP_STORAGE &&
>  				    map->map_type != BPF_MAP_TYPE_SK_STORAGE &&
> @@ -1464,6 +1465,7 @@ static int map_create(union bpf_attr *attr, bpfptr_t uattr)
>  	case BPF_MAP_TYPE_CGROUP_ARRAY:
>  	case BPF_MAP_TYPE_ARRAY_OF_MAPS:
>  	case BPF_MAP_TYPE_HASH:
> +	case BPF_MAP_TYPE_RHASH:
>  	case BPF_MAP_TYPE_PERCPU_HASH:
>  	case BPF_MAP_TYPE_HASH_OF_MAPS:
>  	case BPF_MAP_TYPE_RINGBUF:
> @@ -2199,6 +2201,7 @@ static int map_lookup_and_delete_elem(union bpf_attr *attr)
>  		   map->map_type == BPF_MAP_TYPE_PERCPU_HASH ||
>  		   map->map_type == BPF_MAP_TYPE_LRU_HASH ||
>  		   map->map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH ||
> +		   map->map_type == BPF_MAP_TYPE_RHASH ||
>  		   map->map_type == BPF_MAP_TYPE_STACK_TRACE) {
>  		if (!bpf_map_is_offloaded(map)) {
>  			bpf_disable_instrumentation();
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 8c1cf2eb6cbb..53523ab953c2 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -21816,6 +21816,7 @@ static int check_map_prog_compatibility(struct bpf_verifier_env *env,
>  	if (prog->sleepable)
>  		switch (map->map_type) {
>  		case BPF_MAP_TYPE_HASH:
> +		case BPF_MAP_TYPE_RHASH:
>  		case BPF_MAP_TYPE_LRU_HASH:
>  		case BPF_MAP_TYPE_ARRAY:
>  		case BPF_MAP_TYPE_PERCPU_HASH:
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index 677be9a47347..9d7df174770a 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -1046,6 +1046,7 @@ enum bpf_map_type {
>  	BPF_MAP_TYPE_CGRP_STORAGE,
>  	BPF_MAP_TYPE_ARENA,
>  	BPF_MAP_TYPE_INSN_ARRAY,
> +	BPF_MAP_TYPE_RHASH,
>  	__MAX_BPF_MAP_TYPE
>  };
>  


  reply	other threads:[~2026-04-10 22:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-08 15:10 [PATCH RFC bpf-next v2 00/18] bpf: Introduce resizable hash map Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 01/18] bpf: Register rhash map Mykyta Yatsenko
2026-04-10 22:31   ` Emil Tsalapatis [this message]
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 02/18] bpf: Add resizable hashtab skeleton Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 03/18] bpf: Implement lookup, delete, update for resizable hashtab Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 04/18] rhashtable: Add rhashtable_walk_enter_from() Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 05/18] bpf: Implement get_next_key and free_internal_structs for resizable hashtab Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 06/18] bpf: Implement bpf_each_rhash_elem() using walk API Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 07/18] bpf: Implement batch ops for resizable hashtab Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 08/18] bpf: Implement iterator APIs " Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 09/18] bpf: Implement alloc and free " Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 10/18] bpf: Allow timers, workqueues and task_work in " Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 11/18] libbpf: Support resizable hashtable Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 12/18] selftests/bpf: Add basic tests for resizable hash map Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 13/18] selftests/bpf: Support resizable hashtab in test_maps Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 14/18] selftests/bpf: Resizable hashtab BPF_F_LOCK tests Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 15/18] selftests/bpf: Add stress tests for resizable hash get_next_key Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 16/18] selftests/bpf: Add BPF iterator tests for resizable hash map Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 17/18] bpftool: Add rhash map documentation Mykyta Yatsenko
2026-04-08 15:10 ` [PATCH RFC bpf-next v2 18/18] selftests/bpf: Add resizable hashmap to benchmarks Mykyta Yatsenko

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=DHPTXQZL4ERG.3QCBWTRWKFNN@etsalapatis.com \
    --to=emil@etsalapatis.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kafai@meta.com \
    --cc=kernel-team@meta.com \
    --cc=memxor@gmail.com \
    --cc=mykyta.yatsenko5@gmail.com \
    --cc=yatsenko@meta.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