From patchwork Mon Jul 3 11:07:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dou Liyang X-Patchwork-Id: 9822521 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 128A860246 for ; Mon, 3 Jul 2017 11:10:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 045552817F for ; Mon, 3 Jul 2017 11:10:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3486283AD; Mon, 3 Jul 2017 11:10:15 +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 88A4B2817F for ; Mon, 3 Jul 2017 11:10:15 +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 1dRzDH-00067w-Dt; Mon, 03 Jul 2017 11:08:19 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRzDG-00065Y-5J for xen-devel@lists.xenproject.org; Mon, 03 Jul 2017 11:08:18 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 64/15-03577-1A52A595; Mon, 03 Jul 2017 11:08:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGIsWRWlGSWpSXmKPExsViPb2gRXeBalS kwaHblhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aDydeYChYJVlz9fIS5gfEGXxcjJ4eEgJ/E +YcdbCC2kECtxLs5D1i7GLmA7JWMEovO/GaHcI4xSqy8t5wdpIpNQEfiTPMDMFtEIFxi7dpuN pAiZoFnjBKffv5gBEkIC/hL/Jr4EsxmEVCRePz3IROIzSsQL3Fky0VmiNVyEtu27AGr4RSwlZ jUcpkF4gwbiTutzYwQ9YISJ2c+AYszC0hIHHzxAqpXSeL1ugNAcQ4gW1fiwSuosKbEttXn2CB sM4kjO/+zQtiCEjufX2CbwCgyC8nUWUimLmBkWsWoXpxaVJZapGukl1SUmZ5RkpuYmaNraGCm l5taXJyYnpqTmFSsl5yfu4kRGOYMQLCDcdlfp0OMkhxMSqK8rjcjI4X4kvJTKjMSizPii0pzU osPMcpwcChJ8H5TjooUEixKTU+tSMvMAUYcTFqCg0dJhPfAPaBW3uKCxNzizHSI1ClGXY5XE/ 5/YxJiycvPS5US52VXAZohAFKUUZoHNwIW/ZcYZaWEeRmBjhLiKUgtys0sQZV/xSjOwagkzPs J5BKezLwSuE2vgI5gAjqioScC5IiSRISUVAMje+9f3lUeMSfZ9O1W5miVSp1584X3aneq6qOS lVv/V90W1LweUBz+YmGTfmGJgEWhkoGklFEGx8nPbQ7K+/MvVTn+U5vZ9L4pucVlw/75zv02e zRFbVVuClwSN7f44z+h9/UVT7/nLXu8W+0e6bJvdEtl8l0QYBpvHTyPdaavjLLK44rwDUosxR mJhlrMRcWJAO8Qawz5AgAA X-Env-Sender: douly.fnst@cn.fujitsu.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1499080090!71304599!1 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.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27662 invoked from network); 3 Jul 2017 11:08:13 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-8.tower-21.messagelabs.com with SMTP; 3 Jul 2017 11:08:13 -0000 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="20783675" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 03 Jul 2017 19:08:11 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 2630C4801982; Mon, 3 Jul 2017 19:08:09 +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; Mon, 3 Jul 2017 19:08:13 +0800 From: Dou Liyang To: , , Date: Mon, 3 Jul 2017 19:07:31 +0800 Message-ID: <4eb4c624512dd695056759f86e84cdcb39bf56fb.1499074568.git.douly.fnst@cn.fujitsu.com> 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: 2630C4801982.A1196 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com 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 v6 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 9573c14..2707aa2 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2384,8 +2384,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 208f4f3..a26d12c 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1289,8 +1289,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) 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(); }