[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <C0LP269G4WO4.1Q4M8CK4K92SU@dlxu-fedora-R90QNFJV>
Date: Thu, 13 Feb 2020 23:05:03 -0800
From: "Daniel Xu" <dxu@...uu.xyz>
To: "Andrii Nakryiko" <andrii.nakryiko@...il.com>
Cc: "bpf" <bpf@...r.kernel.org>, "Alexei Starovoitov" <ast@...nel.org>,
"Daniel Borkmann" <daniel@...earbox.net>,
"Song Liu" <songliubraving@...com>, "Yonghong Song" <yhs@...com>,
"Andrii Nakryiko" <andriin@...com>,
"open list" <linux-kernel@...r.kernel.org>,
"Kernel Team" <kernel-team@...com>,
"Peter Ziljstra" <peterz@...radead.org>,
"Ingo Molnar" <mingo@...hat.com>,
"Arnaldo Carvalho de Melo" <acme@...nel.org>
Subject: Re: [PATCH v7 bpf-next RESEND 2/2] selftests/bpf: add
bpf_read_branch_records() selftest
On Tue Feb 11, 2020 at 11:30 AM, Andrii Nakryiko wrote:
> On Mon, Feb 10, 2020 at 12:09 PM Daniel Xu <dxu@...uu.xyz> wrote:
[...]
>
> > + /* generate some branches on cpu 0 */
> > + CPU_ZERO(&cpu_set);
> > + CPU_SET(0, &cpu_set);
> > + err = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set), &cpu_set);
> > + if (CHECK(err, "set_affinity", "cpu #0, err %d\n", err))
> > + goto out_free_pb;
> > + /* spin the loop for a while (random high number) */
> > + for (i = 0; i < 1000000; ++i)
> > + ++j;
> > +
>
>
> test_perf_branches__detach here?
Yeah, good idea.
[...]
> > +struct fake_perf_branch_entry {
> > + __u64 _a;
> > + __u64 _b;
> > + __u64 _c;
> > +};
> > +
> > +struct output {
> > + int required_size;
> > + int written_stack;
> > + int written_map;
> > +};
> > +
> > +struct {
> > + __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
> > + __uint(key_size, sizeof(int));
> > + __uint(value_size, sizeof(int));
> > +} perf_buf_map SEC(".maps");
> > +
> > +typedef struct fake_perf_branch_entry fpbe_t[30];
> > +
> > +struct {
> > + __uint(type, BPF_MAP_TYPE_ARRAY);
> > + __uint(max_entries, 1);
> > + __type(key, __u32);
> > + __type(value, fpbe_t);
> > +} scratch_map SEC(".maps");
>
>
> Can you please use global variables instead of array
If you mean `scratch_map`, sure.
> and perf_event_array?
Do you mean replace the perf ring buffer with global variables? I think
that would limit the number of samples we validate in userspace to a fixed
number. It might be better to validate as many as the system gives us.
Let me know what you think. I might be overthinking it.
> Would make BPF side clearer and userspace simpler.
> struct output member will just become variables.
Thanks,
Daniel
Powered by blists - more mailing lists