Message ID | 20220315102948.466436-1-niklas.soderlund@corigine.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 8fa42d78f6354bb96ad3a079dcbef528ca9fa9e0 |
Delegated to: | BPF |
Headers | show |
Series | [bpf-next] samples/bpf: xdpsock: Fix race when running for fix duration of time | expand |
Hello: This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <daniel@iogearbox.net>: On Tue, 15 Mar 2022 11:29:48 +0100 you wrote: > When running xdpsock for a fix duration of time before terminating > using --duration=<n>, there is a race condition that may cause xdpsock > to terminate immediately. > > When running for a fixed duration of time the check to determine when to > terminate execution is in is_benchmark_done() and is being executed in > the context of the poller thread, > > [...] Here is the summary with links: - [bpf-next] samples/bpf: xdpsock: Fix race when running for fix duration of time https://git.kernel.org/bpf/bpf-next/c/8fa42d78f635 You are awesome, thank you!
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c index 19288a2bbc756d3f..6f3fe30ad283cf0a 100644 --- a/samples/bpf/xdpsock_user.c +++ b/samples/bpf/xdpsock_user.c @@ -1984,15 +1984,15 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); + prev_time = get_nsecs(); + start_time = prev_time; + if (!opt_quiet) { ret = pthread_create(&pt, NULL, poller, NULL); if (ret) exit_with_error(ret); } - prev_time = get_nsecs(); - start_time = prev_time; - /* Configure sched priority for better wake-up accuracy */ memset(&schparam, 0, sizeof(schparam)); schparam.sched_priority = opt_schprio;