bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Martin KaFai Lau <kafai@fb.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>,
	Networking <netdev@vger.kernel.org>
Subject: Re: [PATCH bpf-next 0/3] bpf: Allow inner map with different max_entries
Date: Thu, 21 May 2020 15:39:10 -0700	[thread overview]
Message-ID: <CAEf4BzYQmUCbQ-PB2UR5n=WEiCHU3T3zQcQCnjvqCew6rmjGLg@mail.gmail.com> (raw)
In-Reply-To: <20200521191752.3448223-1-kafai@fb.com>

On Thu, May 21, 2020 at 12:18 PM Martin KaFai Lau <kafai@fb.com> wrote:
>
> This series allows the outer map to be updated with inner map in different
> size as long as it is safe (meaning the max_entries is not used in the
> verification time during prog load).
>
> Please see individual patch for details.
>

Few thoughts:

1. You describe WHAT, but not necessarily WHY. Can you please
elaborate in descriptions what motivates these changes?
2. IMO, "capabilities" is word that way too strongly correlates with
Linux capabilities framework, it's just confusing. It's also more of a
property of a map type, than what map is capable of, but it's more
philosophical distinction, of course :)
3. I'm honestly not convinced that patch #1 qualifies as a clean up. I
think one specific check for types of maps that are not compatible
with map-in-map is just fine. Instead you are spreading this bit flags
into a long list of maps, most of which ARE compatible. It's just hard
to even see which ones are not compatible. I like current way better.
4. Then for size check change, again, it's really much simpler and
cleaner just to have a special case in check in bpf_map_meta_equal for
cases where map size matters.
5. I also wonder if for those inner maps for which size doesn't
matter, maybe we should set max_elements to zero when setting
inner_meta to show that size doesn't matter? This is minor, though.


> Martin KaFai Lau (3):
>   bpf: Clean up inner map type check
>   bpf: Relax the max_entries check for inner map
>   bpf: selftests: Add test for different inner map size
>
>  include/linux/bpf.h                           | 18 +++++-
>  include/linux/bpf_types.h                     | 64 +++++++++++--------
>  kernel/bpf/btf.c                              |  2 +-
>  kernel/bpf/map_in_map.c                       | 12 ++--
>  kernel/bpf/syscall.c                          | 19 +++++-
>  kernel/bpf/verifier.c                         |  2 +-
>  .../selftests/bpf/prog_tests/btf_map_in_map.c | 12 ++++
>  .../selftests/bpf/progs/test_btf_map_in_map.c | 31 +++++++++
>  8 files changed, 119 insertions(+), 41 deletions(-)
>
> --
> 2.24.1
>

  parent reply	other threads:[~2020-05-21 22:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 19:17 [PATCH bpf-next 0/3] bpf: Allow inner map with different max_entries Martin KaFai Lau
2020-05-21 19:17 ` [PATCH bpf-next 1/3] bpf: Clean up inner map type check Martin KaFai Lau
2020-05-21 19:18 ` [PATCH bpf-next 2/3] bpf: Relax the max_entries check for inner map Martin KaFai Lau
2020-05-21 19:18 ` [PATCH bpf-next 3/3] bpf: selftests: Add test for different inner map size Martin KaFai Lau
2020-05-21 22:39 ` Andrii Nakryiko [this message]
2020-05-21 22:59   ` [PATCH bpf-next 0/3] bpf: Allow inner map with different max_entries Martin KaFai Lau
2020-05-21 23:10     ` Andrii Nakryiko
2020-05-21 23:16       ` Alexei Starovoitov
2020-05-22  0:06         ` Martin KaFai Lau
2020-05-26 17:47         ` Andrii Nakryiko

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='CAEf4BzYQmUCbQ-PB2UR5n=WEiCHU3T3zQcQCnjvqCew6rmjGLg@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /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).