From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935481AbcI3BQC (ORCPT ); Thu, 29 Sep 2016 21:16:02 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:36181 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755519AbcI3BPx (ORCPT ); Thu, 29 Sep 2016 21:15:53 -0400 Date: Fri, 30 Sep 2016 10:15:44 +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 6/7] printk: use alternative printk buffers Message-ID: <20160930011544.GC547@swordfish> References: <20160927142237.5539-1-sergey.senozhatsky@gmail.com> <20160927142237.5539-7-sergey.senozhatsky@gmail.com> <20160929130000.GE26796@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160929130000.GE26796@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 15:00), Petr Mladek wrote: [..] > > @@ -1791,7 +1791,7 @@ asmlinkage int vprintk_emit(int facility, int level, > > zap_locks(); > > } > > > > - lockdep_off(); > > + alt_printk_enter(); > > IMHO, we could not longer enter vprintk_emit() recursively. The same > section that was guarded by logbuf_cpu is guarded by > alt_printk_enter()/exit() now. you might be very right here. I'll take a look. > IMHO, we could remove all the logic around the recursion. Then we > could even disable/enable irqs inside alt_printk_enter()/exit(). I was thinking of doing something like this; but that would require storing 'unsigned long' flags in per-cpu data alt_enter() { unsinged long flags; local_irq_save(flags); ctx = this_cpu_ptr(); ctx->flags = flags; ... } alt_exit() { ctx = this_cpu_ptr(); ... local_irq_restore(ctx->flags); } and the decision was to keep `unsigned long flags' on stack in the alt_enter/exit caller. besides in most of the cases we already have it (in vprintk_emit() and console_unlock()). but I can certainly hide these details in alt_enter/exit. > And to correct myself from the previous mail. It is enough to disable > IRQs. It is enough to make sure that we will not preempt and will > stay on the same CPU. ah, no prob. > > @@ -2479,7 +2490,9 @@ void console_unlock(void) > > */ > > raw_spin_lock(&logbuf_lock); > > retry = console_seq != log_next_seq; > > - raw_spin_unlock_irqrestore(&logbuf_lock, flags); > > + raw_spin_unlock(&logbuf_lock); > > + alt_printk_exit(); > > + local_irq_restore(flags); > > We should mention that this patch makes an obsolete artefact from > printk_deferred(). It opens the door for another big cleanup and > relief. do you mean that, once alt_printk is done properly, we can drop printk_deferred()? I was thinking of it, but decided not to mention/touch it in this patch set. -ss