From patchwork Mon Apr 4 19:38:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 8743811 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A03AC9F38C for ; Mon, 4 Apr 2016 19:40:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B723020263 for ; Mon, 4 Apr 2016 19:40:58 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA53B20114 for ; Mon, 4 Apr 2016 19:40:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1anAKE-0005gN-MX; Mon, 04 Apr 2016 19:38:14 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1anAKD-0005gE-Ff for Xen-devel@lists.xen.org; Mon, 04 Apr 2016 19:38:13 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id A8/AB-23864-4A2C2075; Mon, 04 Apr 2016 19:38:12 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRWlGSWpSXmKPExsXip5dQoLvkEFO 4wa0vnBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa0b/DZaCX8IVp34uYWlgbBHsYuTgkBDQlXjT p9PFyMUhJLCFUeL7v7PsEM48JomVh7exdDFyAjkZEpuv7GEGsVkEVCTWbdzBCmKzAdlLz9xiA rFFBAIlLn97zALSzCzQzizxYeZiRpCEsECixLFdH8CaeQW0JOb/mscCseEjs8TZDWfYIRKCEi dnPgHbxiygLvFn3iVmkPOYBaQllv/jAAlzCrhInJuzmx0kLAq0+NXB+gmMArOQNM9C0jwLoXk BI/MqRvXi1KKy1CJdY72kosz0jJLcxMwcXUMDY73c1OLixPTUnMSkYr3k/NxNjMDAZACCHYzN X5wOMUpyMCmJ8rpXMYUL8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuCddRAoJ1iUmp5akZaZA4wRm LQEB4+SCG8gSJq3uCAxtzgzHSJ1ilFRSpzXFCQhAJLIKM2Da4PF5SVGWSlhXkagQ4R4ClKLcj NLUOVfMYpzMCoJ8waATOHJzCuBm/4KaDET0OJ6YbDFJYkIKakGxpVXub5/3hn3p9+effH03ss LJj+b5Fsznz/D1WG+uVeZy5FCXYfbdcW3pVzea8/O3qj2udDEZfsEBbdN4o8k4t1VbZYveJZz vM3C3Y3VIOMSZ6+9c4c6/77ND25ccH67jVkocxaDLOML7Z25dvcPXGJJbT/bfGxf3o6MnJiiy Es226e9ffNqmRJLcUaioRZzUXEiAOxil/bGAgAA X-Env-Sender: bp@alien8.de X-Msg-Ref: server-14.tower-31.messagelabs.com!1459798692!32924441!1 X-Originating-IP: [78.46.96.112] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8333 invoked from network); 4 Apr 2016 19:38:12 -0000 Received: from mail.skyhub.de (HELO mail.skyhub.de) (78.46.96.112) by server-14.tower-31.messagelabs.com with SMTP; 4 Apr 2016 19:38:12 -0000 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id GPOeQPP5SKb9; Mon, 4 Apr 2016 21:38:11 +0200 (CEST) Received: from pd.tnic (p5DDC51EF.dip0.t-ipconnect.de [93.220.81.239]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 0E6F3245A95; Mon, 4 Apr 2016 21:38:11 +0200 (CEST) Received: by pd.tnic (Postfix, from userid 1000) id 834421617AB; Mon, 4 Apr 2016 21:38:03 +0200 (CEST) Date: Mon, 4 Apr 2016 21:38:03 +0200 From: Borislav Petkov To: Peter Zijlstra , Andy Lutomirski Message-ID: <20160404193803.GK351@pd.tnic> References: <4085070316fc3ab29538d3fcfe282648d1d4ee2e.1459605520.git.luto@kernel.org> <20160402183919.GA2538@pd.tnic> <20160402204752.GC2538@pd.tnic> <20160404115206.GG8372@quack.suse.cz> <20160404160042.GB3448@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160404160042.GB3448@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Cc: Jan Kara , KVM list , Linus Torvalds , X86 ML , "linux-kernel@vger.kernel.org" , Petr Mladek , xen-devel , Paolo Bonzini , Andrew Morton , Arjan van de Ven Subject: Re: [Xen-devel] [PATCH v5 3/9] x86/head: Move early exception panic code into early_fixup_exception X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Apr 04, 2016 at 06:00:42PM +0200, Peter Zijlstra wrote: > On Mon, Apr 04, 2016 at 08:32:21AM -0700, Andy Lutomirski wrote: > > > Adding locking would be easy enough, wouldn't it? > > See patch in this thread.. > > > But do any platforms really boot a second CPU before switching to real > > printk? > > I _only_ use early_printk() as printk() is a quagmire of fail :-) And since I'm the king of minimalistic changes... this below works. However, the problem is that we need to pull up all that early_param parsing in order to enable the early console, i.e. "earlyprintk=ttyS0,115200" cmdline parsing. And we can do all that after having setup the IDT. So I'd need to do some early dancing with cmdline_find_option_bool(boot_command_line, ... in asm or so. Need to think about it more. diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 1f4422d5c8d0..ad534226653b 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -130,6 +130,13 @@ static void __init copy_bootdata(char *real_mode_data) } } +static int _early_printk(const char *fmt, va_list args) +{ + early_printk(fmt, args); + + return 0; +} + asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) { int i; @@ -164,6 +171,10 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) load_idt((const struct desc_ptr *)&idt_descr); copy_bootdata(__va(real_mode_data)); + parse_early_param(); + this_cpu_write(printk_func, _early_printk); + + printk("This is a test!\n"); /* * Load microcode early on BSP. diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 2367ae07eb76..998d6c675549 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -882,6 +882,7 @@ void __init setup_arch(char **cmdline_p) */ __flush_tlb_all(); #else + this_cpu_write(printk_func, vprintk_default); printk(KERN_INFO "Command line: %s\n", boot_command_line); #endif diff --git a/include/linux/printk.h b/include/linux/printk.h index 9ccbdf2c1453..97df81c97b2f 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -169,6 +169,7 @@ void __init setup_log_buf(int early); __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...); void dump_stack_print_info(const char *log_lvl); void show_regs_print_info(const char *log_lvl); +int vprintk_default(const char *fmt, va_list args); #else static inline __printf(1, 0) int vprintk(const char *s, va_list args)