Skip to contentSkip to conversation

Fix to be error handled when 10ms delayed for cpu_on

PATCH In review JEUNGWOO, YOO 3 participants 3 messages Oct 4, 2016 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix to be error handled when 10ms delayed for cpu_on

From: casionwoo <[email protected]>

Comment of origin code said "wait max 10 ms until cpu is on"
Origin code expects to print "CPU%d power enable failed", if cpu do not on until 10ms But actual code do not reach to print even it wait 10 ms (actually it waits 11ms not 10ms) Because the comparing is like bellow
"if ( timeout-- == 0 )"
So I modified the code to wait 10ms and print the error statement
Let me simulate about origin code and modified code.

Origin code)

timeout delayed time timeout
(before while) (mdelay(1)) (timeout--)

	  10			    1				9
	  9					2				8
	  8					3				7
	  7					4				6
	  6					5				5
	  5					6				4
	  4					7				3
	  3					8				2
	  2					9				1
	  1					10				0
	  0					11				-1

Modified code)

timeout delayed time timeout
(before while) (mdelay(1)) (--timeout)

	  10			    1				9
	  9					2				8
	  8					3				7
	  7					4				6
	  6					5				5
	  5					6				4
	  4					7				3
	  3					8				2
	  2					9				1
	  1					10				0
---
 xen/arch/arm/platforms/exynos5.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/platforms/exynos5.c +3 -3
index c43934f..9edd866 100644
@@ -175,10 +175,10 @@ static int exynos5_cpu_power_up(void __iomem *power, int cpu)
         /* wait max 10 ms until cpu is on */
         while ( exynos_cpu_power_state(power, cpu) != S5P_CORE_LOCAL_PWR_EN )
         {
-            if ( timeout-- == 0 )
-                break;
-
             mdelay(1);
+
+            if ( --timeout == 0 )
+                break;
         }
 
         if ( timeout == 0 )
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 41 lines · YOO

From: casionwoo <[email protected]>

Comment of origin code said "wait max 10 ms until cpu is on"
Origin code expects to print "CPU%d power enable failed", if cpu do not on until 10ms But actual code do not reach to print even it wait 10 ms (actually it waits 11ms not 10ms) Because the comparing is like bellow
"if ( timeout-- == 0 )"
So I modified the code to wait 10ms and print the error statement
Let me simulate about origin code and modified code.

Origin code)

timeout delayed time timeout
(before while) (mdelay(1)) (timeout--)

	  10			    1				9
	  9					2				8
	  8					3				7
	  7					4				6
	  6					5				5
	  5					6				4
	  4					7				3
	  3					8				2
	  2					9				1
	  1					10				0
	  0					11				-1

Modified code)

timeout delayed time timeout
(before while) (mdelay(1)) (--timeout)

	  10			    1				9
	  9					2				8
	  8					3				7
	  7					4				6
	  6					5				5
	  5					6				4
	  4					7				3
	  3					8				2
	  2					9				1
	  1					10				0
Quoted 1 line
Quoted 24 lines
 xen/arch/arm/platforms/exynos5.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/platforms/exynos5.c +3 -3
index c43934f..9edd866 100644
@@ -175,10 +175,10 @@ static int exynos5_cpu_power_up(void __iomem *power, int cpu)
         /* wait max 10 ms until cpu is on */
         while ( exynos_cpu_power_state(power, cpu) != S5P_CORE_LOCAL_PWR_EN )
         {
-            if ( timeout-- == 0 )
-                break;
-
             mdelay(1);
+
+            if ( --timeout == 0 )
+                break;
         }
 
         if ( timeout == 0 )
Signature · 1 line
1.9.1

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to JEUNGWOO, YOO

Hello,

Quoted 1 line · YOO

From: casionwoo <[email protected]>

The "from" should match the signed-off-by below.

Quoted 50 lines

Comment of origin code said "wait max 10 ms until cpu is on"
Origin code expects to print "CPU%d power enable failed", if cpu do not on until 10ms But actual code do not reach to print even it wait 10 ms (actually it waits 11ms not 10ms) Because the comparing is like bellow
"if ( timeout-- == 0 )"
So I modified the code to wait 10ms and print the error statement
Let me simulate about origin code and modified code.

Origin code)

timeout delayed time timeout
(before while) (mdelay(1)) (timeout--)

	  10			    1				9
	  9					2				8
	  8					3				7
	  7					4				6
	  6					5				5
	  5					6				4
	  4					7				3
	  3					8				2
	  2					9				1
	  1					10				0
	  0					11				-1

Modified code)

timeout delayed time timeout
(before while) (mdelay(1)) (--timeout)

	  10			    1				9
	  9					2				8
	  8					3				7
	  7					4				6
	  6					5				5
	  5					6				4
	  4					7				3
	  3					8				2
	  2					9				1
	  1					10				0
---
 xen/arch/arm/platforms/exynos5.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/platforms/exynos5.c +0 -0
index c43934f..9edd866 100644

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, int cpu) · line 181

Quoted 10 lines
xen/arch/arm/platforms/exynos5.c +3 -3
@@ -175,10 +175,10 @@ static int exynos5_cpu_power_up(void __iomem *power, int cpu)
         /* wait max 10 ms until cpu is on */
         while ( exynos_cpu_power_state(power, cpu) != S5P_CORE_LOCAL_PWR_EN )
         {
-            if ( timeout-- == 0 )
-                break;
-
             mdelay(1);
+
+            if ( --timeout == 0 )
+                break;

FWIW, this code has been taken from Linux (arch/arm/mach-exynos/platsmp.c). You may want to fix the code there too.

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, int cpu) · line 184

Quoted 4 lines
xen/arch/arm/platforms/exynos5.c +0 -0
         }
 
         if ( timeout == 0 )

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel