mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: the arch/x86 maintainers <x86@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Xen-devel <xen-devel@lists.xensource.com>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Subject: [PATCH 14/17] xen: dynamically allocate irq & event structures
Date: Fri, 13 Mar 2009 09:42:35 -0700	[thread overview]
Message-ID: <1236962558-13748-15-git-send-email-jeremy@goop.org> (raw)
In-Reply-To: <1236962558-13748-1-git-send-email-jeremy@goop.org>

From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>

Impact: reduce memory usage

Dynamically allocate the irq_info and evtchn_to_irq arrays, so that
1) the irq_info array scales to the actual number of possible irqs,
and 2) we don't needlessly increase the static size of the kernel
when we aren't running under Xen.

Derived on patch from Mike Travis <travis@sgi.com>.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 drivers/xen/events.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 3cf0a1b..e8f08c0 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -27,6 +27,7 @@
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/bootmem.h>
+#include <linux/irqnr.h>
 
 #include <asm/ptrace.h>
 #include <asm/irq.h>
@@ -91,11 +92,9 @@ struct irq_info
 };
 #define PIRQ_NEEDS_EOI	(1 << 0)
 
-static struct irq_info irq_info[NR_IRQS];
+static struct irq_info *irq_info;
 
-static int evtchn_to_irq[NR_EVENT_CHANNELS] = {
-	[0 ... NR_EVENT_CHANNELS-1] = -1
-};
+static int *evtchn_to_irq;
 struct cpu_evtchn_s {
 	unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG];
 };
@@ -509,7 +508,7 @@ static int find_irq_by_gsi(unsigned gsi)
 {
 	int irq;
 
-	for(irq = 0; irq < NR_IRQS; irq++) {
+	for(irq = 0; irq < nr_irqs; irq++) {
 		struct irq_info *info = info_for_irq(irq);
 
 		if (info == NULL || info->type != IRQT_PIRQ)
@@ -1174,7 +1173,11 @@ void __init xen_init_IRQ(void)
 	size_t size = nr_cpu_ids * sizeof(struct cpu_evtchn_s);
 
 	cpu_evtchn_mask_p = alloc_bootmem(size);
-	BUG_ON(cpu_evtchn_mask_p == NULL);
+	irq_info = alloc_bootmem(nr_irqs * sizeof(*irq_info));
+
+	evtchn_to_irq = alloc_bootmem(NR_EVENT_CHANNELS * sizeof(*evtchn_to_irq));
+	for(i = 0; i < NR_EVENT_CHANNELS; i++)
+		evtchn_to_irq[i] = -1;
 
 	init_evtchn_cpu_bindings();
 
-- 
1.6.0.6


  parent reply	other threads:[~2009-03-13 16:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13 16:42 [GIT PULL] Xen dom0 apic changes Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 01/17] xen/dom0: handle acpi lapic parsing in Xen dom0 Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 02/17] xen: hook io_apic read/write operations Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 03/17] xen: create dummy ioapic mapping Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 04/17] xen: implement pirq type event channels Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 05/17] x86/io_apic: add get_nr_irqs_gsi() Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 06/17] xen/apic: identity map gsi->irqs Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 07/17] xen: direct irq registration to pirq event channels Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 08/17] xen: bind pirq to vector and event channel Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 09/17] xen: pre-initialize legacy irqs early Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 10/17] xen/apic: program the apic triggering and polarity properly Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 11/17] xen: don't setup acpi interrupt unless there is one Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 12/17] xen: use acpi_get_override_irq() to get triggering for legacy irqs Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 13/17] xen: initialize irq 0 too Jeremy Fitzhardinge
2009-03-13 16:42 ` Jeremy Fitzhardinge [this message]
2009-03-13 16:42 ` [PATCH 15/17] xen: set pirq name to something useful Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 16/17] xen: fix legacy irq setup, make ioapic-less machines work Jeremy Fitzhardinge
2009-03-13 16:42 ` [PATCH 17/17] xen: disable MSI Jeremy Fitzhardinge
2009-05-12 23:25 [GIT PULL] Xen APIC hooks (with io_apic_ops) Jeremy Fitzhardinge
2009-05-12 23:25 ` [PATCH 14/17] xen: dynamically allocate irq & event structures Jeremy Fitzhardinge
2009-05-27  7:37 [GIT PULL REPOST] xen/dom0/apic-ops: Xen dom0 APIC changes Jeremy Fitzhardinge
2009-05-27  7:37 ` [PATCH 14/17] xen: dynamically allocate irq & event structures Jeremy Fitzhardinge

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=1236962558-13748-15-git-send-email-jeremy@goop.org \
    --to=jeremy@goop.org \
    --cc=hpa@zytor.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /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®