From 912e2c5e69d48bb0d329554e9598635fc439b23a Mon Sep 17 00:00:00 2001 From: xiongmengbiao Date: Wed, 2 Jul 2025 11:36:30 +0800 Subject: [PATCH] anolis: crypto: ccp: use time_after() instead of time_before() to checks schedule condition ANBZ: #22926 Used time_before(jiffies, last_je) in psp_mutex_lock_timeout() which yields CPU too early. Fixed to time_after(jiffies, last_je + msecs_to_jiffies(100)) for proper 100ms wait. Signed-off-by: xiongmengbiao --- drivers/crypto/ccp/psp-dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index f2f79767ea17..5ea9b328cd45 100644 --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -84,7 +84,7 @@ int psp_mutex_lock_timeout(struct psp_mutex *mutex, uint64_t ms) int ret = 0; unsigned long je, last_je; - last_je = jiffies + msecs_to_jiffies(100); + last_je = jiffies; je = jiffies + msecs_to_jiffies(ms); do { if (psp_mutex_trylock(mutex)) { @@ -93,9 +93,9 @@ int psp_mutex_lock_timeout(struct psp_mutex *mutex, uint64_t ms) } // avoid triggering soft lockup warning - if (time_before(jiffies, last_je)) { + if (time_after(jiffies, last_je + msecs_to_jiffies(100))) { schedule(); - last_je = jiffies + msecs_to_jiffies(100); + last_je = jiffies; } } while ((ms == 0) || time_before(jiffies, je)); -- Gitee