From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753411AbdC3CI3 (ORCPT ); Wed, 29 Mar 2017 22:08:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36388 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752832AbdC3CI1 (ORCPT ); Wed, 29 Mar 2017 22:08:27 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F232DC04B945 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=bhe@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com F232DC04B945 Date: Thu, 30 Mar 2017 10:08:21 +0800 From: Baoquan He To: Dou Liyang Cc: x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, ebiederm@xmission.com, hpa@zytor.com, izumi.taku@jp.fujitsu.com, joro@8types.org Subject: Re: [RFC PATCH 0/6] Unify the Interrupt Mode and setup it as soon as possible Message-ID: <20170330020821.GC8303@x1> References: <1490799333-18242-1-git-send-email-douly.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490799333-18242-1-git-send-email-douly.fnst@cn.fujitsu.com> User-Agent: Mutt/1.7.0 (2016-08-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 30 Mar 2017 02:08:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Liyang, This is awesome. I planned to do this after kaslr back porting, glad to see your posting. I like below diagram and the idea of patch 2/6 framework. Will review and see what I can do to help since rhel bug from FJ is assigned to me. Thanks for the effort! And add Joerg to this thread since he knows IOMMU very well. Thanks Baoquan On 03/29/17 at 10:55pm, Dou Liyang wrote: > According to Ingo's and Eric's advice[1,2], Try my best to optimize the > init of Interrupt Mode for x86. > > The MP specification defines three different interrupt modes as follows: > > 1. PIC Mode > 2. Virtual Wire Mode > 3. Symmetic I/O Mode > > Currently, In kernel, > > 1. Setup the Virtual Wire Mode during the IRQ initialization( > step 1 in the following figure). > 2. Enable and Setup the Symmetic I/O Mode either during the > SMP-capabe system prepares CPUs(step 2) or during the UP system > initializes itself(step 3). > > start_kernel > +---------------+ > | > +--> ....... > | > | setup_arch > +--> +-------+ > | > | init_IRQ > +-> +--+-----+ > | | init_ISA_irqs > | +------> +-+--------+ > | | +----------------+ > +---> +------> | 1.init_bsp_APIC| > | ....... +----------------+ > +---> > | rest_init > +--->---+-----+ > | | kernel_init > | +> ----+-----+ > | | kernel_init_freeable > | +-> ----+-------------+ > | | smp_prepare_cpus > | +---> +----+---------+ > | | | +-------------------+ > | | +-> |2. apic_bsp_setup | > | | +-------------------+ > | | > v | smp_init > +---> +---+----+ > | +-------------------+ > +--> |3. apic_bsp_setup | > +-------------------+ > > The purpose of this patchset is Unifing these setup steps and executing as > soon as possible as follows: > > start_kernel > ---------------+ > | > | > | > | init_IRQ > +---->---+----+ > | | > | | +--------------------+ > | +----> | 4. init_bsp_APIC | > | +--------------------+ > v > > By the way, Also fix a bug about kexec[3]. > > > Some doubts, need help: > > 1. Patchset has influence on IOMMU in enable_IR_x2apic(). Not sure > it can be in advance? > > 2. Due to > > Commit 8c3ba8d04924 ("x86, apic: ack all pending irqs when crashed/on kexec") > > ..., patchset also needs TSC and uses the "cpu_khz" in setup_local_APIC(). > And a warning[4] will be triggered when crashed/on kexec. Not sure how to > modify? > > [1]. https://lkml.org/lkml/2016/8/2/929 > [2]. https://lkml.org/lkml/2016/8/1/506 > [3]. https://lkml.org/lkml/2016/7/25/1118 > [4]. WARN_ON(max_loops <= 0) in setup_local_APIC() > > Dou Liyang (6): > x86/apic: Replace init_bsp_APIC() with apic_virture_wire_mode_setup() > x86/apic: Construct a framework for setuping APIC mode as soon as > possible > x86/apic: Extract APIC timer related code from apic_bsp_setup() > x86/apic: Make the APIC mode setup earlier for SMP-capable system > x86/apic: Make the APIC mode setup earlier for UP system > x86/apic: Remove the apic_virture_wire_mode_setup() > > arch/x86/include/asm/apic.h | 7 +- > arch/x86/include/asm/io_apic.h | 2 + > arch/x86/kernel/apic/apic.c | 218 ++++++++++++++++++++++++----------------- > arch/x86/kernel/apic/io_apic.c | 4 +- > arch/x86/kernel/irqinit.c | 6 +- > arch/x86/kernel/smpboot.c | 68 ++----------- > 6 files changed, 149 insertions(+), 156 deletions(-) > > -- > 2.5.5 > > >