Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751433AbbBXGlO (ORCPT ); Tue, 24 Feb 2015 01:41:14 -0500 Received: from mail-we0-f180.google.com ([74.125.82.180]:40308 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbbBXGlM (ORCPT ); Tue, 24 Feb 2015 01:41:12 -0500 Date: Tue, 24 Feb 2015 07:41:07 +0100 From: Ingo Molnar To: Anton Blanchard Cc: Andrew Morton , Steven Rostedt , Michael Ellerman , Paul Mackerras , Benjamin Herrenschmidt , sam.bobroff@au1.ibm.com, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Russell King , peterz@infradead.org, Don Zickus , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, Linus Torvalds , Arjan van de Ven , Peter Zijlstra Subject: Re: [PATCH 1/7] Add die_spin_lock_{irqsave,irqrestore} Message-ID: <20150224064107.GB15387@gmail.com> References: <1424748634-9153-1-git-send-email-anton@samba.org> <1424748634-9153-2-git-send-email-anton@samba.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1424748634-9153-2-git-send-email-anton@samba.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1262 Lines: 46 * Anton Blanchard wrote: > +static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED; > +static int die_owner = -1; > +static unsigned int die_nest_count; > + > +unsigned long __die_spin_lock_irqsave(void) > +{ > + unsigned long flags; > + int cpu; > + > + /* racy, but better than risking deadlock. */ > + raw_local_irq_save(flags); > + > + cpu = smp_processor_id(); > + if (!arch_spin_trylock(&die_lock)) { > + if (cpu != die_owner) > + arch_spin_lock(&die_lock); So why not trylock and time out here after a few seconds, instead of indefinitely supressing some potentially vital output due to some other CPU crashing/locking with the lock held? > + } > + die_nest_count++; > + die_owner = cpu; > + > + return flags; I suspect this would work in most cases. If we fix the deadlock potential, and get a true global ordering of various oopses/warnings as they triggered (or at least timestamping them), then I'm sold on this I guess, it will likely improve things. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/