]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/sclp: Use monotonic clock in sclp_sync_wait()
authorSven Schnelle <svens@linux.ibm.com>
Thu, 10 Jul 2025 07:43:40 +0000 (09:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:41:06 +0000 (18:41 +0200)
[ Upstream commit 925f0707a67cae0a974c4bd5b718f0263dc56824 ]

sclp_sync_wait() should use the monotonic clock for the delay loop.
Otherwise the code won't work correctly when the clock is changed.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/s390/char/sclp.c

index 840be75e75d419327f123e6b37fae473936e79e2..9a55e2d04e633f824c0e35adda19e4b856f81443 100644 (file)
@@ -719,7 +719,7 @@ sclp_sync_wait(void)
        timeout = 0;
        if (timer_pending(&sclp_request_timer)) {
                /* Get timeout TOD value */
-               timeout = get_tod_clock_fast() +
+               timeout = get_tod_clock_monotonic() +
                          sclp_tod_from_jiffies(sclp_request_timer.expires -
                                                jiffies);
        }
@@ -739,7 +739,7 @@ sclp_sync_wait(void)
        /* Loop until driver state indicates finished request */
        while (sclp_running_state != sclp_running_state_idle) {
                /* Check for expired request timer */
-               if (get_tod_clock_fast() > timeout && timer_delete(&sclp_request_timer))
+               if (get_tod_clock_monotonic() > timeout && timer_delete(&sclp_request_timer))
                        sclp_request_timer.function(&sclp_request_timer);
                cpu_relax();
        }