powerpc/kdump: Fix timeout in crash_kexec_wait_realmode
PATCH 1/1 powerpc/kdump: Fix timeout in crash_kexec_wait_realmode
We check for timeout expiry in the outer loop, but we also need to check it in the inner loop or we can lock up forever waiting for a CPU to hit real mode.
---
arch/powerpc/kernel/crash.c +2 -1
@@ -240,7 +240,8 @@ static void crash_kexec_wait_realmode(inif (i == cpu)continue ; -while (paca[i].kexec_state <KEXEC_STATE_REAL_MODE ) { +while ((paca[i].kexec_state <KEXEC_STATE_REAL_MODE ) && + (msecs >0 )) {barrier ();if (!cpu_possible (i)) {break ;
PATCH 1/1 powerpc/kdump: Fix timeout in crash_kexec_wait_realmode
The existing code it pretty ugly. How about we clean it up even more like this?
From: Anton Blanchard <[email protected]>
We check for timeout expiry in the outer loop, but we also need to check it in the inner loop or we can lock up forever waiting for a CPU to hit real mode.
arch/powerpc/kernel/crash.c +1 -5
@@ -242,12 +242,8 @@ static void crash_kexec_wait_realmode(int cpu)while (paca[i].kexec_state <KEXEC_STATE_REAL_MODE ) {barrier (); -if (!cpu_possible (i)) { +if (!cpu_possible (i) || !cpu_online (i) || (msecs <=0 ))break ; - } -if (!cpu_online (i)) { -break ; - } msecs--;mdelay (1 ); }
Quoted 2 lines · On Tue, 05 Jul 2011 16:40:10 +1000 Michael Neuling <[email protected]> wrote:
The existing code it pretty ugly. How about we clean it up even more like this?
Looks good and it passed my kdump test cases.
Anton
Quoted 29 lines
From: Anton Blanchard <[email protected]>
We check for timeout expiry in the outer loop, but we also need to check it in the inner loop or we can lock up forever waiting for a CPU to hit real mode.
Signed-off-by Anton Blanchard <[email protected]>Signed-off-by Michael Neuling <[email protected]>Cc <[email protected]>arch/powerpc/kernel/crash.c +1
-5@@ -242,12 +242,8 @@ static void crash_kexec_wait_realmode(int cpu)while (paca[i].kexec_state <KEXEC_STATE_REAL_MODE ) {barrier (); -if (!cpu_possible (i)) { +if (!cpu_possible (i) || !cpu_online (i) || (msecs <=0 ))break ; - } -if (!cpu_online (i)) { -break ; - } msecs--;mdelay (1 ); }