From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754933AbcI2L3J (ORCPT ); Thu, 29 Sep 2016 07:29:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:55765 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753177AbcI2L3A (ORCPT ); Thu, 29 Sep 2016 07:29:00 -0400 Date: Thu, 29 Sep 2016 13:28:53 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Matt Fleming , Byungchul Park , Frederic Weisbecker , Jan Kara , Luca Abeni , Rik van Riel , Thomas Gleixner , Wanpeng Li , Yuyang Du , Mel Gorman , Mike Galbraith , Tejun Heo , Calvin Owens , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC 0/5] printk: Implement WARN_*DEFERRED() Message-ID: <20160929112853.GC26796@pathway.suse.cz> References: <1474992135-14777-1-git-send-email-pmladek@suse.com> <20160928011845.GA753@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160928011845.GA753@swordfish> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2016-09-28 10:18:45, Sergey Senozhatsky wrote: > On (09/27/16 18:02), Petr Mladek wrote: > > The main trick is that we replace the per-CPU function pointer > > by a preempt_count-like variable that could track the printk context. > > > > I know that Sergey has another ideas in this area. But I wanted to see > > how this approach would look like. > > well, yes. I was looking at WARN_*_DEFERRED [1] for some time, and, I > think, the maintenance cost of that solution is just too high: > > a) every existing WARN_* in sched/timekeeping/who knows where else > must be evaluated to ensure that in can't be called from printk() > path. if `false' - then the corresponding macro must be replaced > with _DEFERRED flavor. > > b) any patch that adds new WARN_* usages must be additionally checked > to ensure that each of new WARN_* macros cannot be called from printk > path. if `false' -- the corresponding macro must be replaced with > _DEFERRED flavor. > > c) any patch that refactors the code or moves some function calls around > etc. must be additionally checked for any accidental WARN_* from printk > path. even though if none of the patches added any new WARN_* to the code. > > b) apart from WARN_* there can be `accidental' pr_err/pr_debug/etc. not > necessarily newly added (see 'c'). > > > that's too much. > > it takes a lot of additional effort, because both reviewer and contributor > must consider printk() internals. and, what's worse, if something goes > unnoticed we end up having a printk() deadlock again. > > so I decided to address some of printk() issues in printk.c, not in > kernel/time/timekeeping.c or kernel/sched/core.c or anywhere else. I see the point. Your approach (alt buffer) adds some complexity to the printk code but it allows to remove printk_deferred()/WARN_DEFERRED() and all the risk of it. I am going to look closely on it. Best Regards, Petr