]> git.baikalelectronics.ru Git - kernel.git/commit
samples/bpf: Fix possible hang in xdpsock with multiple threads
authorMagnus Karlsson <magnus.karlsson@intel.com>
Thu, 10 Dec 2020 16:34:07 +0000 (17:34 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 10 Dec 2020 22:13:43 +0000 (23:13 +0100)
commit6e31d132d0660765d1a6ce984b2f4394f6046193
tree5a20111f66b94fd0aa33b22bbc7d59104cdb77c3
parent5eefe7e789ce0ac9c15e538a89bbd6afc1c0e2ba
samples/bpf: Fix possible hang in xdpsock with multiple threads

Fix a possible hang in xdpsock that can occur when using multiple
threads. In this case, one or more of the threads might get stuck in
the while-loop in tx_only after the user has signaled the main thread
to stop execution. In this case, no more Tx packets will be sent, so a
thread might get stuck in the aforementioned while-loop. Fix this by
introducing a test inside the while-loop to check if the benchmark has
been terminated. If so, return from the function.

Fixes: 4e0935ba7207 ("samples/bpf: xdpsock: Add option to specify batch size")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20201210163407.22066-1-magnus.karlsson@gmail.com
samples/bpf/xdpsock_user.c