From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752089AbcHZIU4 (ORCPT ); Fri, 26 Aug 2016 04:20:56 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:36635 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927AbcHZIUy (ORCPT ); Fri, 26 Aug 2016 04:20:54 -0400 Date: Fri, 26 Aug 2016 17:20:48 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Jan Kara , Sergey Senozhatsky , Viresh Kumar , Andrew Morton , Jan Kara , Tejun Heo , Tetsuo Handa , "linux-kernel@vger.kernel.org" , Byungchul Park , vlevenetz@mm-sol.com, Greg Kroah-Hartman , Sergey Senozhatsky Subject: Re: [PATCH v10 1/2] printk: Make printk() completely async Message-ID: <20160826082048.GA498@swordfish> References: <20160818093329.GL13300@pathway.suse.cz> <20160818095144.GA425@swordfish> <20160818105629.GE26194@pathway.suse.cz> <20160819063236.GA584@swordfish> <20160819095455.GR13300@pathway.suse.cz> <20160819190007.GA8275@quack2.suse.cz> <20160820052430.GA695@swordfish> <20160822041520.GA511@swordfish> <20160825210959.GA2273@dhcp128.suse.cz> <20160826015641.GA520@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160826015641.GA520@swordfish> User-Agent: Mutt/1.7.0 (2016-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (08/26/16 10:56), Sergey Senozhatsky wrote: > but every lock we take is potentially dangerous as well. ... > vprintk_emit() > { > alt_printk_enter(); > ... > log_store(); > ... > alt_printk_exit(); > > wakep_up_process() /* direct from async printk, > or indirect from console_unlock()->up() */ > alt_printk_enter(); > ... enqueue task > alt_printk_exit(); > } OTOH, after a very quick thought, up() also takes a spin lock, which may spindump. so I'll probably prefer to keep the entire alt-printk thing entirely in printk(). something like this vprintk_emit() { alt_printk_enter() log_store() alt_printk_exit() if (async_printk) { alt_printk_enter() wake_up_process() alt_printk_exit() } else { if (console_trylock()) { console_unlock() { .... alt_printk_enter() up() alt_printk_exit() } } } } this leaves console_trylock() `unprotected'. so I guess I'll do something like this: } else { int ret; alt_printk_enter() ret = console_trylock(); alt_printk_exit() if (ret) console_unlock(); } a bit ugly, but well, it is what it is. will think more about it. -ss