Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932285AbbFHJdj (ORCPT ); Mon, 8 Jun 2015 05:33:39 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51443 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753055AbbFHJdb (ORCPT ); Mon, 8 Jun 2015 05:33:31 -0400 Date: Mon, 8 Jun 2015 11:33:26 +0200 From: Borislav Petkov To: Alexander Kuleshov Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Shevchenko , LKML , Greg Kroah-Hartman , Mark Rustad , Yinghai Lu Subject: Re: [PATCH v10 3/3] x86/earlyprintk: setup earlyprintk as early as possible Message-ID: <20150608093326.GC5877@pd.tnic> References: <1433686424-18555-1-git-send-email-kuleshovmail@gmail.com> <1433686477-20856-1-git-send-email-kuleshovmail@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1433686477-20856-1-git-send-email-kuleshovmail@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5974 Lines: 158 On Sun, Jun 07, 2015 at 08:14:37PM +0600, Alexander Kuleshov wrote: > The early_printk function is usable only after the setup_early_printk will > be executed. We pass 'earlyprintk' through the kernel command line, so it > will be usable only after the 'parse_early_param' will be executed. This means > that we have usable earlyprintk only during early boot, kernel decompression > and after call of the 'parse_early_param'. This patchset makes earlyprintk > usable before the call of the 'parse_early_param'. > > This patch makes the setup_early_printk visible for head{32,64}.c. So the > 'early_printk' function will be usabable after decompression of the > kernel and before parse_early_param will be called. It also must be > safe if CONFIG_CMDLINE_BOOL and CONFIG_CMDLINE_OVERRIDE are set, because > setup_cmdline function will be called before setup_early_printk. > > It provides earlyprintk only for serial console, because other needs in > ioremap which is not initialized yet. > > Tested it with qemu, so early_printk() is usable and prints to serial > console right after setup_early_printk function called. > > Signed-off-by: Alexander Kuleshov > --- > arch/x86/include/asm/setup.h | 7 +++++++ > arch/x86/kernel/early_printk.c | 30 ++++++++++++++++++++++++++++-- > arch/x86/kernel/head32.c | 7 +++++++ > arch/x86/kernel/head64.c | 6 ++++++ > 4 files changed, 48 insertions(+), 2 deletions(-) ... > diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c > index 92e8b5f..6969d97 100644 > --- a/arch/x86/kernel/head32.c > +++ b/arch/x86/kernel/head32.c > @@ -32,6 +32,13 @@ static void __init i386_default_early_setup(void) > asmlinkage __visible void __init i386_start_kernel(void) > { > setup_builtin_cmdline(); > + > + lockdep_init(); > + > + setup_early_serial_console(); > + > + early_printk("Early printk is initialized\n"); > + > cr4_init_shadow(); > sanitize_boot_params(&boot_params); > > diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c > index 1e5f064..769d411 100644 > --- a/arch/x86/kernel/head64.c > +++ b/arch/x86/kernel/head64.c > @@ -174,7 +174,12 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) > > setup_builtin_cmdline(); > > + lockdep_init(); So you've added that lockdep_init() call here and above on the 32-bit path and haven't removed the one in start_kernel(). * Then, your patches don't apply. Something garbles them insanely so that not even fuzzy, ignore-context patch --merge works. Please fix your setup. For that, send your patches to yourself and try applying them. Send them out only if they apply cleanly. And do them against tip/master or latest Linus rc, alternatively. * To that patchset: I did the diff below ontop of yours to check whether that early printk actually works. And it doesn't on my test box here. The beginning of my dmesg contains: [ 0.000000] bootconsole [earlyser0] enabled [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpuacct [ 0.000000] Linux version 4.1.0-rc6+ (root@gondor) (gcc version 4.9.1 (Debian 4.9.1-19) ) #2 SMP PREEMPT Mon Jun 8 11:10:00 CEST 2015 [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.1.0-rc6+ root=/dev/sda7 ro earlyprintk=ttyS0,115200 console=ttyS0,115200 console=tty0 root=/dev/sda7 log_buf_len=10M resume=/dev/sda5 no_console_suspend ignore_loglevel [ 0.000000] KERNEL supported cpus: [ 0.000000] Intel GenuineIntel [ 0.000000] AMD AuthenticAMD [ 0.000000] Centaur CentaurHauls [ 0.000000] x86/fpu: xstate_offset[2]: 0240, xstate_sizes[2]: 0100 [ 0.000000] x86/fpu: Supporting XSAVE feature 0x01: 'x87 floating point registers' [ 0.000000] x86/fpu: Supporting XSAVE feature 0x02: 'SSE registers' [ 0.000000] x86/fpu: Supporting XSAVE feature 0x04: 'AVX registers' [ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 0x340 bytes, using 'standard' format. [ 0.000000] x86/fpu: Using 'eager' FPU context switches. [ 0.000000] e820: BIOS-provided physical RAM map: ... and I have CONFIG_EARLY_PRINTK=y. So provided I'm not missing anything, I'd say you'd need to do more staring. So I'd suggest you test your patches on bare metal, both 32-bit and 64-bit with a similar diff as the one I've done below. HTH. --- diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index d4ea6ec28f09..20dd514ce838 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -179,7 +179,6 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) early_printk("Early printk is initialized\n"); - /* * Load microcode early on BSP. */ @@ -202,5 +201,7 @@ void __init x86_64_start_reservations(char *real_mode_data) reserve_ebda_region(); + early_printk("Will start_kernel\n"); + start_kernel(); } diff --git a/init/main.c b/init/main.c index 2115055faeac..e9180445283e 100644 --- a/init/main.c +++ b/init/main.c @@ -494,6 +494,8 @@ asmlinkage __visible void __init start_kernel(void) char *command_line; char *after_dashes; + early_printk("Will run lockdep_init needlessly one more time\n"); + /* * Need to run as early as possible, to initialize the * lockdep hash: @@ -530,6 +532,8 @@ asmlinkage __visible void __init start_kernel(void) build_all_zonelists(NULL, NULL); page_alloc_init(); + early_printk("Early Kernel command line: %s\n", boot_command_line); + pr_notice("Kernel command line: %s\n", boot_command_line); parse_early_param(); after_dashes = parse_args("Booting kernel", -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- 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/