Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756307AbbFBL0J (ORCPT ); Tue, 2 Jun 2015 07:26:09 -0400 Received: from mail-la0-f52.google.com ([209.85.215.52]:35239 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752476AbbFBL0A (ORCPT ); Tue, 2 Jun 2015 07:26:00 -0400 MIME-Version: 1.0 In-Reply-To: <20150529165536.GD31469@pd.tnic> References: <20150526131717.GB18076@nazgul.tnic> <20150526135700.GC18076@nazgul.tnic> <20150526213400.GA17409@pd.tnic> <20150527120140.GC19582@pd.tnic> <20150527125136.GE19582@pd.tnic> <20150529165536.GD31469@pd.tnic> Date: Tue, 2 Jun 2015 17:25:58 +0600 Message-ID: Subject: Re: [PATCH v8 0/3] x86/earlyprintk: setup serial earlyprintk as early as possible From: Alexander Kuleshov To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Shevchenko , LKML , Greg Kroah-Hartman , Mark Rustad , Yinghai Lu Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3072 Lines: 86 2015-05-29 22:55 GMT+06:00 Borislav Petkov : > > You can boot with "ignore_loglevel" to see that message. Provided > ignore_loglevel is even parsed that early. > But ignore_loglevel is early_param too... > > Yes, I meant a testing patch which is used only for testing and which > issues a bunch of early_printk() calls. > Maybe I just remove 'if' clause and just leave: early_printk("Early printk is initialized\n"); In the arch/x86/kernel/head{32,64}.c? Call of the early_printk is safe here, even earlyprintk is not enabled and it must be good for testing this patchset. > But, before you do that, your patchset has more problems. Booting in > qemu+kvm gives this: > > early console in setup code > early console in decompress_kernel > > Decompressing Linux... Parsing ELF... done. > Booting the kernel. > [ 0.000000] bootconsole [earlyser0] enabled > [ 0.000000] ERROR: earlyprintk= earlyser already used > ^^^^^^ Yes, thanks. This is because we go though a buffer in a loop and after the earlyprintk=ttyS0, it finds console=ttyS0. So, I think we can add additional check, something like this: if (!strncmp(buf, "serial", 6) && early_serial_console.index == -1) { ... ... ... } and for the "ttyS...". Just tested it and it works without "ERROR: earlyprintk= earlyser already used". > > [ 0.000000] per task-struct memory footprint: 2688 bytes > [ 0.000000] WARNING: lockdep init error! lock-(console_sem).lock was acquiredbefore lockdep_init > [ 0.000000] Call stack leading to lockdep invocation was: > [ 0.000000] [] save_stack_trace+0x2f/0x50 > [ 0.000000] [] __lock_acquire+0xa2c/0xf00 > [ 0.000000] [] lock_acquire+0xdb/0x2b0 > [ 0.000000] [] _raw_spin_lock_irqsave+0x53/0x90 > [ 0.000000] [] down+0x16/0x50 > [ 0.000000] [] console_lock+0x19/0x60 > [ 0.000000] [] register_console+0x116/0x350 > [ 0.000000] [] setup_early_printk+0x165/0x467 > [ 0.000000] [] setup_early_serial_console+0x56/0x58 > [ 0.000000] [] x86_64_start_kernel+0xce/0x110 > [ 0.000000] [] 0xffffffffffffffff > [ 0.000000] ------------------------ > > This last one shows that you'd need to look into lockdep first. It also > shows that early boot order is pretty fragile so one has to be very > careful when changing stuff there. > What if I add call of the lockdep_init before the setup_early_serial_console? It must be safe because there is check in the lockdep_init: if (lockdep_initialized) return; and some architectures (powerpc, microblaze, s390) already do it in the same way. What do you think about it? Thank you. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/