From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755001AbcKYPTK (ORCPT ); Fri, 25 Nov 2016 10:19:10 -0500 Received: from merlin.infradead.org ([205.233.59.134]:55058 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754910AbcKYPTD (ORCPT ); Fri, 25 Nov 2016 10:19:03 -0500 Date: Fri, 25 Nov 2016 16:17:24 +0100 From: Peter Zijlstra To: Petr Mladek Cc: Sergey Senozhatsky , Andrew Morton , Jan Kara , Tejun Heo , Calvin Owens , Thomas Gleixner , Mel Gorman , Steven Rostedt , Ingo Molnar , Laura Abbott , Andy Lutomirski , Linus Torvalds , Kees Cook , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC][PATCHv4 6/6] printk: remove zap_locks() function Message-ID: <20161125151724.GO3092@twins.programming.kicks-ass.net> References: <20161027154933.1211-1-sergey.senozhatsky@gmail.com> <20161027154933.1211-7-sergey.senozhatsky@gmail.com> <20161125150113.GJ24103@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161125150113.GJ24103@pathway.suse.cz> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 25, 2016 at 04:01:13PM +0100, Petr Mladek wrote: > On Fri 2016-10-28 00:49:33, Sergey Senozhatsky wrote: > > 2) Since commit cf9b1106c81c ("printk/nmi: flush NMI messages on the > > system panic") panic attempts to zap the `logbuf_lock' spin_lock to > > successfully flush nmi messages to `logbuf'. > > Note that the same code is newly used to flush also the printk_safe > per-CPU buffers. It means that logbuf_lock is zapped also when > flushing these new buffers. > Note that (raw_)spin_lock_init() as done here and in printk_nmi_flush_on_panic() can wreck the lock state and doesn't ensure a subsequent spin_lock() of said lock will actually work. The very best solution is to simply ignore the lock in panic situations rather than trying to wreck it.