Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753541AbdGNFyX (ORCPT ); Fri, 14 Jul 2017 01:54:23 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:5407 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753487AbdGNFyU (ORCPT ); Fri, 14 Jul 2017 01:54:20 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="21279637" From: Dou Liyang To: , CC: , , , , , , , , Dou Liyang Subject: [PATCH v7 11/13] x86/time: Initialize interrupt mode behind timer init Date: Fri, 14 Jul 2017 13:52:32 +0800 Message-ID: <1500011554-9784-12-git-send-email-douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1500011554-9784-1-git-send-email-douly.fnst@cn.fujitsu.com> References: <1500011554-9784-1-git-send-email-douly.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: B27C946B5249.AE74C X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2209 Lines: 78 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 c5526eb..9503838 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2473,8 +2473,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 6045074..913b595 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 e0754cd..3ceb834 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(); } -- 2.5.5