From patchwork Tue Jul 5 06:12:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Blanchard X-Patchwork-Id: 103202 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 7892A100AC0 for ; Tue, 5 Jul 2011 16:12:13 +1000 (EST) Received: from kryten (ppp121-44-103-34.lns20.syd6.internode.on.net [121.44.103.34]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id 527F01007D1; Tue, 5 Jul 2011 16:12:03 +1000 (EST) Date: Tue, 5 Jul 2011 16:12:02 +1000 From: Anton Blanchard To: benh@kernel.crashing.org, mikey@neuling.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/kdump: Fix timeout in crash_kexec_wait_realmode Message-ID: <20110705161202.62dc7d24@kryten> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.24.4; i686-pc-linux-gnu) Mime-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org 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 Cc: Index: linux-powerpc/arch/powerpc/kernel/crash.c =================================================================== --- linux-powerpc.orig/arch/powerpc/kernel/crash.c 2011-07-05 15:04:18.512140484 +1000 +++ linux-powerpc/arch/powerpc/kernel/crash.c 2011-07-05 15:05:51.483747575 +1000 @@ -240,7 +240,8 @@ static void crash_kexec_wait_realmode(in if (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;