From patchwork Wed Sep 21 10:29:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ravi K. Nittala" X-Patchwork-Id: 115749 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 9A85CB6F92 for ; Wed, 21 Sep 2011 20:29:37 +1000 (EST) Received: from e28smtp09.in.ibm.com (e28smtp09.in.ibm.com [122.248.162.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e28smtp09.in.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 2AFAEB6F6F for ; Wed, 21 Sep 2011 20:29:26 +1000 (EST) Received: from /spool/local by in.ibm.com with XMail ESMTP for from ; Wed, 21 Sep 2011 15:59:20 +0530 Received: from d28relay01.in.ibm.com ([9.184.220.58]) by in.ibm.com ([192.168.1.139]) with XMail ESMTP; Wed, 21 Sep 2011 15:59:17 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8LATHql3547178 for ; Wed, 21 Sep 2011 15:59:17 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8LATH9r022830 for ; Wed, 21 Sep 2011 15:59:17 +0530 Received: from d23ml060.in.ibm.com (d23ml060.in.ibm.com [9.124.105.23]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p8LATG6X022825; Wed, 21 Sep 2011 15:59:16 +0530 Received: from localhost6.localdomain6 ([9.124.35.64]) by d23ml060.in.ibm.com (Lotus Domino Release 8.5.1FP5) with ESMTP id 2011092115585436-329420 ; Wed, 21 Sep 2011 15:58:54 +0530 Subject: [PATCH] PSeries: Cancel RTAS event scan before firmware flash To: benh@kernel.crashing.org From: Ravi K Nittala Date: Wed, 21 Sep 2011 15:59:15 +0530 Message-ID: <20110921102825.16444.75131.stgit@localhost6.localdomain6> User-Agent: StGit/0.15 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on d23ml060/23/M/IBM(Release 8.5.1FP5|September 29, 2010) at 21/09/2011 15:58:54, Serialize by Router on d23ml060/23/M/IBM(Release 8.5.1FP5|September 29, 2010) at 21/09/2011 15:58:54, Serialize complete at 21/09/2011 15:58:54 X-TNEFEvaluated: 1 x-cbid: 11092110-2674-0000-0000-00000081C948 Cc: linuxppc-dev@lists.ozlabs.org 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 The RTAS firmware flash update is conducted using an RTAS call that is serialized by lock_rtas() which uses spin_lock. While the flash is in progress, rtasd performs scan for any RTAS events that are generated by the system. rtasd keeps scanning for the RTAS events generated on the machine. This is performed via workqueue mechanism. The rtas_event_scan() also uses an RTAS call to scan the events, eventually trying to acquire the spin_lock before issuing the request. The flash update takes a while to complete and during this time, any other RTAS call has to wait. In this case, rtas_event_scan() waits for a long time on the spin_lock resulting in a soft lockup. Fix: Just before the flash update is performed, the queued rtas_event_scan() work item is cancelled from the work queue so that there is no other RTAS call issued while the flash is in progress. After the flash completes, the system reboots and the rtas_event_scan() is rescheduled. Signed-off-by: Suzuki Poulose Signed-off-by: Ravi Nittala --- arch/powerpc/include/asm/rtas.h | 4 ++++ arch/powerpc/kernel/rtas_flash.c | 8 ++++++++ arch/powerpc/kernel/rtasd.c | 6 ++++++ 3 files changed, 18 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h index 58625d1..b5cbd9f 100644 --- a/arch/powerpc/include/asm/rtas.h +++ b/arch/powerpc/include/asm/rtas.h @@ -245,6 +245,10 @@ extern int early_init_dt_scan_rtas(unsigned long node, extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal); +#ifdef CONFIG_PPC_RTAS_DAEMON +extern bool rtas_cancel_event_scan(void); +#endif + /* Error types logged. */ #define ERR_FLAG_ALREADY_LOGGED 0x0 #define ERR_FLAG_BOOT 0x1 /* log was pulled from NVRAM on boot */ diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index e037c74..a9cceff 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c @@ -567,6 +567,14 @@ static void rtas_flash_firmware(int reboot_type) return; } +#ifdef CONFIG_PPC_RTAS_DAEMON + /* + * Just before starting the firmware flash, cancel the event scan work + * to avoid any soft lockup issues. + */ + rtas_cancel_event_scan(); +#endif + /* * NOTE: the "first" block must be under 4GB, so we create * an entry with no data blocks in the reserved buffer in diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c index 481ef06..e8f03fa 100644 --- a/arch/powerpc/kernel/rtasd.c +++ b/arch/powerpc/kernel/rtasd.c @@ -472,6 +472,12 @@ static void start_event_scan(void) &event_scan_work, event_scan_delay); } +/* Cancel the rtas event scan work */ +bool rtas_cancel_event_scan(void) +{ + return cancel_delayed_work_sync(&event_scan_work); +} + static int __init rtas_init(void) { struct proc_dir_entry *entry;