Re: [PATCH bpf-next v3 1/5] bpf: consolidate shared test timing code
From: Andrii Nakryiko <hidden>
Date: 2021-03-03 22:55:55
Also in:
bpf
From: Andrii Nakryiko <hidden>
Date: 2021-03-03 22:55:55
Also in:
bpf
On Mon, Mar 1, 2021 at 2:19 AM Lorenz Bauer [off-list ref] wrote:
Share the timing / signal interruption logic between different implementations of PROG_TEST_RUN. There is a change in behaviour as well. We check the loop exit condition before checking for pending signals. This resolves an edge case where a signal arrives during the last iteration. Instead of aborting with EINTR we return the successful result to user space. Signed-off-by: Lorenz Bauer <redacted> --- net/bpf/test_run.c | 141 +++++++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 63 deletions(-)diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index 58bcb8c849d5..ac8ee36d60cc 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c@@ -16,14 +16,78 @@ #define CREATE_TRACE_POINTS #include <trace/events/bpf_test_run.h> +struct test_timer {
nit: super generic name, I'd add bpf_ prefix throughout (bpf_test_timer, bpf_test_timer_enter, bpf_test_timer_leave, and so on)
+ enum { NO_PREEMPT, NO_MIGRATE } mode;
+ u32 i;
+ u64 time_start, time_spent;
+};
+[...]