From patchwork Fri Jun 30 04:07:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dou Liyang X-Patchwork-Id: 9818973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8447460224 for ; Fri, 30 Jun 2017 09:20:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74912285FB for ; Fri, 30 Jun 2017 09:20:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67F7D28607; Fri, 30 Jun 2017 09:20:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id DA4EB285FB for ; Fri, 30 Jun 2017 09:20:58 +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 1dQs4C-0005Wz-2j; Fri, 30 Jun 2017 09:18:20 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQnEG-0008MB-E8 for xen-devel@lists.xenproject.org; Fri, 30 Jun 2017 04:08:24 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id AF/85-01724-7BEC5595; Fri, 30 Jun 2017 04:08:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGIsWRWlGSWpSXmKPExsViPb2gRXf7udB Igw1HmCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyGo91sBUcEK5Zudm1g/MnXxcjJISHgJzFl 8gdGEFtIoFZi6vITzF2MXED2SkaJ1rZtLBDOcUaJKWfXs4NUsQnoSJxpfgBmiwiES6xd280GU sQs8IxR4tPPH2CjhAX8JSbcWsACYrMIqEpc/POKGcTmFYiXmPe5hxVitZzEti17wOo5BWwlll x5zg5xho3Eo13dTBD1ghInZz4Bm8MsICFx8MULZoheJYnX6w6wQNi6EhOWdjJC2JoS21afY4O wzSSO7PwPtUtQYufzC2wTGEVmIRk7C8nYBYxMqxjVi1OLylKLdI31kooy0zNKchMzc3QNDYz1 clOLixPTU3MSk4r1kvNzNzECw5wBCHYwNn9xOsQoycGkJMp7blFopBBfUn5KZUZicUZ8UWlOa vEhRhkODiUJ3ttngHKCRanpqRVpmTnAiINJS3DwKInwCiwBSvMWFyTmFmemQ6ROMepyHJvx8x uTEEtefl6qlDjvzLNARQIgRRmleXAjYNF/iVFWSpiXEegoIZ6C1KLczBJU+VeM4hyMSsK8PCB TeDLzSuA2vQI6ggnoCOEZISBHlCQipKQaGKe+6D5/9IDjfianJQdOBfga/yk4ZL9TNXP/1fsf 7KYEee76l2DlPPndbsm46uQH134JPefaLbdtBt+elMMiHH/5f05eK5dyqfrJJVXbnS+ailbuX znN85m/gFvo2bp7kcuWfXh8Y5q/HAu3+WpHHdclB76pVacKWD0rMRIOsFnnwH7tzwd1/0wllu KMREMt5qLiRADHGnA0+QIAAA== X-Env-Sender: douly.fnst@cn.fujitsu.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1498795676!103343434!2 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21327 invoked from network); 30 Jun 2017 04:08:21 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-8.tower-31.messagelabs.com with SMTP; 30 Jun 2017 04:08:21 -0000 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="20680364" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 30 Jun 2017 12:08:20 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id B503146B53F6; Fri, 30 Jun 2017 12:08:22 +0800 (CST) Received: from localhost.localdomain.localdomain (10.167.226.106) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 30 Jun 2017 12:08:21 +0800 From: Dou Liyang To: , , Date: Fri, 30 Jun 2017 12:07:39 +0800 Message-ID: X-Mailer: git-send-email 2.5.5 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: B503146B53F6.A1912 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com X-Mailman-Approved-At: Fri, 30 Jun 2017 09:18:16 +0000 Cc: Dou Liyang , bhe@redhat.com, peterz@infradead.org, mingo@kernel.org, ebiederm@xmission.com, hpa@zytor.com, izumi.taku@jp.fujitsu.com, boris.ostrovsky@oracle.com, tglx@linutronix.de Subject: [Xen-devel] [PATCH v5 11/12] x86/time: Initialize interrupt mode behind timer init 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-Virus-Scanned: ClamAV using ClamSMTP In start_kernel(), firstly, it works on the default interrupy mode, then switch to the final mode. Normally, Booting with BIOS reset is OK. But, At dump-capture kernel, it boot up without BIOS reset, default mode may not be compatible with the actual registers, that causes the delivery interrupt to fail. Try to set up the final mode as soon as possible. according to the parts which split from that initialization: 1) Set up the APIC/IOAPIC (including testing whether the timer interrupt works) 2) Calibrate TSC 3) Set up the local APIC timer -- From Thomas Gleixner Initializing the mode should be earlier than calibrating TSC as soon as possible and needs testing whether the timer interrupt works at the same time. call it behind timers init, which meets the above conditions. Signed-off-by: Dou Liyang --- arch/x86/kernel/apic/apic.c | 2 -- arch/x86/kernel/smpboot.c | 2 -- arch/x86/kernel/time.c | 5 +++++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 51204d4..d4722c2 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2387,8 +2387,6 @@ void __init apic_bsp_setup(bool upmode) #ifdef CONFIG_UP_LATE_INIT void __init up_late_init(void) { - x86_init.irqs.intr_mode_init(); - if (apic_intr_mode == APIC_PIC) return; diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 80d25fe..d1185dd 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1287,8 +1287,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) set_sched_topology(x86_topology); set_cpu_sibling_map(0); - - x86_init.irqs.intr_mode_init(); smp_sanity_check(); switch (apic_intr_mode) { diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c index d39c091..0f04d4b 100644 --- a/arch/x86/kernel/time.c +++ b/arch/x86/kernel/time.c @@ -84,6 +84,11 @@ void __init hpet_time_init(void) static __init void x86_late_time_init(void) { x86_init.timers.timer_init(); + /* + * After PIT/HPET timers init, select and setup + * the final interrupt mode for delivering IRQs. + */ + x86_init.irqs.intr_mode_init(); tsc_init(); }