timer_wait_until() expect a timestamp.

Signed-off-by: Xavier Simonart <[email protected]>
Fixes: d71c45199341 ("pinctrl: Use ovs_mutex_trylock() in the pinctrl thread.")
Signed-off-by: Xavier Simonart <[email protected]>
---
 controller/pinctrl.c | 2 +-
 tests/system-ovn.at  | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/controller/pinctrl.c b/controller/pinctrl.c
index 2fb2dcded..1b03f7057 100644
--- a/controller/pinctrl.c
+++ b/controller/pinctrl.c
@@ -3969,7 +3969,7 @@ pinctrl_handler(void *arg_)
         if (lock_failed) {
             /* Wait for 5 msecs before waking to avoid degrading the
              * lock to a spinlock. */
-            poll_timer_wait_until(5);
+            poll_timer_wait_until(time_msec() + 5);
         } else {
             rconn_run_wait(swconn);
             rconn_recv_wait(swconn);
diff --git a/tests/system-ovn.at b/tests/system-ovn.at
index bf56bba36..d23e4a6aa 100644
--- a/tests/system-ovn.at
+++ b/tests/system-ovn.at
@@ -4440,6 +4440,7 @@ ovs-vsctl \
 
 # Start ovn-controller
 start_daemon ovn-controller
+ovn-appctl vlog/set poll_loop:dbg
 
 check ovn-nbctl ls-add sw0
 
@@ -4623,6 +4624,11 @@ OVS_WAIT_UNTIL([
     test "${n_reset}" = "1"
 ])
 
+# Check that we do not get too many immediate wake up.
+# Tolerate a few for any race conditions.
+AT_CHECK([test 5 -gt `cat ovn-controller.log | \
+grep -c "wakeup due to 0-ms timeout at controller/pinctrl.c:"`])
+
 OVN_CLEANUP_CONTROLLER([hv1])
 
 OVN_CLEANUP_NORTHD
-- 
2.47.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to