netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Andrii Nakryiko <andriin@fb.com>, bpf <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v2 bpf-next 2/7] selftests/bpf: samples/bpf: split off legacy stuff from bpf_helpers.h
Date: Thu, 03 Oct 2019 18:27:00 +0200	[thread overview]
Message-ID: <87k19lpzfv.fsf@toke.dk> (raw)
In-Reply-To: <CAEf4Bzb7ikPkrxCVMtHK5rS2kdoF_mo5_Bn5U78zKBiYYHS8ig@mail.gmail.com>

Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:

> On Thu, Oct 3, 2019 at 12:35 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>>
>> Andrii Nakryiko <andriin@fb.com> writes:
>>
>> > diff --git a/samples/bpf/map_perf_test_kern.c b/samples/bpf/map_perf_test_kern.c
>> > index 2b2ffb97018b..f47ee513cb7c 100644
>> > --- a/samples/bpf/map_perf_test_kern.c
>> > +++ b/samples/bpf/map_perf_test_kern.c
>> > @@ -9,25 +9,26 @@
>> >  #include <linux/version.h>
>> >  #include <uapi/linux/bpf.h>
>> >  #include "bpf_helpers.h"
>> > +#include "bpf_legacy.h"
>> >
>> >  #define MAX_ENTRIES 1000
>> >  #define MAX_NR_CPUS 1024
>> >
>> > -struct bpf_map_def SEC("maps") hash_map = {
>> > +struct bpf_map_def_legacy SEC("maps") hash_map = {
>> >       .type = BPF_MAP_TYPE_HASH,
>> >       .key_size = sizeof(u32),
>> >       .value_size = sizeof(long),
>> >       .max_entries = MAX_ENTRIES,
>> >  };
>>
>> Why switch these when they're not actually using any of the extra fields
>> in map_def_legacy?
>
> See below, they have to be uniform-sized.
>
>> >
>> > -struct bpf_map_def SEC("maps") lru_hash_map = {
>> > +struct bpf_map_def_legacy SEC("maps") lru_hash_map = {
>> >       .type = BPF_MAP_TYPE_LRU_HASH,
>> >       .key_size = sizeof(u32),
>> >       .value_size = sizeof(long),
>> >       .max_entries = 10000,
>> >  };
>> >
>> > -struct bpf_map_def SEC("maps") nocommon_lru_hash_map = {
>> > +struct bpf_map_def_legacy SEC("maps") nocommon_lru_hash_map = {
>> >       .type = BPF_MAP_TYPE_LRU_HASH,
>> >       .key_size = sizeof(u32),
>> >       .value_size = sizeof(long),
>> > @@ -35,7 +36,7 @@ struct bpf_map_def SEC("maps") nocommon_lru_hash_map = {
>> >       .map_flags = BPF_F_NO_COMMON_LRU,
>> >  };
>> >
>> > -struct bpf_map_def SEC("maps") inner_lru_hash_map = {
>> > +struct bpf_map_def_legacy SEC("maps") inner_lru_hash_map = {
>> >       .type = BPF_MAP_TYPE_LRU_HASH,
>> >       .key_size = sizeof(u32),
>> >       .value_size = sizeof(long),
>> > @@ -44,20 +45,20 @@ struct bpf_map_def SEC("maps") inner_lru_hash_map = {
>> >       .numa_node = 0,
>> >  };
>>
>> Or are you just switching everything because of this one?
>
> Exactly. Another way would be to switch all but this to BTF-based one,
> but I didn't want to make this patch set even bigger, we can always do
> that later

Right, fair enough :)

-Toke


  reply	other threads:[~2019-10-03 17:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 21:50 [PATCH v2 bpf-next 0/7] Move bpf_helpers and add BPF_CORE_READ macros Andrii Nakryiko
2019-10-02 21:50 ` [PATCH v2 bpf-next 1/7] selftests/bpf: undo GCC-specific bpf_helpers.h changes Andrii Nakryiko
2019-10-02 21:50 ` [PATCH v2 bpf-next 2/7] selftests/bpf: samples/bpf: split off legacy stuff from bpf_helpers.h Andrii Nakryiko
2019-10-03  7:35   ` Toke Høiland-Jørgensen
2019-10-03 16:20     ` Andrii Nakryiko
2019-10-03 16:27       ` Toke Høiland-Jørgensen [this message]
2019-10-03 17:31   ` John Fastabend
2019-10-03 20:08   ` Song Liu
2019-10-03 21:22     ` Andrii Nakryiko
2019-10-02 21:50 ` [PATCH v2 bpf-next 3/7] selftests/bpf: adjust CO-RE reloc tests for new bpf_core_read() macro Andrii Nakryiko
2019-10-03 20:16   ` Song Liu
2019-10-03 20:28     ` Andrii Nakryiko
2019-10-03 20:41       ` Song Liu
2019-10-03 21:10         ` Andrii Nakryiko
2019-10-02 21:50 ` [PATCH v2 bpf-next 4/7] selftests/bpf: split off tracing-only helpers into bpf_tracing.h Andrii Nakryiko
2019-10-03  7:35   ` Toke Høiland-Jørgensen
2019-10-03 16:22     ` Andrii Nakryiko
2019-10-03 17:21       ` Toke Høiland-Jørgensen
2019-10-03 17:33   ` John Fastabend
2019-10-03 20:18     ` Song Liu
2019-10-02 21:50 ` [PATCH v2 bpf-next 5/7] libbpf: move bpf_{helpers,endian,tracing}.h into libbpf Andrii Nakryiko
2019-10-03 20:22   ` Song Liu
2019-10-02 21:50 ` [PATCH v2 bpf-next 6/7] libbpf: add BPF_CORE_READ/BPF_CORE_READ_INTO helpers Andrii Nakryiko
2019-10-03 20:35   ` Song Liu
2019-10-03 21:25     ` Andrii Nakryiko
2019-10-02 21:50 ` [PATCH v2 bpf-next 7/7] selftests/bpf: add BPF_CORE_READ and BPF_CORE_READ_STR_INTO macro tests 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=87k19lpzfv.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --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).