[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCbtyzGX-5UPjiaL@krava>
Date: Fri, 16 May 2025 09:48:27 +0200
From: Jiri Olsa <olsajiri@...il.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Oleg Nesterov <oleg@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
x86@...nel.org, Song Liu <songliubraving@...com>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
Hao Luo <haoluo@...gle.com>, Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Alan Maguire <alan.maguire@...cle.com>,
David Laight <David.Laight@...lab.com>,
Thomas Weißschuh <thomas@...ch.de>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCHv2 perf/core 15/22] selftests/bpf: Add hit/attach/detach
race optimized uprobe test
On Thu, May 15, 2025 at 10:31:28AM -0700, Andrii Nakryiko wrote:
SNIP
> > +static void test_uprobe_race(void)
> > +{
> > + int err, i, nr_threads;
> > + pthread_t *threads;
> > +
> > + nr_threads = libbpf_num_possible_cpus();
> > + if (!ASSERT_GT(nr_threads, 0, "libbpf_num_possible_cpus"))
> > + return;
> > + nr_threads = max(2, nr_threads);
> > +
> > + threads = malloc(sizeof(*threads) * nr_threads);
>
> leaking this? maybe just use `pthread_t thread[nr_threads];`? or alloca()?
ugh.. will fix
>
> > + if (!ASSERT_OK_PTR(threads, "malloc"))
> > + return;
> > +
> > + for (i = 0; i < nr_threads; i++) {
> > + err = pthread_create(&threads[i], NULL, i % 2 ? worker_trigger : worker_attach,
> > + NULL);
> > + if (!ASSERT_OK(err, "pthread_create"))
> > + goto cleanup;
> > + }
> > +
> > + sleep(4);
>
> 4 seconds... can we make it much shorter and allow to define the
> actual runtime with envvar? So for thorough testing you'll define
> something multi-second, but once things land and settle we can run it
> for 100ms at most and not slow down CI significantly? All these slow
> tests do add up :(
ok, makes sense
thanks,
jirka
Powered by blists - more mailing lists