From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932309AbcCKUIX (ORCPT ); Fri, 11 Mar 2016 15:08:23 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:55347 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932070AbcCKUIT (ORCPT ); Fri, 11 Mar 2016 15:08:19 -0500 Date: Fri, 11 Mar 2016 12:08:18 -0800 From: Andrew Morton To: Sebastian Andrzej Siewior Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Steven Rostedt Subject: Re: [PATCH] kernel: panic: make panic() local lock raw Message-Id: <20160311120818.069a1c742540e1693bd9e60b@linux-foundation.org> In-Reply-To: <1457718505-25304-1-git-send-email-bigeasy@linutronix.de> References: <1457718505-25304-1-git-send-email-bigeasy@linutronix.de> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 11 Mar 2016 18:48:25 +0100 Sebastian Andrzej Siewior wrote: > The lock is taken with disabled interrupts and therefore it must be > a RAW lock. Otherwise -RT will convert it into a sleeping lock and > complain about it. panic_lock doesn't exist in current kernels. However you may want to take a look at pause_on_oops_lock - strange things are happening with IRQs there. > --- a/kernel/panic.c > +++ b/kernel/panic.c > @@ -71,7 +71,7 @@ void __weak panic_smp_self_stop(void) > */ > void panic(const char *fmt, ...) > { > - static DEFINE_SPINLOCK(panic_lock); > + static DEFINE_RAW_SPINLOCK(panic_lock); This should have had a comment explaining why a raw spinlock was chosen. > static char buf[1024]; > va_list args; > long i, i_next = 0; > @@ -95,7 +95,7 @@ void panic(const char *fmt, ...) > * stop themself or will wait until they are stopped by the 1st CPU > * with smp_send_stop(). > */ > - if (!spin_trylock(&panic_lock)) > + if (!raw_spin_trylock(&panic_lock)) > panic_smp_self_stop(); > > console_verbose();