From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935428AbcI3BFk (ORCPT ); Thu, 29 Sep 2016 21:05:40 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35738 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752523AbcI3BFg (ORCPT ); Thu, 29 Sep 2016 21:05:36 -0400 Date: Fri, 30 Sep 2016 10:05:28 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Sergey Senozhatsky , Jan Kara , Andrew Morton , Tejun Heo , Calvin Owens , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC][PATCH 3/7] printk: introduce per-cpu alt_print seq buffer Message-ID: <20160930010528.GB547@swordfish> References: <20160927142237.5539-1-sergey.senozhatsky@gmail.com> <20160927142237.5539-4-sergey.senozhatsky@gmail.com> <20160929122639.GD26796@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160929122639.GD26796@pathway.suse.cz> 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 (09/29/16 14:26), Petr Mladek wrote: [..] > > printk() > > local_irq_save() > > alt_printk_enter() > > We need to make sure that exit() is called on the same CPU. > Therefore we need to disable preemption as well. local_irq_save() does this for us, we can't get sched tick or re-sched IPI, and even more - we eliminate race conditions on this CPU. only one path can touch alt_printk related stuff, NMI works with its own buffer. [..] > What do you think about my approach with the printk_context per-CPU > value from the WARN_DEFERRED() patchset? The main idea is that > the entry()/exit() functions manipulate preempt_count-like per-CPU > variable. The printk() function selects the safe implementation > according to the current state. I'll take a look. hm, what I was thinking of... you are right, this all smells a bit bad. I'll revisit it. thanks! -ss