From: Mike Travis <travis@sgi.com>
To: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@linux-foundation.org>
Cc: davej@codemonkey.org.uk, David Miller <davem@davemloft.net>,
Eric Dumazet <dada1@cosmosbay.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Jack Steiner <steiner@sgi.com>,
Jeremy Fitzhardinge <jeremy@goop.org>, Jes Sorensen <jes@sgi.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: [RFC 11/13] genapic: reduce stack pressuge in io_apic.c step 3 target_cpus
Date: Sat, 06 Sep 2008 16:50:47 -0700 [thread overview]
Message-ID: <20080906235038.421559000@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: 20080906235036.891970000@polaris-admin.engr.sgi.com
[-- Attachment #1: stack-hogs-io_apic_c-step-3-target_cpus --]
[-- Type: text/plain, Size: 8323 bytes --]
* Step 3 "target_cpus" of cleaning up io_apic.c modifies the TARGET_CPUS
interface to pass a pointer to the returned mask for arch X86_64,
removing yet another "cpumask_t variable on the stack".
target_cpus = TARGET_CPUS;
becomes:
TARGET_CPUS(target_cpus);
For x86_32 this is expanded to:
target_cpus = (genapic->target_cpus());
For x86_64 this is expanded to:
target_cpus = (genapic->target_cpus)(&(target_cpus));
* All the appropriate genapic "target_cpus" functions are modified
to use this new interface.
* Note that arch-i386-gcc had trouble with the name of the variables
being "target_cpus" (conflicted with the macro TARGET_CPUS expanding
to (target_cpus()), so they are now "tgt_cpus".
Applies to linux-2.6.tip/master.
Signed-off-by: Mike Travis <travis@sgi.com>
---
arch/x86/kernel/genapic_flat_64.c | 8 ++++----
arch/x86/kernel/genx2apic_cluster.c | 4 ++--
arch/x86/kernel/genx2apic_phys.c | 4 ++--
arch/x86/kernel/genx2apic_uv_x.c | 4 ++--
arch/x86/kernel/io_apic.c | 16 ++++++++--------
include/asm-x86/genapic_64.h | 2 +-
include/asm-x86/mach-default/mach_apic.h | 28 +++++++++++++++++-----------
include/asm-x86/mach-generic/mach_apic.h | 6 +++++-
8 files changed, 41 insertions(+), 31 deletions(-)
--- linux-2.6.tip.orig/arch/x86/kernel/genapic_flat_64.c
+++ linux-2.6.tip/arch/x86/kernel/genapic_flat_64.c
@@ -31,9 +31,9 @@ static int __init flat_acpi_madt_oem_che
return 1;
}
-static cpumask_t flat_target_cpus(void)
+static void flat_target_cpus(cpumask_t *retmask)
{
- return cpu_online_map;
+ *retmask = cpu_online_map;
}
static cpumask_t flat_vector_allocation_domain(int cpu)
@@ -194,9 +194,9 @@ static int __init physflat_acpi_madt_oem
return 0;
}
-static cpumask_t physflat_target_cpus(void)
+static void physflat_target_cpus(cpumask_t *retmask)
{
- return cpu_online_map;
+ *retmask = cpu_online_map;
}
static cpumask_t physflat_vector_allocation_domain(int cpu)
--- linux-2.6.tip.orig/arch/x86/kernel/genx2apic_cluster.c
+++ linux-2.6.tip/arch/x86/kernel/genx2apic_cluster.c
@@ -23,9 +23,9 @@ static int __init x2apic_acpi_madt_oem_c
/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */
-static cpumask_t x2apic_target_cpus(void)
+static void x2apic_target_cpus(cpumask_t *retmask)
{
- return cpumask_of_cpu(0);
+ *retmask = cpumask_of_cpu(0);
}
/*
--- linux-2.6.tip.orig/arch/x86/kernel/genx2apic_phys.c
+++ linux-2.6.tip/arch/x86/kernel/genx2apic_phys.c
@@ -29,9 +29,9 @@ static int __init x2apic_acpi_madt_oem_c
/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */
-static cpumask_t x2apic_target_cpus(void)
+static void x2apic_target_cpus(cpumask_t *retmask)
{
- return cpumask_of_cpu(0);
+ *retmask = cpumask_of_cpu(0);
}
static cpumask_t x2apic_vector_allocation_domain(int cpu)
--- linux-2.6.tip.orig/arch/x86/kernel/genx2apic_uv_x.c
+++ linux-2.6.tip/arch/x86/kernel/genx2apic_uv_x.c
@@ -77,9 +77,9 @@ EXPORT_SYMBOL(sn_rtc_cycles_per_second);
/* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */
-static cpumask_t uv_target_cpus(void)
+static uv_target_cpus(cpumask_t *retmask)
{
- return cpumask_of_cpu(0);
+ *retmask = cpumask_of_cpu(0);
}
static cpumask_t uv_vector_allocation_domain(int cpu)
--- linux-2.6.tip.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6.tip/arch/x86/kernel/io_apic.c
@@ -1532,7 +1532,7 @@ static void setup_IO_APIC_irq(int apic,
cfg = irq_cfg(irq);
get_cpumask_var(mask, cpumask_irq_level_3);
- *mask = TARGET_CPUS;
+ TARGET_CPUS(*mask);
if (assign_irq_vector(irq, mask))
goto out;
@@ -1618,7 +1618,7 @@ static void __init setup_timer_IRQ0_pin(
memset(&entry, 0, sizeof(entry));
get_cpumask_var(tgt_cpus, cpumask_irq_level_1);
- *tgt_cpus = TARGET_CPUS;
+ TARGET_CPUS(*tgt_cpus);
/*
* We use logical delivery to get the timer IRQ
@@ -2825,7 +2825,7 @@ static inline void __init check_timer(vo
*/
disable_8259A_irq(0);
get_cpumask_var(tgt_cpus, cpumask_irq_level_4);
- *tgt_cpus = TARGET_CPUS;
+ TARGET_CPUS(*tgt_cpus);
assign_irq_vector(0, tgt_cpus);
put_cpumask_var(tgt_cpus, cpumask_irq_level_4);
@@ -3135,7 +3135,7 @@ unsigned int create_irq_nr(unsigned int
irq = 0;
get_cpumask_var(tgt_cpus, cpumask_irq_level_2);
- *tgt_cpus = TARGET_CPUS;
+ TARGET_CPUS(*tgt_cpus);
spin_lock_irqsave(&vector_lock, flags);
for (new = irq_want; new > 0; new--) {
if (platform_legacy_irq(new))
@@ -3197,7 +3197,7 @@ static int msi_compose_msg(struct pci_de
cpumask_ptr tgt_cpus;
get_cpumask_var(tgt_cpus, cpumask_irq_level_4);
- *tgt_cpus = TARGET_CPUS;
+ TARGET_CPUS(*tgt_cpus);
err = assign_irq_vector(irq, tgt_cpus);
if (err)
return err;
@@ -3671,7 +3671,7 @@ int arch_setup_ht_irq(unsigned int irq,
cpumask_ptr tgt_cpus;
get_cpumask_var(tgt_cpus, cpumask_irq_level_4);
- *tgt_cpus = TARGET_CPUS;
+ TARGET_CPUS(*tgt_cpus);
err = assign_irq_vector(irq, tgt_cpus);
if (!err) {
struct ht_irq_msg msg;
@@ -3910,12 +3910,12 @@ void __init setup_ioapic_dest(void)
irq_polarity(irq_entry));
#ifdef CONFIG_INTR_REMAP
else if (intr_remapping_enabled) {
- *tgt_cpus = TARGET_CPUS;
+ TARGET_CPUS(*tgt_cpus);
set_ir_ioapic_affinity_irq_p(irq, tgt_cpus);
}
#endif
else {
- *tgt_cpus = TARGET_CPUS;
+ TARGET_CPUS(*tgt_cpus);
set_ioapic_affinity_irq_p(irq, tgt_cpus);
}
}
--- linux-2.6.tip.orig/include/asm-x86/genapic_64.h
+++ linux-2.6.tip/include/asm-x86/genapic_64.h
@@ -20,7 +20,7 @@ struct genapic {
u32 int_delivery_mode;
u32 int_dest_mode;
int (*apic_id_registered)(void);
- cpumask_t (*target_cpus)(void);
+ void (*target_cpus)(cpumask_t *retmask);
cpumask_t (*vector_allocation_domain)(int cpu);
void (*init_apic_ldr)(void);
/* ipi */
--- linux-2.6.tip.orig/include/asm-x86/mach-default/mach_apic.h
+++ linux-2.6.tip/include/asm-x86/mach-default/mach_apic.h
@@ -7,24 +7,22 @@
#include <asm/smp.h>
#define APIC_DFR_VALUE (APIC_DFR_FLAT)
+#define NO_BALANCE_IRQ (0)
+#define esr_disable (0)
-static inline cpumask_t target_cpus(void)
+#ifdef CONFIG_X86_64
+#include <asm/genapic.h>
+static inline void target_cpus(cpumask_t *retmask)
{
#ifdef CONFIG_SMP
- return cpu_online_map;
+ *retmask = cpu_online_map;
#else
- return cpumask_of_cpu(0);
+ *retmask = cpumask_of_cpu(0);
#endif
}
-
-#define NO_BALANCE_IRQ (0)
-#define esr_disable (0)
-
-#ifdef CONFIG_X86_64
-#include <asm/genapic.h>
#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
#define INT_DEST_MODE (genapic->int_dest_mode)
-#define TARGET_CPUS (genapic->target_cpus())
+#define TARGET_CPUS(retval) (genapic->target_cpus)(&(retval))
#define apic_id_registered (genapic->apic_id_registered)
#define init_apic_ldr (genapic->init_apic_ldr)
#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
@@ -34,9 +32,17 @@ static inline cpumask_t target_cpus(void
#define send_IPI_self (genapic->send_IPI_self)
extern void setup_apic_routing(void);
#else
+static inline cpumask_t target_cpus(void)
+{
+#ifdef CONFIG_SMP
+ return cpu_online_map;
+#else
+ return cpumask_of_cpu(0);
+#endif
+}
#define INT_DELIVERY_MODE dest_LowestPrio
#define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */
-#define TARGET_CPUS (target_cpus())
+#define TARGET_CPUS(retval) retval = (target_cpus())
/*
* Set up the logical destination ID.
*
--- linux-2.6.tip.orig/include/asm-x86/mach-generic/mach_apic.h
+++ linux-2.6.tip/include/asm-x86/mach-generic/mach_apic.h
@@ -3,13 +3,17 @@
#include <asm/genapic.h>
+#ifdef CONFIG_X86_64
+#define TARGET_CPUS(retval) (genapic->target_cpus)(&(retval))
+#else
+#define TARGET_CPUS(retval) retval = (genapic->target_cpus())
+#endif
#define esr_disable (genapic->ESR_DISABLE)
#define NO_BALANCE_IRQ (genapic->no_balance_irq)
#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
#define INT_DEST_MODE (genapic->int_dest_mode)
#undef APIC_DEST_LOGICAL
#define APIC_DEST_LOGICAL (genapic->apic_destination_logical)
-#define TARGET_CPUS (genapic->target_cpus())
#define apic_id_registered (genapic->apic_id_registered)
#define init_apic_ldr (genapic->init_apic_ldr)
#define ioapic_phys_id_map (genapic->ioapic_phys_id_map)
--
next prev parent reply other threads:[~2008-09-06 23:54 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-06 23:50 [RFC 00/13] smp: reduce stack requirements for genapic send_IPI_mask functions Mike Travis
2008-09-06 23:50 ` [RFC 01/13] smp: modify send_IPI_mask interface to accept cpumask_t pointers Mike Travis
2008-09-06 23:50 ` [RFC 02/13] cpumask: add for_each_online_cpu_mask_nr function Mike Travis
2008-09-06 23:50 ` [RFC 03/13] xen: use new " Mike Travis
2008-09-06 23:50 ` [RFC 04/13] cpumask: add cpumask_ptr operations Mike Travis
2008-09-06 23:50 ` [RFC 05/13] cpumask: add get_cpumask_var debug operations Mike Travis
2008-09-06 23:50 ` [RFC 06/13] genapic: use get_cpumask_var operations for allbutself cpumask_ts Mike Travis
2008-09-06 23:50 ` [RFC 07/13] sched: Reduce stack size requirements in kernel/sched.c Mike Travis
2008-09-07 10:24 ` Peter Zijlstra
2008-09-07 11:00 ` Andrew Morton
2008-09-07 13:05 ` Peter Zijlstra
2008-09-08 14:56 ` Mike Travis
2008-09-07 20:28 ` Peter Zijlstra
2008-09-08 14:54 ` Mike Travis
2008-09-08 15:05 ` Peter Zijlstra
2008-09-08 18:38 ` Ingo Molnar
2008-09-10 22:47 ` [RFC] CPUMASK: proposal for replacing cpumask_t Mike Travis
2008-09-10 22:53 ` Andi Kleen
2008-09-10 23:33 ` Mike Travis
2008-09-11 5:21 ` Andi Kleen
2008-09-11 9:00 ` Peter Zijlstra
2008-09-11 15:04 ` Mike Travis
2008-09-12 4:55 ` Rusty Russell
2008-09-12 14:28 ` Mike Travis
2008-09-12 22:02 ` Rusty Russell
2008-09-12 22:50 ` Mike Travis
2008-09-12 22:58 ` H. Peter Anvin
2008-09-06 23:50 ` [RFC 08/13] cpufreq: Reduce stack size requirements in acpi-cpufreq.c Mike Travis
2008-09-06 23:50 ` [RFC 09/13] genapic: reduce stack pressuge in io_apic.c step 1 temp cpumask_ts Mike Travis
2008-09-08 11:01 ` Andi Kleen
2008-09-08 16:03 ` Mike Travis
2008-09-06 23:50 ` [RFC 10/13] genapic: reduce stack pressuge in io_apic.c step 2 internal abi Mike Travis
2008-09-06 23:50 ` Mike Travis [this message]
2008-09-07 7:55 ` [RFC 11/13] genapic: reduce stack pressuge in io_apic.c step 3 target_cpus Bert Wesarg
2008-09-07 9:13 ` Ingo Molnar
2008-09-08 15:01 ` Mike Travis
2008-09-08 15:29 ` Mike Travis
2008-09-06 23:50 ` [RFC 12/13] genapic: reduce stack pressuge in io_apic.c step 4 vector allocation Mike Travis
2008-09-06 23:50 ` [RFC 13/13] genapic: reduce stack pressuge in io_apic.c step 5 cpu_mask_to_apicid Mike Travis
2008-09-07 7:36 ` [RFC 00/13] smp: reduce stack requirements for genapic send_IPI_mask functions Ingo Molnar
2008-09-08 15:17 ` Mike Travis
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=20080906235038.421559000@polaris-admin.engr.sgi.com \
--to=travis@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=dada1@cosmosbay.com \
--cc=davej@codemonkey.org.uk \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=jes@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=steiner@sgi.com \
--cc=tglx@linutronix.de \
/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).