Re: [RFC 11/13] genapic: reduce stack pressuge in io_apic.c step 3 target_cpus

Previous thread: [RFC 06/13] genapic: use get_cpumask_var operations for allbutself cpumask_ts by Mike Travis on Saturday, September 6, 2008 - 4:50 pm. (1 message)

Next thread: [RFC 10/13] genapic: reduce stack pressuge in io_apic.c step 2 internal abi by Mike Travis on Saturday, September 6, 2008 - 4:50 pm. (1 message)
From: Mike Travis
Date: Saturday, September 6, 2008 - 4:50 pm

* 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 = ...
From: Bert Wesarg
Date: Sunday, September 7, 2008 - 12:55 am

But its expended to:

Bert
--

From: Ingo Molnar
Date: Sunday, September 7, 2008 - 2:13 am

hm, this should be unified.

	Ingo
--

From: Mike Travis
Date: Monday, September 8, 2008 - 8:01 am

As I did that one first, I didn't want to muddle through too much i386 code,
but when I did the vector_allocation_domain, it became more clear that making
them common would be better.

I also tripped myself up because one of my test i386 configs had 64 cpus and
it fired up the "NR_CPUS > BITS_PER_LON" code. ;-)  [And I'm supposing it's
probably justified to believe that there may be "fairly large" 32-bit systems,
for those applications that need horsepower but not a lot of memory.]

Thanks,
Mike
--

From: Mike Travis
Date: Monday, September 8, 2008 - 8:29 am

Umm, right, my cut and paste error...

Thanks,

--

Previous thread: [RFC 06/13] genapic: use get_cpumask_var operations for allbutself cpumask_ts by Mike Travis on Saturday, September 6, 2008 - 4:50 pm. (1 message)

Next thread: [RFC 10/13] genapic: reduce stack pressuge in io_apic.c step 2 internal abi by Mike Travis on Saturday, September 6, 2008 - 4:50 pm. (1 message)