From: Song Liu <songliubraving@fb.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
Peter Ziljstra <peterz@infradead.org>,
"Alexei Starovoitov" <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
"Kernel Team" <Kernel-team@fb.com>,
john fastabend <john.fastabend@gmail.com>,
"KP Singh" <kpsingh@chromium.org>
Subject: Re: [PATCH v2 bpf-next 4/4] selftests/bpf: add bpf_iter test with bpf_get_task_stack()
Date: Fri, 26 Jun 2020 23:05:28 +0000 [thread overview]
Message-ID: <6B6E4195-BC5C-4A13-80A6-9493469D6A2E@fb.com> (raw)
In-Reply-To: <CAEf4Bzb6H3a48S3L4WZtPTMSLZpAe4C5_2aFwJAnNDVLVWDTQA@mail.gmail.com>
> On Jun 26, 2020, at 1:21 PM, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
>
> On Thu, Jun 25, 2020 at 5:15 PM Song Liu <songliubraving@fb.com> wrote:
>>
>> The new test is similar to other bpf_iter tests.
>>
>> Signed-off-by: Song Liu <songliubraving@fb.com>
>> ---
>> .../selftests/bpf/prog_tests/bpf_iter.c | 17 ++++++
>> .../selftests/bpf/progs/bpf_iter_task_stack.c | 60 +++++++++++++++++++
>> 2 files changed, 77 insertions(+)
>> create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c
>>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
>> index 87c29dde1cf96..baa83328f810d 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
>> @@ -5,6 +5,7 @@
>> #include "bpf_iter_netlink.skel.h"
>> #include "bpf_iter_bpf_map.skel.h"
>> #include "bpf_iter_task.skel.h"
>> +#include "bpf_iter_task_stack.skel.h"
>> #include "bpf_iter_task_file.skel.h"
>> #include "bpf_iter_test_kern1.skel.h"
>> #include "bpf_iter_test_kern2.skel.h"
>> @@ -106,6 +107,20 @@ static void test_task(void)
>> bpf_iter_task__destroy(skel);
>> }
>>
>> +static void test_task_stack(void)
>> +{
>> + struct bpf_iter_task_stack *skel;
>> +
>> + skel = bpf_iter_task_stack__open_and_load();
>> + if (CHECK(!skel, "bpf_iter_task_stack__open_and_load",
>> + "skeleton open_and_load failed\n"))
>> + return;
>> +
>> + do_dummy_read(skel->progs.dump_task_stack);
>> +
>> + bpf_iter_task_stack__destroy(skel);
>> +}
>> +
>> static void test_task_file(void)
>> {
>> struct bpf_iter_task_file *skel;
>> @@ -392,6 +407,8 @@ void test_bpf_iter(void)
>> test_bpf_map();
>> if (test__start_subtest("task"))
>> test_task();
>> + if (test__start_subtest("task_stack"))
>> + test_task_stack();
>> if (test__start_subtest("task_file"))
>> test_task_file();
>> if (test__start_subtest("anon"))
>> diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c b/tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c
>> new file mode 100644
>> index 0000000000000..83aca5b1a7965
>> --- /dev/null
>> +++ b/tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c
>> @@ -0,0 +1,60 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/* Copyright (c) 2020 Facebook */
>> +/* "undefine" structs in vmlinux.h, because we "override" them below */
>> +#define bpf_iter_meta bpf_iter_meta___not_used
>> +#define bpf_iter__task bpf_iter__task___not_used
>> +#include "vmlinux.h"
>> +#undef bpf_iter_meta
>> +#undef bpf_iter__task
>> +#include <bpf/bpf_helpers.h>
>> +#include <bpf/bpf_tracing.h>
>> +
>> +char _license[] SEC("license") = "GPL";
>> +
>> +/* bpf_get_task_stack needs a stackmap to work */
>
> no it doesn't anymore :) please drop
We still need stack_map_alloc() to call get_callchain_buffers() in this
case. Without an active stack map, get_callchain_buffers() may fail.
Thanks,
Song
next prev parent reply other threads:[~2020-06-26 23:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-26 0:13 [PATCH v2 bpf-next 0/4] bpf: introduce bpf_get_task_stack() Song Liu
2020-06-26 0:13 ` [PATCH v2 bpf-next 1/4] perf: export get/put_chain_entry() Song Liu
2020-06-26 11:00 ` Peter Zijlstra
2020-06-26 20:06 ` Andrii Nakryiko
2020-06-26 21:38 ` Song Liu
2020-06-26 21:29 ` Song Liu
2020-06-26 0:13 ` [PATCH v2 bpf-next 2/4] bpf: introduce helper bpf_get_task_stak() Song Liu
2020-06-26 15:40 ` Yonghong Song
2020-06-26 22:37 ` Song Liu
2020-06-26 20:17 ` Andrii Nakryiko
2020-06-26 20:22 ` Andrii Nakryiko
2020-06-26 22:45 ` Song Liu
2020-06-26 22:51 ` Andrii Nakryiko
2020-06-26 23:47 ` Song Liu
2020-06-27 0:06 ` Andrii Nakryiko
2020-06-26 0:13 ` [PATCH v2 bpf-next 3/4] bpf: allow %pB in bpf_seq_printf() and bpf_trace_printk() Song Liu
2020-06-26 15:44 ` [Potential Spoof] " Yonghong Song
2020-06-26 0:13 ` [PATCH v2 bpf-next 4/4] selftests/bpf: add bpf_iter test with bpf_get_task_stack() Song Liu
2020-06-26 15:52 ` Yonghong Song
2020-06-26 20:21 ` Andrii Nakryiko
2020-06-26 23:05 ` Song Liu [this message]
2020-06-26 23:11 ` Andrii Nakryiko
2020-06-26 23:40 ` Song Liu
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=6B6E4195-BC5C-4A13-80A6-9493469D6A2E@fb.com \
--to=songliubraving@fb.com \
--cc=Kernel-team@fb.com \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.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).