Skip to contentSkip to conversation

Summit support for pcibus <-> cpumask topology

PATCH In review James Bottomley 5 participants 18 messages Mar 14, 2003 – Mar 18, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines

This patch adds a new file, arch/i386/kernel/summit.c, for summit-specific code. Adds some structures to mach_mpparse.h. Also adds a hook in setup_arch() to dig out the PCI info, and stores it in the mp_bus_id_to_node[] array, where it can be read by the topology functions.

Wouldn't this file be better in arch/i386/mach-summit in keeping with all the other subarch stuff?

While you're creating a separate file for summit, could you move the summit specific variables (mpparse.c:x86_summit is the only one, I think) into it so we can clean all the summit references out of the main line?

Thanks,

James

#1 lore raw

Re: [patch] Summit support for pcibus <-> cpumask topology [1/2]

Quoted 7 lines · James Bottomley
Quoted 2 lines

This patch adds a new file, arch/i386/kernel/summit.c, for summit-specific code. Adds some structures to mach_mpparse.h. Also adds a hook in setup_arch() to dig out the PCI info, and stores it in the mp_bus_id_to_node[] array, where it can be read by the topology functions.

Wouldn't this file be better in arch/i386/mach-summit in keeping with all the other subarch stuff?

Quoted 8 lines

While you're creating a separate file for summit, could you move the summit specific variables (mpparse.c:x86_summit is the only one, I think) into it so we can clean all the summit references out of the main line?

Thanks,

James

Ok... Split into two patches now. Patch 1 moves summit stuff into subarch. Just creates the directory and populates it with setup.c, topology.c, and the Makefile from mach-default. Also creates a summit.c which only has the x86_summit variable you referred to.

Patch 2 adds all pcimapping code, but adds it in the subarch dir, not i386/kernel/.

Cheers!

-Matt

arch/i386/Makefile +1 -1
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/arch/i386/Makefile linux-2.5.64-summit_subarch/arch/i386/Makefile
@@ -71,7 +71,7 @@
 
 #Summit subarch support
 mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-i386/mach-summit
-mcore-$(CONFIG_X86_SUMMIT)  := mach-default
+mcore-$(CONFIG_X86_SUMMIT)  := mach-summit
 
 # default subarch .h files
 mflags-y += -Iinclude/asm-i386/mach-default
arch/i386/kernel/mpparse.c +0 -1
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/arch/i386/kernel/mpparse.c linux-2.5.64-summit_subarch/arch/i386/kernel/mpparse.c
@@ -72,7 +72,6 @@
 /* Bitmask of physically existing CPUs */
 unsigned long phys_cpu_present_map;
 
-int x86_summit = 0;
 u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
 
 /*
arch/i386/mach-summit/Makefile +7 -0
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/arch/i386/mach-summit/Makefile linux-2.5.64-summit_subarch/arch/i386/mach-summit/Makefile
@@ -0,0 +1,7 @@
+#
+# Makefile for the linux kernel.
+#
+
+EXTRA_CFLAGS	+= -I../kernel
+
+obj-y				:= setup.o topology.o summit.o
arch/i386/mach-summit/setup.c +104 -0

104 lines not on this page · raw message

arch/i386/mach-summit/summit.c +29 -0
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/arch/i386/mach-summit/summit.c linux-2.5.64-summit_subarch/arch/i386/mach-summit/summit.c
@@ -0,0 +1,29 @@
+/*
+ * arch/i386/kernel/summit.c - IBM Summit-Specific Code
+ *
+ * Written By: Matthew Dobson, IBM Corporation
+ *
+ * Copyright (c) 2003 IBM Corp.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Send feedback to <[email protected]>
+ *
+ */
+
+int x86_summit = 0;
arch/i386/mach-summit/topology.c +68 -0

68 lines not on this page · raw message

#2 lore raw

Re: [patch] Summit support for pcibus <-> cpumask topology [2/2]

Quoted 6 lines · James Bottomley
Quoted 1 line

This patch adds a new file, arch/i386/kernel/summit.c, for summit-specific code. Adds some structures to mach_mpparse.h. Also adds a hook in setup_arch() to dig out the PCI info, and stores it in the mp_bus_id_to_node[] array, where it can be read by the topology functions.

Wouldn't this file be better in arch/i386/mach-summit in keeping with all the other subarch stuff?

Quoted 8 lines

While you're creating a separate file for summit, could you move the summit specific variables (mpparse.c:x86_summit is the only one, I think) into it so we can clean all the summit references out of the main line?

Thanks,

James

Ok... Split into two patches now. Patch 1 moves summit stuff into subarch. Just creates the directory and populates it with setup.c, topology.c, and the Makefile from mach-default. Also creates a summit.c which only has the x86_summit variable you referred to.

Patch 2 adds all pcimapping code, but adds it in the subarch dir, not i386/kernel/.

Cheers!

-Matt

arch/i386/kernel/setup.c +3 -0
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-summit_subarch/arch/i386/kernel/setup.c linux-2.5.64-summit_pcimap/arch/i386/kernel/setup.c
@@ -918,6 +918,9 @@
 	if (smp_found_config)
 		get_smp_config();
 #endif
+#ifdef CONFIG_X86_SUMMIT
+	setup_summit();
+#endif
 
 	register_memory(max_low_pfn);
 
arch/i386/mach-summit/summit.c +135 -0

139 lines not on this page · raw message

include/asm-i386/mach-summit/mach_mpparse.h +69 -0

79 lines not on this page · raw message

include/asm-i386/mpspec.h +4 -0
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-summit_subarch/include/asm-i386/mpspec.h linux-2.5.64-summit_pcimap/include/asm-i386/mpspec.h
@@ -222,6 +222,10 @@
 extern int pic_mode;
 extern int using_apic_timer;
 
+#ifdef CONFIG_X86_SUMMIT
+extern void setup_summit (void);
+#endif
+
 #ifdef CONFIG_ACPI_BOOT
 extern void mp_register_lapic (u8 id, u8 enabled);
 extern void mp_register_lapic_address (u64 address);
#3 lore raw

PATCH 1/1 NUMAQ subarchification

In reply to Matthew Dobson
Quoted 5 lines · James Bottomley
Quoted 1 line

This patch adds a new file, arch/i386/kernel/summit.c, for summit-specific code. Adds some structures to mach_mpparse.h. Also adds a hook in setup_arch() to dig out the PCI info, and stores it in the mp_bus_id_to_node[] array, where it can be read by the topology functions.

Wouldn't this file be better in arch/i386/mach-summit in keeping with all the other subarch stuff?

Quoted 8 lines

While you're creating a separate file for summit, could you move the summit specific variables (mpparse.c:x86_summit is the only one, I think) into it so we can clean all the summit references out of the main line?

Thanks,

James

While I was at it, I subarchified (I'll cc Websters with the new word ;) numaq as well. Copied mach-defaults setup.c, topology.c, and Makefile.
Moved arch/i386/kernel/numaq.c into mach-numaq. Compiles.

Cheers!

-Matt

arch/i386/Makefile +4 -4
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/arch/i386/Makefile linux-2.5.64-numaq_subarch/arch/i386/Makefile
@@ -61,14 +61,14 @@
 mflags-$(CONFIG_X86_VISWS)	:= -Iinclude/asm-i386/mach-visws
 mcore-$(CONFIG_X86_VISWS)	:= mach-visws
 
-# NUMAQ subarch support
-mflags-$(CONFIG_X86_NUMAQ)	:= -Iinclude/asm-i386/mach-numaq
-mcore-$(CONFIG_X86_NUMAQ)	:= mach-default
-
 # BIGSMP subarch support
 mflags-$(CONFIG_X86_BIGSMP)	:= -Iinclude/asm-i386/mach-bigsmp
 mcore-$(CONFIG_X86_BIGSMP)	:= mach-default
 
+# NUMAQ subarch support
+mflags-$(CONFIG_X86_NUMAQ)	:= -Iinclude/asm-i386/mach-numaq
+mcore-$(CONFIG_X86_NUMAQ)	:= mach-numaq
+
 #Summit subarch support
 mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-i386/mach-summit
 mcore-$(CONFIG_X86_SUMMIT)  := mach-default
arch/i386/kernel/Makefile +0 -1
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/arch/i386/kernel/Makefile linux-2.5.64-numaq_subarch/arch/i386/kernel/Makefile
@@ -24,7 +24,6 @@
 obj-$(CONFIG_X86_LOCAL_APIC)	+= apic.o nmi.o
 obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o
 obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend.o suspend_asm.o
-obj-$(CONFIG_X86_NUMAQ)		+= numaq.o
 obj-$(CONFIG_EDD)             	+= edd.o
 obj-$(CONFIG_MODULES)		+= module.o
 obj-y				+= sysenter.o
arch/i386/kernel/numaq.c +0 -127

127 lines not on this page · raw message

arch/i386/mach-numaq/Makefile +7 -0
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/arch/i386/mach-numaq/Makefile linux-2.5.64-numaq_subarch/arch/i386/mach-numaq/Makefile
@@ -0,0 +1,7 @@
+#
+# Makefile for the linux kernel.
+#
+
+EXTRA_CFLAGS	+= -I../kernel
+
+obj-y				:= setup.o topology.o numaq.o
arch/i386/mach-numaq/numaq.c +127 -0

127 lines not on this page · raw message

arch/i386/mach-numaq/setup.c +104 -0

104 lines not on this page · raw message

arch/i386/mach-numaq/topology.c +68 -0

68 lines not on this page · raw message

#4 lore raw

Re: [patch] NUMAQ subarchification

Quoted 14 lines
Quoted 14 lines
Quoted 5 lines

This patch adds a new file, arch/i386/kernel/summit.c, for summit-specific code. Adds some structures to mach_mpparse.h. Also adds a hook in setup_arch() to dig out the PCI info, and stores it in the mp_bus_id_to_node[] array, where it can be read by the topology functions.

Wouldn't this file be better in arch/i386/mach-summit in keeping with all the other subarch stuff?

While you're creating a separate file for summit, could you move the summit specific variables (mpparse.c:x86_summit is the only one, I think) into it so we can clean all the summit references out of the main line?

Quoted 5 lines
Quoted 3 lines

Thanks,

James

While I was at it, I subarchified (I'll cc Websters with the new word ;) numaq as well. Copied mach-defaults setup.c, topology.c, and Makefile. Moved arch/i386/kernel/numaq.c into mach-numaq. Compiles.

No, *please* don't do this. Subarch for .c files is *broken*.

Last time I looked (and I don't think anyone has fixed it since) it requires copying files all over the place, making an unmaintainable nightmare. Either subarch needs fixing first, or we don't use it.

Let's just stick with your original patch - it's fine.

M.

#5 lore raw

Re: [patch] NUMAQ subarchification

Quoted 1 line · Martin J. Bligh

No, *please* don't do this. Subarch for .c files is *broken*.

It is the place designed for code belonging only to one subarch.

Quoted 3 lines

Last time I looked (and I don't think anyone has fixed it since) it requires copying files all over the place, making an unmaintainable nightmare. Either subarch needs fixing first, or we don't use it.

It's design is identical to the arch directories, except that it has far fewer hooks. People grumble about having to change 20 arch files when they want to alter the interface, but no-one's yet called it unmaintainable.

The subarch split is designed to support machines with radically different architectures like voyager and to a lesser extent visws. Just because summit isn't a radically different architecture doesn't make the subarch concept broken. I think other people have mentioned before that what you probably need for summit is a modular apic driver. However, if you want to propose changes to the subarch setup, you're welcome to do that too.

The problem you have (your setup.c and topology.c are identical to the default) was originally going to be solved using VPATH. Unfortunately, that got broken along the way in the new build scheme, so the best I think you can do is add this to the summit Makefile

$(obj)/setup.c: $(src)/../mach-default/setup.c

	cat $< $@

etc.

Kai isn't going to like this, but hopefully he will be able to come up with a better solution.

However, you could also take this opportunity to remove the NUMA pollution from mach-generic/topology.c.

Quoted 1 line

Let's just stick with your original patch - it's fine.

No, it's not. The object of the subarch is to remove all subarch specific files from the main i386/kernel directory.

James

#6 lore raw

Re: [patch] NUMAQ subarchification

Quoted 3 lines
Quoted 1 line

No, *please* don't do this. Subarch for .c files is *broken*.

It is the place designed for code belonging only to one subarch.

That doesn't mean it's not broken.

Quoted 4 lines
Quoted 1 line

Let's just stick with your original patch - it's fine.

No, it's not. The object of the subarch is to remove all subarch specific files from the main i386/kernel directory.

It needs fixing to avoid the duplication first ... after that it'll be a fine idea. Until that, I'm not moving any code under there.

M.

#7 lore raw

Re: [patch] NUMAQ subarchification

In reply to James Bottomley
Quoted 5 lines · James Bottomley

It is the place designed for code belonging only to one subarch.

Quoted 3 lines

Last time I looked (and I don't think anyone has fixed it since) it requires copying files all over the place, making an unmaintainable nightmare. Either subarch needs fixing first, or we don't use it.

I agree that duplicating files into different subarch dirs sure isn't the way to go.

Quoted 4 lines

The problem you have (your setup.c and topology.c are identical to the default) was originally going to be solved using VPATH. Unfortunately, that got broken along the way in the new build scheme, so the best I think you can do is add this to the summit Makefile

I think VPATH has never been meant to be used for anything like this, it could be make to work, though it would interfere with the separate src/obj thing. But I don't think it's a good idea, we'll have object files magically appear without any visible source file, that's just too obscure.

I can basically see two options at this point:

Quoted 2 lines

$(obj)/setup.c: $(src)/../mach-default/setup.c

	cat $< $@

Something like this, but using ln -sf would be nicer, since that avoids someone editing the wrong file by mistake.

Or:

Make the build enter mach-default always. However, make compilation of setup.c and topology.c conditional on CONFIG_X86_DEFAULT_SETUP and CONFIG_X86_DEFAULT_TOPOLOGY (or combine those two into one config variable). Then, you'll have to deal with those two variables explicitly from Kconfig. Basically, set them to n for voyager and visws, y otherwise.

Yes, that means changing another line in Kconfig when you add a new subarch, but that doesn't happen all that frequently. And it's sure better than crashes on boot because your setup.c disappeared after a bk commit and the build chose to use the mach-default one instead...

--Kai

#8 lore raw

Re: [patch] NUMAQ subarchification

Quoted 19 lines
Quoted 5 lines

It is the place designed for code belonging only to one subarch.

Quoted 3 lines

Last time I looked (and I don't think anyone has fixed it since) it requires copying files all over the place, making an unmaintainable nightmare. Either subarch needs fixing first, or we don't use it.

I agree that duplicating files into different subarch dirs sure isn't the way to go.

Quoted 4 lines

The problem you have (your setup.c and topology.c are identical to the default) was originally going to be solved using VPATH. Unfortunately, that got broken along the way in the new build scheme, so the best I think you can do is add this to the summit Makefile

I think VPATH has never been meant to be used for anything like this, it could be make to work, though it would interfere with the separate src/obj thing. But I don't think it's a good idea, we'll have object files magically appear without any visible source file, that's just too obscure.

Quoted 7 lines

I can basically see two options at this point:

Quoted 2 lines

$(obj)/setup.c: $(src)/../mach-default/setup.c

	cat $< $@

Something like this, but using ln -sf would be nicer, since that avoids someone editing the wrong file by mistake.

GNU diff doesn't seem to understand soft links, so I don't think that's feasible unfortunately. The ../mach-default stuff still requires you to edit each subarch's makefile when adding a file to any subarch, which is a pain in the butt, but better than the duplicated files by a long way.

Another comprimise solution for now might be to leave the Makefile entries with ifdefs in the main Makefile (just as we do without subarch), but just move the subarch files into the subarch dirs ... at least until we get a better plan sorted out? That'll mean much less reshuffling when it's fixed.

M.

#9 lore raw

Re: [patch] NUMAQ subarchification

In reply to Kai Germaschewski
Quoted 4 lines · Kai Germaschewski

I think VPATH has never been meant to be used for anything like this, it could be make to work, though it would interfere with the separate src/obj thing. But I don't think it's a good idea, we'll have object files magically appear without any visible source file, that's just too obscure.

Well...There is a slightly different solution.

What if the summit/numaq setup.c simply contained

#include "../mach-default/setup.c"

?

Not that I like doing this, but it solves the "magic" appearace of the object file and it's perfectly clear to anyone editing the file where it really comes from.

James

#10 lore raw

Re: [patch] NUMAQ subarchification

Quoted 10 lines · James Bottomley
Quoted 4 lines · Kai Germaschewski

I think VPATH has never been meant to be used for anything like this, it could be make to work, though it would interfere with the separate src/obj thing. But I don't think it's a good idea, we'll have object files magically appear without any visible source file, that's just too obscure.

Well...There is a slightly different solution.

What if the summit/numaq setup.c simply contained

Quoted 7 lines

#include "../mach-default/setup.c"

?

Not that I like doing this, but it solves the "magic" appearace of the object file and it's perfectly clear to anyone editing the file where it really comes from.

Yes, that'd work as well. Just for reference, my suggestion: - Take whatever you like best ;)

--Kai

===== arch/i386/Kconfig 1.48 vs edited =====

arch/i386/Kconfig +10 -0
@@ -97,6 +97,16 @@
 
 endchoice
 
+config X86_DEFAULT_SETUP
+	bool
+	default y
+	depends on X86_PC || X86_NUMAQ || X86_SUMMIT || X86_BIGSMP
+
+config X86_DEFAULT_TOPOLOGY
+	bool
+	default y
+	depends on X86_PC || X86_NUMAQ || X86_SUMMIT || X86_BIGSMP
+
 
 choice
 	prompt "Processor family"

===== arch/i386/Makefile 1.48 vs edited =====

arch/i386/Makefile +7 -12
@@ -50,38 +50,33 @@
 
 CFLAGS += $(cflags-y)
 
-# Default subarch .c files
-mcore-y  := mach-default
-
 # Voyager subarch support
 mflags-$(CONFIG_X86_VOYAGER)	:= -Iinclude/asm-i386/mach-voyager
-mcore-$(CONFIG_X86_VOYAGER)	:= mach-voyager
+mcore-$(CONFIG_X86_VOYAGER)	:= arch/i386/mach-voyager/
 
 # VISWS subarch support
 mflags-$(CONFIG_X86_VISWS)	:= -Iinclude/asm-i386/mach-visws
-mcore-$(CONFIG_X86_VISWS)	:= mach-visws
+mcore-$(CONFIG_X86_VISWS)	:= arch/i386/mach-visws/
 
 # NUMAQ subarch support
 mflags-$(CONFIG_X86_NUMAQ)	:= -Iinclude/asm-i386/mach-numaq
-mcore-$(CONFIG_X86_NUMAQ)	:= mach-default
 
 # BIGSMP subarch support
 mflags-$(CONFIG_X86_BIGSMP)	:= -Iinclude/asm-i386/mach-bigsmp
-mcore-$(CONFIG_X86_BIGSMP)	:= mach-default
 
-#Summit subarch support
-mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-i386/mach-summit
-mcore-$(CONFIG_X86_SUMMIT)  := mach-default
+# Summit subarch support
+mflags-$(CONFIG_X86_SUMMIT)	:= -Iinclude/asm-i386/mach-summit
 
 # default subarch .h files
-mflags-y += -Iinclude/asm-i386/mach-default
+mflags-y 			+= -Iinclude/asm-i386/mach-default
 
 head-y := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
 
 libs-y 					+= arch/i386/lib/
 core-y					+= arch/i386/kernel/ \
 					   arch/i386/mm/ \
-					   arch/i386/$(mcore-y)/
+					   arch/i386/mach-default/ \
+					   $(mcore-y)
 drivers-$(CONFIG_MATH_EMULATION)	+= arch/i386/math-emu/
 drivers-$(CONFIG_PCI)			+= arch/i386/pci/
 # FIXME: is drivers- right ?

===== arch/i386/mach-default/Makefile 1.8 vs edited =====

arch/i386/mach-default/Makefile +2 -1
@@ -4,4 +4,5 @@
 
 EXTRA_CFLAGS	+= -I../kernel
 
-obj-y				:= setup.o topology.o
+obj-$(CONFIG_X86_DEFAULT_SETUP)		+= setup.o
+obj-$(CONFIG_X86_DEFAULT_TOPOLOGY)	+= topology.o
#11 lore raw

Re: [patch] NUMAQ subarchification

arch/i386/Kconfig line 109

Quoted 6 lines · Kai Germaschewski

On 15 Mar 2003, James Bottomley wrote:

arch/i386/Kconfig +5 -0
+config X86_DEFAULT_TOPOLOGY
+	bool
+	default y
+	depends on X86_PC || X86_NUMAQ || X86_SUMMIT || X86_BIGSMP
+

The slight problem here is that topology isn't shared between default, summit and numaq (or at least won't be when the #ifdef mess is removed from the default), but summit and numaq would still like to share the same topology file between them, which is going to add another level of complexity to the Makefile solution.

On the whole, I think the least of the three evils is #including a .c file.

James

#12 lore raw

Re: [patch] NUMAQ subarchification

In reply to Martin J. Bligh
Quoted 4 lines · Martin J. Bligh

No, *please* don't do this. Subarch for .c files is *broken*. Last time I looked (and I don't think anyone has fixed it since) it requires copying files all over the place, making an unmaintainable nightmare. Either subarch needs fixing first, or we don't use it.

It was fixed in about 2.5.50-ac. I thought Linus had picked up the improved version of mach-default* too. Its used extensively for stuff like PC9800 which is deeply un-PC

#13 lore raw

Re: [patch] NUMAQ subarchification

Quoted 8 lines
Quoted 4 lines

No, *please* don't do this. Subarch for .c files is *broken*. Last time I looked (and I don't think anyone has fixed it since) it requires copying files all over the place, making an unmaintainable nightmare. Either subarch needs fixing first, or we don't use it.

It was fixed in about 2.5.50-ac. I thought Linus had picked up the improved version of mach-default* too. Its used extensively for stuff like PC9800 which is deeply un-PC

Cool, if that's in mainline, we're set ... if not, I guess we need to pull it out and steal it ;-)

M.

#14 lore raw

Re: [patch] NUMAQ subarchification

In reply to Alan Cox
Quoted 3 lines · Alan Cox

It was fixed in about 2.5.50-ac. I thought Linus had picked up the improved version of mach-default* too. Its used extensively for stuff like PC9800 which is deeply un-PC

Actually, we have all that in the mainline. It was the .h fallback to mach-defaults.

The issue here is that mach-numaq and mach-summit are very PC like and so don't need any of the hooks that are in setup.c, thus they'd like to share setup.c from mach-default. Likewise, they have the same topology file, I think (although this time it would be different from mach-default since we can pull the numa pieces out). Prior to the build changes, VPATH would solve this problem (I used to use it to get trampoline.o for voyager). However, now, the best I think we can do is to cat the file across.

James

#15 lore raw

Re: [patch] NUMAQ subarchification

In reply to Martin J. Bligh
Quoted 18 lines · Martin J. Bligh
Quoted 10 lines
Quoted 10 lines
Quoted 1 line

This patch adds a new file, arch/i386/kernel/summit.c, for summit-specific code. Adds some structures to mach_mpparse.h. Also adds a hook in setup_arch() to dig out the PCI info, and stores it in the mp_bus_id_to_node[] array, where it can be read by the topology functions.

Wouldn't this file be better in arch/i386/mach-summit in keeping with all the other subarch stuff?

While you're creating a separate file for summit, could you move the summit specific variables (mpparse.c:x86_summit is the only one, I think) into it so we can clean all the summit references out of the main line?

Quoted 5 lines
Quoted 3 lines

Thanks,

James

While I was at it, I subarchified (I'll cc Websters with the new word ;) numaq as well. Copied mach-defaults setup.c, topology.c, and Makefile. Moved arch/i386/kernel/numaq.c into mach-numaq. Compiles.

Quoted 8 lines

No, *please* don't do this. Subarch for .c files is *broken*.

Last time I looked (and I don't think anyone has fixed it since) it requires copying files all over the place, making an unmaintainable nightmare. Either subarch needs fixing first, or we don't use it.

Let's just stick with your original patch - it's fine.

M.

I'm inclined to agree with Martin on this one. The useless code duplication is outright stupidity. Makefile hackery would work, as would James' suggestion of #include'ing the .c files. I tend to agree with his assessment of that as the least of evils. But until we have a good way of falling back to mach-default for .c files, I'm going to leave the one (relatively) small .c file in arch/i386/kernel. It will be trivial to move it later, and for now it sits nicely next to it's kin: arch/i386/kernel/numaq.c.

Original patch rediffed against 2.5.65 (just offsets) below.

Cheers!

-Matt

arch/i386/kernel/Makefile +1 -0
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.65-vanilla/arch/i386/kernel/Makefile linux-2.5.65-summit_pcimap/arch/i386/kernel/Makefile
@@ -25,6 +25,7 @@
 obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o
 obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend.o suspend_asm.o
 obj-$(CONFIG_X86_NUMAQ)		+= numaq.o
+obj-$(CONFIG_X86_SUMMIT)	+= summit.o
 obj-$(CONFIG_EDD)             	+= edd.o
 obj-$(CONFIG_MODULES)		+= module.o
 obj-y				+= sysenter.o
arch/i386/kernel/setup.c +3 -0
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.65-vanilla/arch/i386/kernel/setup.c linux-2.5.65-summit_pcimap/arch/i386/kernel/setup.c
@@ -939,6 +939,9 @@
 	if (smp_found_config)
 		get_smp_config();
 #endif
+#ifdef CONFIG_X86_SUMMIT
+	setup_summit();
+#endif
 
 	register_memory(max_low_pfn);
 
arch/i386/kernel/summit.c +162 -0

162 lines not on this page · raw message

include/asm-i386/mach-summit/mach_mpparse.h +69 -0

79 lines not on this page · raw message

include/asm-i386/mpspec.h +4 -0
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.65-vanilla/include/asm-i386/mpspec.h linux-2.5.65-summit_pcimap/include/asm-i386/mpspec.h
@@ -222,6 +222,10 @@
 extern int pic_mode;
 extern int using_apic_timer;
 
+#ifdef CONFIG_X86_SUMMIT
+extern void setup_summit (void);
+#endif
+
 #ifdef CONFIG_ACPI_BOOT
 extern void mp_register_lapic (u8 id, u8 enabled);
 extern void mp_register_lapic_address (u64 address);
#16 lore raw

Re: [patch] NUMAQ subarchification

Quoted 9 lines · Matthew Dobson

I'm inclined to agree with Martin on this one. The useless code duplication is outright stupidity. Makefile hackery would work, as would James' suggestion of #include'ing the .c files. I tend to agree with his assessment of that as the least of evils. But until we have a good way of falling back to mach-default for .c files, I'm going to leave the one (relatively) small .c file in arch/i386/kernel. It will be trivial to move it later, and for now it sits nicely next to it's
kin: arch/i386/kernel/numaq.c.

There are five hooks in setup.c (since I assume SUMMIT isn't MCA), amounting to about 20 lines of code in all. There is no extra code in the hooks which doesn't serve a purpose to the rest of the subarch implementations.

I also notice there's some summit code that *should* be in an arch hook:

Quoted 16 lines

diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.65-vanilla/arch/i386/kernel/setup.c linux-2.5.65-summit_pcimap/arch/i386/kernel/setup.c

arch/i386/kernel/setup.c +3 -0
@@ -939,6 +939,9 @@
 	if (smp_found_config)
 		get_smp_config();
 #endif
+#ifdef CONFIG_X86_SUMMIT
+	setup_summit();
+#endif
 
 	register_memory(max_low_pfn);
 

include/asm-i386/mpspec.h line 228

Quoted 7 lines
include/asm-i386/mpspec.h +4 -0
@@ -222,6 +222,10 @@
 extern int pic_mode;
 extern int using_apic_timer;
 
+#ifdef CONFIG_X86_SUMMIT
+extern void setup_summit (void);
+#endif
+

which is already there waiting for you to use it.

As I've already pointed out, the summit topology.c file should be split out from the default one and the #ifdef CONFIG_NUMA removed.

All in all, properly done, there would be very little code duplication even for something as PC like as the summit.

If I read correctly between the whines, the real issue is that subarch is used to support things that vary from uniquely oddball to extremely weird and are all ancient and highly unlikely ever to be found in nature. IBM, understandably, doesn't want its brand new and expensive summit lumped with such company.

I'm not the gatekeeper of code purity in arch/i386/kernel, so if you can convince Linus, he'll probably take it. However, if you could come up with a cogent technical argument why you can't use the subarch (or modify it for your needs), it would probably be helpful. Not wanting to duplicate 15 lines of code isn't really that convincing...

James

#17 lore raw

Re: [patch] NUMAQ subarchification

Quoted 8 lines

All in all, properly done, there would be very little code duplication even for something as PC like as the summit.

If I read correctly between the whines, the real issue is that subarch is used to support things that vary from uniquely oddball to extremely weird and are all ancient and highly unlikely ever to be found in nature. IBM, understandably, doesn't want its brand new and expensive summit lumped with such company.

The company argument really doesn't bother me at all ;-)
I'm much more concerned with making things easy to maintain ... the .h file stuff under subarch is *superb* as long as you don't have to build one kernel that supports many machines. If the .c stuff worked like that, I'd have no issues.

The function vector stuff is another issue ... we need to make the distros happy at some point soon for the mainline arches that need to be supported at least (ie NUMA-Q et al don't matter so much).

M.