From: Borislav Petkov <bp@suse.de>
To: Alexander Kuleshov <kuleshovmail@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mark Rustad <mark.d.rustad@intel.com>,
Yinghai Lu <yinghai@kernel.org>
Subject: Re: [PATCH v10 3/3] x86/earlyprintk: setup earlyprintk as early as possible
Date: Mon, 8 Jun 2015 11:33:26 +0200 [thread overview]
Message-ID: <20150608093326.GC5877@pd.tnic> (raw)
In-Reply-To: <1433686477-20856-1-git-send-email-kuleshovmail@gmail.com>
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 <kuleshovmail@gmail.com>
> ---
> 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.
--
next prev parent reply other threads:[~2015-06-08 9:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-07 14:13 [PATCH v10 0/3] x86/earlyprintk: setup serial earlyprintk as early as possible Alexander Kuleshov
2015-06-07 14:14 ` [PATCH v10 1/3] x86/setup: introduce setup_bultin_cmdline Alexander Kuleshov
2015-06-07 14:14 ` [PATCH v10 2/3] x86/setup: handle builtin command line as early as possible Alexander Kuleshov
2015-06-07 14:14 ` [PATCH v10 3/3] x86/earlyprintk: setup earlyprintk " Alexander Kuleshov
2015-06-08 9:33 ` Borislav Petkov [this message]
2015-06-09 9:19 ` Alexander Kuleshov
2015-06-09 9:43 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150608093326.GC5877@pd.tnic \
--to=bp@suse.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=kuleshovmail@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.d.rustad@intel.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.