From: Dou Liyang <douly.fnst@cn.fujitsu.com>
To: <x86@kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <tglx@linutronix.de>, <mingo@kernel.org>, <hpa@zytor.com>,
<ebiederm@xmission.com>, <bhe@redhat.com>,
<izumi.taku@jp.fujitsu.com>,
Dou Liyang <douly.fnst@cn.fujitsu.com>
Subject: [RFC PATCH v3 00/12] Unify interrupt mode and setup it as soon as possible
Date: Wed, 10 May 2017 21:44:37 +0800 [thread overview]
Message-ID: <1494423889-25799-1-git-send-email-douly.fnst@cn.fujitsu.com> (raw)
According to Ingo's and Eric's advice[1,2], Try my best to optimize the
init of interrupt delivery mode for x86.
MP specification defines three different interrupt modes as follows:
1. PIC Mode
2. Virtual Wire Mode
3. Symmetric I/O Mode
Currently, in kernel,
1. Setup Virtual Wire Mode during IRQ initialization( step 1
in the following figure).
2. Enable and Setup Symmetric I/O Mode either during the
SMP-capable 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 patches is unifying these setup steps and executing
as soon as possible as follows:
start_kernel
---------------+
|
|
|
| x86_late_time_init
+---->---+------------+
| |
| | +------------------------+
| +----> | 4. init_interrupt_mode |
| +------------------------+
v
And construct a selector to wrap all the switches and make them
maintain and read easily.
Original:
+-----------------------------------------------------+
| smp_found_config || !boot_cpu_has(X86_FEATURE_APIC) |
+-----------------------------------------------------+
|true, PIC MODE |false, VIRTUAL WIRE MODE
| |
+--v-----------------v-----------+
|!smp_found_config && !acpi_lapic+-----+
+--------------------------------+ |
|false |
| |
+--v----------------------------+ |
|!boot_cpu_has(X86_FEATURE_APIC)+ true |
+------------------+------------+ |
|false | |
v | +------v-----+ true
SYMMETRIC IO MODE | |disable_apic+------> PIC MODE
| +------------+
|true |false
| +---v---------------------------+
+------v------+ |!boot_cpu_has(X86_FEATURE_APIC)|
|!disable_apic| +---------------------------+---+
+------+------+ |false |true
| +----v------------+ v
v |!smp_found_config+----+ PIC MODE
PIC MODE +-----------------+ |
|false |true
v v
SYMMETRIC IO MODE VIRTUAL WIRE MODE
Now:
+------------+
|disable_apic+--------------------+
+------------+ true |
|false |
| |
+------------v------------------+ |
|!boot_cpu_has(X86_FEATURE_APIC)+-------+
+-------------------------------+ true |
|false |
| |
+-------v---------+ v
|!smp_found_config| PIC MODE
+---------------+-+
|false |true
| |
v +---v---------+
SYMMETRIC IO MODE | !acpi_lapic |
+------+------+
|
v
VIRTUAL WIRE MODE
By the way, Also fix a bug about kexec[3].
[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
Changes V2 --> V3:
- Rebase the patches.
- Change two function name:
apic_bsp_mode_check --> apic_interrupt_mode_select
init_interrupt_mode --> apic_interrupt_mode_init
- Find a new waiting way to check whether timer IRQs work or not
- Refine the switch logic in apic_interrupt_mode_init()
- Consistently start sentences with upper case letters
- Fix some typos and comments
- Try my best to rewrite some changelog again
Changes since V1:
- Move the initialization from init_IRQ() to x86_late_time_init()
- Use a threshold to refactor the check logic in timer_irq_works()
- Rename the framework to a selector
- Split two patches
- Consistently start sentences with upper case letters
- Fix some typos
- Rewrite the changelog
Dou Liyang (12):
x86/apic: Replace init_bsp_APIC() with apic_virtual_wire_mode_setup()
x86/apic: Construct a selector for the interrupt delivery mode
x86/apic: Prepare for unifying the interrupt delivery modes setup
x86/time: Initialize interrupt mode behind timer init
x86/ioapic: Refactor the delay logic in timer_irq_works()
x86/apic: Split local APIC timer setup from the APIC setup
x86/apic: Move the logical APIC ID setup from apic_bsp_setup()
x86/apic: Make interrupt mode setup earlier for SMP-capable system
x86/apic: Setup interrupt mode earlier in case of no SMP motherboard
x86/apic: Make the interrupt mode setup earlier for UP system
x86/apic: Mark the apic_interrupt_mode extern for disable_smp()
x86/apic: Remove the apic_virtual_wire_mode_setup()
arch/x86/include/asm/apic.h | 15 +++-
arch/x86/kernel/apic/apic.c | 185 +++++++++++++++++++++--------------------
arch/x86/kernel/apic/io_apic.c | 46 +++++++++-
arch/x86/kernel/irqinit.c | 3 -
arch/x86/kernel/smpboot.c | 65 ++++-----------
arch/x86/kernel/time.c | 8 ++
6 files changed, 174 insertions(+), 148 deletions(-)
--
2.5.5
next reply other threads:[~2017-05-10 13:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 13:44 Dou Liyang [this message]
2017-05-10 13:44 ` [RFC PATCH v3 01/12] x86/apic: Replace init_bsp_APIC() with apic_virtual_wire_mode_setup() Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 02/12] x86/apic: Construct a selector for the interrupt delivery mode Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 03/12] x86/apic: Prepare for unifying the interrupt delivery modes setup Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 04/12] x86/time: Initialize interrupt mode behind timer init Dou Liyang
2017-06-06 6:00 ` [RFC PATCH v4 " Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 05/12] x86/ioapic: Refactor the delay logic in timer_irq_works() Dou Liyang
2017-05-26 8:10 ` [RFC PATCH v4 " Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 06/12] x86/apic: Split local APIC timer setup from the APIC setup Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 07/12] x86/apic: Move the logical APIC ID setup from apic_bsp_setup() Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 08/12] x86/apic: Make interrupt mode setup earlier for SMP-capable system Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 09/12] x86/apic: Setup interrupt mode earlier in case of no SMP motherboard Dou Liyang
2017-05-12 9:55 ` [RFC PATCH v4 " Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 10/12] x86/apic: Make the interrupt mode setup earlier for UP system Dou Liyang
2017-05-11 10:57 ` [RFC PATCH v4 " Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 11/12] x86/apic: Mark the apic_interrupt_mode extern for disable_smp() Dou Liyang
2017-05-10 13:44 ` [RFC PATCH v3 12/12] x86/apic: Remove the apic_virtual_wire_mode_setup() Dou Liyang
2017-05-22 20:23 ` [RFC PATCH v3 00/12] Unify interrupt mode and setup it as soon as possible Thomas Gleixner
2017-05-23 1:29 ` Dou Liyang
2017-06-06 6:50 ` Dou Liyang
2017-06-26 10:08 ` Dou Liyang
2017-06-26 11:50 ` Thomas Gleixner
2017-06-27 1:50 ` Dou Liyang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1494423889-25799-1-git-send-email-douly.fnst@cn.fujitsu.com \
--to=douly.fnst@cn.fujitsu.com \
--cc=bhe@redhat.com \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®