Skip to contentSkip to conversation

delay: Fix ndelay() spuriously treated as udelay()

PATCH Applied Frederic Weisbecker 5 participants 5 messages Nov 21, 2024 – Dec 2, 2024 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 delay: Fix ndelay() spuriously treated as udelay()

A recent rework on delay functions wrongly ended up calling __udelay() instead of __ndelay() for nanosecond delays, increasing those by 1000.

As a result hangs have been observed on boot

Restore the right function calls.

Fixes 19e2d91d8cb1 ("delay: Rework udelay and ndelay")
---
 include/asm-generic/delay.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/delay.h +2 -2
index 76cf237b6e4c..03b0ec7afca6 100644
@@ -75,11 +75,11 @@ static __always_inline void ndelay(unsigned long nsec)
 {
 	if (__builtin_constant_p(nsec)) {
 		if (nsec >= DELAY_CONST_MAX)
-			__bad_udelay();
+			__bad_ndelay();
 		else
 			__const_udelay(nsec * NDELAY_CONST_MULT);
 	} else {
-		__udelay(nsec);
+		__ndelay(nsec);
 	}
 }
 #define ndelay(x) ndelay(x)
Signature · 1 line
2.46.0
Tested-by Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Frederic Weisbecker

A recent rework on delay functions wrongly ended up calling __udelay() instead of __ndelay() for nanosecond delays, increasing those by 1000.

As a result hangs have been observed on boot

Restore the right function calls.

Fixes 19e2d91d8cb1 ("delay: Rework udelay and ndelay")

Thank you for the quick response! This fixed things for me.

Quoted 25 lines
---
 include/asm-generic/delay.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/delay.h +2 -3
index 76cf237b6e4c..03b0ec7afca6 100644
@@ -75,11 +75,11 @@ static __always_inline void ndelay(unsigned long nsec)
 {
        if (__builtin_constant_p(nsec)) {
                if (nsec >= DELAY_CONST_MAX)
-                       __bad_udelay();
+                       __bad_ndelay();
                else
                        __const_udelay(nsec * NDELAY_CONST_MULT);
        } else {
-               __udelay(nsec);
+               __ndelay(nsec);
        }
 }
 #define ndelay(x) ndelay(x)
--

2.46.0

Reviewed-by on v1 1/1
#2 lore raw
In reply to Frederic Weisbecker

Il 21/11/24 16:29, Frederic Weisbecker ha scritto:

Quoted 10 lines

A recent rework on delay functions wrongly ended up calling __udelay() instead of __ndelay() for nanosecond delays, increasing those by 1000.

As a result hangs have been observed on boot

Restore the right function calls.

Fixes 19e2d91d8cb1 ("delay: Rework udelay and ndelay")
#3 lore raw
In reply to Frederic Weisbecker
The following commit has been merged into the timers/urgent branch of tip:

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     4d17c25eaf5d8b95d70726e6946e8eb94619e139
Gitweb:        https://git.kernel.org/tip/4d17c25eaf5d8b95d70726e6946e8eb94619e139
Author:        Frederic Weisbecker <[email protected]>
AuthorDate:    Thu, 21 Nov 2024 16:29:31 +01:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Fri, 29 Nov 2024 11:40:22 +01:00

delay: Fix ndelay() spuriously treated as udelay()

A recent rework on delay functions wrongly ended up calling __udelay() instead of __ndelay() for nanosecond delays, increasing those by 1000.

As a result hangs have been observed on boot

Restore the right function calls.

---
 include/asm-generic/delay.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/delay.h +2 -2
index 76cf237..03b0ec7 100644
@@ -75,11 +75,11 @@ static __always_inline void ndelay(unsigned long nsec)
 {
 	if (__builtin_constant_p(nsec)) {
 		if (nsec >= DELAY_CONST_MAX)
-			__bad_udelay();
+			__bad_ndelay();
 		else
 			__const_udelay(nsec * NDELAY_CONST_MULT);
 	} else {
-		__udelay(nsec);
+		__ndelay(nsec);
 	}
 }
 #define ndelay(x) ndelay(x)
Tested-by on v1 1/1
#4 lore raw
In reply to Frederic Weisbecker
Quoted 10 lines · Frederic Weisbecker

A recent rework on delay functions wrongly ended up calling __udelay() instead of __ndelay() for nanosecond delays, increasing those by 1000.

As a result hangs have been observed on boot

Restore the right function calls.

Fixes 19e2d91d8cb1 ("delay: Rework udelay and ndelay")

It's possible to boot again on MT8195-Cherry-Tomato with this patch applied on top of next-20241128.

Thanks,
Nícolas