From: Jiang Liu <liuj97@gmail.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Jiang Liu <jiang.liu@huawei.com>,
Suresh Siddha <suresh.b.siddha@intel.com>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Ashok Raj <ashok.raj@intel.com>,
linux-pci@vger.kernel.org, chenkeping@huawei.com
Subject: [PATCH 3/6] x86,IRQ: Enhance irq allocation policy for hot-added IOAPICs
Date: Wed, 21 Mar 2012 00:21:00 +0800 [thread overview]
Message-ID: <1332260463-13924-5-git-send-email-jiang.liu@huawei.com> (raw)
In-Reply-To: <1332260463-13924-1-git-send-email-jiang.liu@huawei.com>
In-Reply-To: <CAE9FiQXC7T7JQRfiry8nHaRYN3ggy9vfzc2jDUzar80hv6pEvw@mail.gmail.com>
For hot-added IOAPICs, try to allocate irqs starting from
ioapic->gsi_base first, and fallback to starting from 0.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
---
arch/x86/kernel/apic/io_apic.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 622374f..e5b6ca4 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -294,13 +294,16 @@ static struct irq_cfg *realloc_irq_and_cfg_at(unsigned int at, int node)
return alloc_irq_and_cfg_at(at, node);
}
-static int reserve_ioapic_gsi_irq_base(int idx)
+static int reserve_ioapic_gsi_irq_base(int idx, bool hotadd)
{
int irq;
struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(idx);
int cnt = gsi_cfg->gsi_end - gsi_cfg->gsi_base + 1;
irq = __irq_reserve_irqs(-1, gsi_cfg->gsi_base, cnt);
+ if (irq < 0 && hotadd)
+ irq = __irq_reserve_irqs(-1, 0, cnt);
+
if (irq >= 0) {
gsi_cfg->irq_base = irq;
printk(KERN_INFO
@@ -378,7 +381,7 @@ int __init arch_early_irq_init(void)
alloc_ioapic_saved_registers(i);
for (i = 0; i < nr_ioapics; i++)
- reserve_ioapic_gsi_irq_base(i);
+ reserve_ioapic_gsi_irq_base(i, false);
reserve_ioapic_gsi_irq_extra();
@@ -4181,7 +4184,7 @@ int __mp_register_ioapic(int id, u32 address, u32 gsi_base, bool hotadd)
if (gsi_cfg->gsi_end >= gsi_top)
gsi_top = gsi_cfg->gsi_end + 1;
} else {
- int irq = reserve_ioapic_gsi_irq_base(idx);
+ int irq = reserve_ioapic_gsi_irq_base(idx, true);
if (irq < 0)
goto failed;
--
1.7.5.4
next prev parent reply other threads:[~2012-03-20 16:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAE9FiQXC7T7JQRfiry8nHaRYN3ggy9vfzc2jDUzar80hv6pEvw@mail.gmail.com>
2012-03-20 16:20 ` [PATCH 0/6] Improvements to Yinghai's x86 IOAPIC hotplug work Jiang Liu
2012-03-20 16:20 ` [PATCH 0/5] Improvements to Yinghai's IOAPIC hotplug work on x86 Jiang Liu
2012-03-20 16:20 ` [PATCH 1/6] x86,IRQ: Fix possible invalid memory access after IOAPIC hot-plugging Jiang Liu
2012-03-20 16:20 ` [PATCH 2/6] x86,IRQ: Mark unused entries in 'ioapics' array as free at startup Jiang Liu
2012-03-21 3:25 ` Yinghai Lu
2012-03-21 3:32 ` Jiang Liu
2012-03-21 14:56 ` Jiang Liu
2012-03-20 16:21 ` Jiang Liu [this message]
2012-03-20 16:21 ` [PATCH 4/6] x86,IRQ: split out function ioapic_setup_resource() Jiang Liu
2012-03-21 3:34 ` Yinghai Lu
2012-03-21 3:43 ` Jiang Liu
2012-03-20 16:21 ` [PATCH 5/6] x86,IRQ: Correctly manage MMIO resource used by IOAPIC when hot-plugging IOPAICs Jiang Liu
2012-03-20 16:21 ` [PATCH 6/6] x86,IRQ: Use memory barriers to protect searching side code Jiang Liu
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=1332260463-13924-5-git-send-email-jiang.liu@huawei.com \
--to=liuj97@gmail.com \
--cc=ashok.raj@intel.com \
--cc=bhelgaas@google.com \
--cc=chenkeping@huawei.com \
--cc=jbarnes@virtuousgeek.org \
--cc=jiang.liu@huawei.com \
--cc=linux-pci@vger.kernel.org \
--cc=suresh.b.siddha@intel.com \
--cc=yinghai@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;
as well as URLs for NNTP newsgroup(s).