From: Yonghong Song <yonghong.song@linux.dev>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
martin.lau@kernel.org, kernel-team@meta.com
Subject: Re: [PATCH bpf-next 5/5] selftests/bpf: fix bench runner SIGSEGV
Date: Wed, 31 Jan 2024 09:25:02 -0800 [thread overview]
Message-ID: <72a8447c-1bc8-4808-ac96-8523c2c5e66c@linux.dev> (raw)
In-Reply-To: <CAEf4BzbdNxWBijaJgmEEjEYjv4aSdH_Sw7AHOm3FiTNDRdnUEg@mail.gmail.com>
On 1/31/24 9:17 AM, Andrii Nakryiko wrote:
> On Tue, Jan 30, 2024 at 11:41 PM Yonghong Song <yonghong.song@linux.dev> wrote:
>>
>> On 1/30/24 11:36 AM, Andrii Nakryiko wrote:
>>> Some benchmarks don't anticipate "consumer" and/or "producer" sides. Add
>> For this, you mean some future potential benchmarks, right?
> No, existing ones as well. Like trig-tp and other "trigger"
> benchmarks. I ran into this when I was trying to set consumers to 0
> explicitly, which wasn't allowed due to <= check. Then I fixed the
> check, and I ran into SIGSEGV. So I decided to fix that up.
Some description like this in the commit message will be good.
>
>>> NULL checks in corresponding places and warn about inappropriate
>>> consumer/producer count argument values.
>>>
>>> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
>> Acked-by: Yonghong Song <yonghong.song@linux.dev>
>>
>>> ---
>>> tools/testing/selftests/bpf/bench.c | 10 +++++++++-
>>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/bpf/bench.c b/tools/testing/selftests/bpf/bench.c
>>> index 73ce11b0547d..36962fc305eb 100644
>>> --- a/tools/testing/selftests/bpf/bench.c
>>> +++ b/tools/testing/selftests/bpf/bench.c
>>> @@ -330,7 +330,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
>>> break;
>>> case 'c':
>>> env.consumer_cnt = strtol(arg, NULL, 10);
>>> - if (env.consumer_cnt <= 0) {
>>> + if (env.consumer_cnt < 0) {
>>> fprintf(stderr, "Invalid consumer count: %s\n", arg);
>>> argp_usage(state);
>>> }
>>> @@ -607,6 +607,10 @@ static void setup_benchmark(void)
>>> bench->setup();
>>>
>>> for (i = 0; i < env.consumer_cnt; i++) {
>>> + if (!bench->consumer_thread) {
>>> + fprintf(stderr, "benchmark doesn't have consumers!\n");
>>> + exit(1);
>>> + }
>>> err = pthread_create(&state.consumers[i], NULL,
>>> bench->consumer_thread, (void *)(long)i);
>>> if (err) {
>>> @@ -626,6 +630,10 @@ static void setup_benchmark(void)
>>> env.prod_cpus.next_cpu = env.cons_cpus.next_cpu;
>>>
>>> for (i = 0; i < env.producer_cnt; i++) {
>>> + if (!bench->producer_thread) {
>>> + fprintf(stderr, "benchmark doesn't have producers!\n");
>>> + exit(1);
>>> + }
>>> err = pthread_create(&state.producers[i], NULL,
>>> bench->producer_thread, (void *)(long)i);
>>> if (err) {
prev parent reply other threads:[~2024-01-31 17:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 19:36 [PATCH bpf-next 0/5] Libbpf API and memfd_create() fixes Andrii Nakryiko
2024-01-30 19:36 ` [PATCH bpf-next 1/5] libbpf: call memfd_create() syscall directly Andrii Nakryiko
2024-01-31 5:04 ` Yonghong Song
2024-01-30 19:36 ` [PATCH bpf-next 2/5] libbpf: add missing LIBBPF_API annotation to libbpf_set_memlock_rlim API Andrii Nakryiko
2024-01-31 5:16 ` Yonghong Song
2024-01-31 17:09 ` Andrii Nakryiko
2024-01-31 17:23 ` Yonghong Song
2024-01-31 17:37 ` Andrii Nakryiko
2024-01-30 19:36 ` [PATCH bpf-next 3/5] libbpf: add btf__new_split() API that was declared but not implemented Andrii Nakryiko
2024-01-31 5:30 ` Yonghong Song
2024-01-31 17:20 ` Andrii Nakryiko
2024-01-31 17:27 ` Yonghong Song
2024-01-30 19:36 ` [PATCH bpf-next 4/5] libbpf: add missed btf_ext__raw_data() API Andrii Nakryiko
2024-01-31 7:39 ` Yonghong Song
2024-01-30 19:36 ` [PATCH bpf-next 5/5] selftests/bpf: fix bench runner SIGSEGV Andrii Nakryiko
2024-01-31 7:41 ` Yonghong Song
2024-01-31 17:17 ` Andrii Nakryiko
2024-01-31 17:25 ` Yonghong Song [this message]
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=72a8447c-1bc8-4808-ac96-8523c2c5e66c@linux.dev \
--to=yonghong.song@linux.dev \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=martin.lau@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.