From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941136AbcLWJxz (ORCPT ); Fri, 23 Dec 2016 04:53:55 -0500 Received: from mx2.suse.de ([195.135.220.15]:57992 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935162AbcLWJxq (ORCPT ); Fri, 23 Dec 2016 04:53:46 -0500 Date: Fri, 23 Dec 2016 10:53:41 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: Linus Torvalds , Andrew Morton , Jan Kara , Tejun Heo , Calvin Owens , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andy Lutomirski , Peter Hurley , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCHv6 6/7] printk: use printk_safe buffers in printk Message-ID: <20161223095341.GA2541@linux.suse> References: <20161221143605.2272-1-sergey.senozhatsky@gmail.com> <20161221143605.2272-7-sergey.senozhatsky@gmail.com> <20161222053119.GE644@jagdpanzerIV.localdomain> <20161222171012.GC14894@pathway.suse.cz> <20161223014643.GA637@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161223014643.GA637@jagdpanzerIV.localdomain> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2016-12-23 10:46:43, Sergey Senozhatsky wrote: > not every switch to printk_safe is "dictated" by logbuf_lock. > down_trylock_console_sem(), for instance, takes semaphore spin_lock > which already may be locked on the same CPU (*), so we need to be > in safe mode: > > vprintk_emit() > down_trylock() > raw_spin_lock_irqsave(&sem->lock, flags); > ... > raw_spin_unlock_irqrestore(&sem->lock, flags); > spin_dump() > printk() > vprintk_emit() > down_trylock() > raw_spin_lock_irqsave(&sem->lock, flags) << deadlock > > > and so on. IOW, "printk_save_enter()" != "logbuf_lock is acquired". You are right. It seems that the printk_safe_enter_irq() printk_safe_exit_irq() printk_safe_enter_irqsave(flags) printk_safe_exit_irqrestore(flags) variants make sense and we will need them together with the logbuf_lock_*() stuff. > [..] > > PS: I still think if we could come with a better name than > > printk_safe() but I cannot find one. > > well, not that I'm the fan of printk_safe name, but can't think > of anything better. we make printk calls safe (deadlock safe) in > places where previously it was unsafe... quick-&-dirty name that > is implementation-specific -- printk_percpu_enter/exit, or > printk_pcpu_enter/exit... dunno. OK, let's stay with printk_safe :-) Best Reagards, Petr