From da11c9d2a2fbe11c714ffca98fada3068f58ad5e Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Fri, 28 May 2021 05:42:22 -0400 Subject: [PATCH] lib/event: fix refreshing tsc_last when returning to poll mode (a5ad0f80) lib/event: update reactor tsc_last going poll mode Patch above updated the tsc_last at the very end of changing interrupt mode of the reactor. The flow for turning from interrupt mode to poll mode is first to send an event to the target lcore, then to iterate over all reactors updating notify_cpuset on each. Previous patch updated the tsc_last after notify_cpuset was updated, meanwhile the threads could already been put on it. This patch moves it immidietly to the point of changing the in_interrupt state. Signed-off-by: Tomasz Zawadzki Change-Id: I6aea252016f4706369b8b597b765593bc6edca3b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8111 Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Konrad Sztyber Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot --- lib/event/reactor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/event/reactor.c b/lib/event/reactor.c index 92886887c..7b01feda3 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -363,9 +363,6 @@ _reactor_set_notify_cpuset_cpl(void *arg1, void *arg2) struct spdk_reactor *target = arg1; if (target->new_in_interrupt == false) { - /* Reactor is no longer in interrupt mode. Refresh the tsc_last to accurately - * track reactor stats. */ - target->tsc_last = spdk_get_ticks(); target->set_interrupt_mode_in_progress = false; spdk_thread_send_msg(_spdk_get_app_thread(), target->set_interrupt_mode_cb_fn, target->set_interrupt_mode_cb_arg); @@ -408,6 +405,9 @@ _reactor_set_interrupt_mode(void *arg1, void *arg2) } if (target->new_in_interrupt == false) { + /* Reactor is no longer in interrupt mode. Refresh the tsc_last to accurately + * track reactor stats. */ + target->tsc_last = spdk_get_ticks(); spdk_for_each_reactor(_reactor_set_notify_cpuset, target, NULL, _reactor_set_notify_cpuset_cpl); } else { uint64_t notify = 1;