Skip to contentSkip to conversation

x86: make UV support optional

PATCH In review Nick Piggin 7 participants 15 messages Jan 6, 2009 – Jan 11, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: make UV support optional

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

--
Make X86 SGI Ultraviolet support configurable. Saves about 13K of text size on my modest config.

text data bss dec hex filename

6770537 1158680  694356 8623573  8395d5 vmlinux
6757492 1157664  694228 8609384  835e68 vmlinux.nouv
---
 arch/x86/Kconfig                  |    7 +++++++
 arch/x86/include/asm/genapic.h    |   24 ++++++++++++++++++++++++
 arch/x86/include/asm/genapic_32.h |    7 -------
 arch/x86/include/asm/genapic_64.h |    9 ---------
 arch/x86/kernel/Makefile          |    5 +++--
 arch/x86/kernel/entry_64.S        |    2 ++
 arch/x86/kernel/genapic_64.c      |    3 ++-
 arch/x86/kernel/io_apic.c         |    2 +-
 8 files changed, 39 insertions(+), 20 deletions(-)
arch/x86/Kconfig +7 -0
Index: linux-2.6/arch/x86/Kconfig
===================================================================
@@ -390,6 +390,13 @@ config X86_RDC321X
 	  as R-8610-(G).
 	  If you don't have one of these chips, you should say N here.
 
+config X86_UV
+	bool "SGI Ultraviolet"
+	depends on X86_64
+	help
+	  This option is needed in order to support SGI Ultraviolet systems.
+	  If you don't have one of these, you should say N here.
+
 config SCHED_OMIT_FRAME_POINTER
 	def_bool y
 	prompt "Single-depth WCHAN output"
arch/x86/include/asm/genapic.h +24 -0
Index: linux-2.6/arch/x86/include/asm/genapic.h
===================================================================
@@ -1,5 +1,29 @@
+#ifndef _ASM_X86_GENAPIC_H
+#define _ASM_X86_GENAPIC_H
+
 #ifdef CONFIG_X86_32
 # include "genapic_32.h"
 #else
 # include "genapic_64.h"
 #endif
+
+#ifdef CONFIG_X86_UV
+DECLARE_PER_CPU(int, x2apic_extra_bits);
+enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
+extern enum uv_system_type get_uv_system_type(void);
+extern int is_uv_system(void);
+
+extern struct genapic apic_x2apic_uv_x;
+extern void uv_cpu_init(void);
+extern void uv_system_init(void);
+extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip);
+#else
+enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
+#define get_uv_system_type()		UV_NONE
+#define is_uv_system()			0
+#define uv_wakeup_secondary(a, b)	1
+#define uv_system_init()		do {} while (0)
+#define uv_cpu_init()			do {} while (0)
+#endif
+
+#endif
arch/x86/include/asm/genapic_32.h +0 -7
Index: linux-2.6/arch/x86/include/asm/genapic_32.h
===================================================================
@@ -138,11 +138,4 @@ struct genapic {
 extern struct genapic *genapic;
 extern void es7000_update_genapic_to_cluster(void);
 
-enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
-#define get_uv_system_type()		UV_NONE
-#define is_uv_system()			0
-#define uv_wakeup_secondary(a, b)	1
-#define uv_system_init()		do {} while (0)
-
-
 #endif /* _ASM_X86_GENAPIC_32_H */
arch/x86/include/asm/genapic_64.h +0 -9
Index: linux-2.6/arch/x86/include/asm/genapic_64.h
===================================================================
@@ -51,15 +51,6 @@ extern struct genapic apic_x2apic_phys;
 extern int acpi_madt_oem_check(char *, char *);
 
 extern void apic_send_IPI_self(int vector);
-enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
-extern enum uv_system_type get_uv_system_type(void);
-extern int is_uv_system(void);
-
-extern struct genapic apic_x2apic_uv_x;
-DECLARE_PER_CPU(int, x2apic_extra_bits);
-extern void uv_cpu_init(void);
-extern void uv_system_init(void);
-extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip);
 
 extern void setup_apic_routing(void);
 
arch/x86/kernel/Makefile +3 -2
Index: linux-2.6/arch/x86/kernel/Makefile
===================================================================
@@ -114,10 +114,11 @@ obj-$(CONFIG_SWIOTLB)			+= pci-swiotlb_6
 ###
 # 64 bit specific files
 ifeq ($(CONFIG_X86_64),y)
-        obj-y				+= genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o
-	obj-y				+= bios_uv.o uv_irq.o uv_sysfs.o
+        obj-y				+= genapic_64.o genapic_flat_64.o
         obj-y				+= genx2apic_cluster.o
         obj-y				+= genx2apic_phys.o
+	obj-$(CONFIG_X86_UV)		+= genx2apic_uv_x.o tlb_uv.o
+	obj-$(CONFIG_X86_UV)		+= bios_uv.o uv_irq.o uv_sysfs.o
         obj-$(CONFIG_X86_PM_TIMER)	+= pmtimer_64.o
         obj-$(CONFIG_AUDIT)		+= audit_64.o
 
arch/x86/kernel/entry_64.S +2 -0
Index: linux-2.6/arch/x86/kernel/entry_64.S
===================================================================
@@ -981,8 +981,10 @@ apicinterrupt IRQ_MOVE_CLEANUP_VECTOR \
 	irq_move_cleanup_interrupt smp_irq_move_cleanup_interrupt
 #endif
 
+#ifdef CONFIG_X86_UV
 apicinterrupt UV_BAU_MESSAGE \
 	uv_bau_message_intr1 uv_bau_message_interrupt
+#endif
 apicinterrupt LOCAL_TIMER_VECTOR \
 	apic_timer_interrupt smp_apic_timer_interrupt
 
arch/x86/kernel/genapic_64.c +2 -1
Index: linux-2.6/arch/x86/kernel/genapic_64.c
===================================================================
@@ -25,14 +25,15 @@
 
 extern struct genapic apic_flat;
 extern struct genapic apic_physflat;
-extern struct genapic apic_x2xpic_uv_x;
 extern struct genapic apic_x2apic_phys;
 extern struct genapic apic_x2apic_cluster;
 
 struct genapic __read_mostly *genapic = &apic_flat;
 
 static struct genapic *apic_probe[] __initdata = {
+#ifdef CONFIG_X86_UV
 	&apic_x2apic_uv_x,
+#endif
 	&apic_x2apic_phys,
 	&apic_x2apic_cluster,
 	&apic_physflat,
arch/x86/kernel/io_apic.c +1 -1
Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
@@ -3762,7 +3762,7 @@ int arch_setup_ht_irq(unsigned int irq,
 }
 #endif /* CONFIG_HT_IRQ */
 
-#ifdef CONFIG_X86_64
+#ifdef CONFIG_X86_UV
 /*
  * Re-target the irq to the specified CPU and enable the specified MMR located
  * on the specified blade to allow the sending of MSIs to the specified CPU.
#1 lore raw
Quoted 12 lines · Nick Piggin

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

--
Make X86 SGI Ultraviolet support configurable. Saves about 13K of text size on my modest config.

text data bss dec hex filename

6770537 1158680  694356 8623573  8395d5 vmlinux
6757492 1157664  694228 8609384  835e68 vmlinux.nouv
Quoted 10 lines
---
 arch/x86/Kconfig                  |    7 +++++++
 arch/x86/include/asm/genapic.h    |   24 ++++++++++++++++++++++++
 arch/x86/include/asm/genapic_32.h |    7 -------
 arch/x86/include/asm/genapic_64.h |    9 ---------
 arch/x86/kernel/Makefile          |    5 +++--
 arch/x86/kernel/entry_64.S        |    2 ++
 arch/x86/kernel/genapic_64.c      |    3 ++-
 arch/x86/kernel/io_apic.c         |    2 +-
 8 files changed, 39 insertions(+), 20 deletions(-)

how about
kernel/efi.c: efi.uv_systab = config_tables[i].table;
?

YH

#2 lore raw
Quoted 24 lines · Yinghai Lu
Quoted 12 lines · Nick Piggin

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

--
Make X86 SGI Ultraviolet support configurable. Saves about 13K of text size on my modest config.

text data bss dec hex filename

6770537 1158680  694356 8623573  8395d5 vmlinux
6757492 1157664  694228 8609384  835e68 vmlinux.nouv
Quoted 10 lines
---
 arch/x86/Kconfig                  |    7 +++++++
 arch/x86/include/asm/genapic.h    |   24 ++++++++++++++++++++++++
 arch/x86/include/asm/genapic_32.h |    7 -------
 arch/x86/include/asm/genapic_64.h |    9 ---------
 arch/x86/kernel/Makefile          |    5 +++--
 arch/x86/kernel/entry_64.S        |    2 ++
 arch/x86/kernel/genapic_64.c      |    3 ++-
 arch/x86/kernel/io_apic.c         |    2 +-
 8 files changed, 39 insertions(+), 20 deletions(-)
Quoted 3 lines

how about
kernel/efi.c: efi.uv_systab = config_tables[i].table;
?

Good point, I missed that. Will resend a patch with that ifdef'ed tomorrow unless any serious objections are raised.

#3 lore raw
Quoted 25 lines · Nick Piggin
Quoted 24 lines · Yinghai Lu
Quoted 22 lines · Nick Piggin

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

--
Make X86 SGI Ultraviolet support configurable. Saves about 13K of text size on my modest config.

text data bss dec hex filename

6770537 1158680  694356 8623573  8395d5 vmlinux
6757492 1157664  694228 8609384  835e68 vmlinux.nouv
---
 arch/x86/Kconfig                  |    7 +++++++
 arch/x86/include/asm/genapic.h    |   24 ++++++++++++++++++++++++
 arch/x86/include/asm/genapic_32.h |    7 -------
 arch/x86/include/asm/genapic_64.h |    9 ---------
 arch/x86/kernel/Makefile          |    5 +++--
 arch/x86/kernel/entry_64.S        |    2 ++
 arch/x86/kernel/genapic_64.c      |    3 ++-
 arch/x86/kernel/io_apic.c         |    2 +-
 8 files changed, 39 insertions(+), 20 deletions(-)
Quoted 6 lines
Quoted 3 lines

how about
kernel/efi.c: efi.uv_systab = config_tables[i].table;
?

Good point, I missed that. Will resend a patch with that ifdef'ed tomorrow unless any serious objections are raised.

Looks good to me, but please also extend the Makefile changes to kernel/tlb_uv.c, ./kernel/uv_sysfs.c, kernel/uv_irq.c, kernel/bios_uv.c - UV not just the genapic bits. Perhaps do it via gradual patches.

Ingo

#4 lore raw
Quoted 15 lines · On Tuesday 06 January 2009 20:01:38 Ingo Molnar wrote:
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
---
 arch/x86/Kconfig                  |    7 +++++++
 arch/x86/include/asm/genapic.h    |   24 ++++++++++++++++++++++++
 arch/x86/include/asm/genapic_32.h |    7 -------
 arch/x86/include/asm/genapic_64.h |    9 ---------
 arch/x86/kernel/Makefile          |    5 +++--
 arch/x86/kernel/entry_64.S        |    2 ++
 arch/x86/kernel/genapic_64.c      |    3 ++-
 arch/x86/kernel/io_apic.c         |    2 +-
 8 files changed, 39 insertions(+), 20 deletions(-)

how about
kernel/efi.c: efi.uv_systab = config_tables[i].table;
?

Quoted 6 lines
Quoted 2 lines

Good point, I missed that. Will resend a patch with that ifdef'ed tomorrow unless any serious objections are raised.

Looks good to me, but please also extend the Makefile changes to kernel/tlb_uv.c, ./kernel/uv_sysfs.c, kernel/uv_irq.c, kernel/bios_uv.c - UV not just the genapic bits. Perhaps do it via gradual patches.

Hmm, I think the Makefile changes should be there... the files you reference AFAIKS are put under conditional compilation with my patch?

#5 lore raw
Quoted 20 lines · Nick Piggin
Quoted 18 lines · On Tuesday 06 January 2009 20:01:38 Ingo Molnar wrote:
Quoted 17 lines
Quoted 11 lines
Quoted 10 lines
---
 arch/x86/Kconfig                  |    7 +++++++
 arch/x86/include/asm/genapic.h    |   24 ++++++++++++++++++++++++
 arch/x86/include/asm/genapic_32.h |    7 -------
 arch/x86/include/asm/genapic_64.h |    9 ---------
 arch/x86/kernel/Makefile          |    5 +++--
 arch/x86/kernel/entry_64.S        |    2 ++
 arch/x86/kernel/genapic_64.c      |    3 ++-
 arch/x86/kernel/io_apic.c         |    2 +-
 8 files changed, 39 insertions(+), 20 deletions(-)
Quoted 3 lines

how about
kernel/efi.c: efi.uv_systab = config_tables[i].table;
?

Good point, I missed that. Will resend a patch with that ifdef'ed tomorrow unless any serious objections are raised.

Quoted 6 lines
Quoted 3 lines

Looks good to me, but please also extend the Makefile changes to kernel/tlb_uv.c, ./kernel/uv_sysfs.c, kernel/uv_irq.c, kernel/bios_uv.c - UV not just the genapic bits. Perhaps do it via gradual patches.

Hmm, I think the Makefile changes should be there... the files you reference AFAIKS are put under conditional compilation with my patch?

ah, indeed - i was looking at the diffstat and went "where's the mm/Makefile changes" ;-) So your patch is good as-is, as long as the thing Yinghai noticed is fixed.

Ingo

#6 lore raw
In reply to Nick Piggin
Quoted 3 lines · Nick Piggin

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

Looks ok to me. One suggestion though. There is a MAXSMP config option. I would suggest enabling UV if MAXSMP is enabled. This will help ensure that UV is tested more frequently & may minimize regressions.

--- jack

#7 lore raw
Quoted 10 lines · Jack Steiner
Quoted 3 lines · Nick Piggin

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

Looks ok to me. One suggestion though. There is a MAXSMP config option. I would suggest enabling UV if MAXSMP is enabled. This will help ensure that UV is tested more frequently & may minimize regressions.

Yeah.... I don't know. OTOH it would be more logical to enable MAXSMP iff UV is enabled (or change the MAXSMP limits for when UV is enabled). Or you could select Intel CPUs if UV is enabled, or disable GRU if UV is not set etc etc.

I didn't want to get too fancy with config options because arbitrary linkages seem to just cause headaches. I figure if someone wants to enable it, they can do so.

#8 lore raw
Quoted 4 lines · Nick Piggin
Quoted 3 lines · Jack Steiner
Quoted 2 lines · Nick Piggin

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

What, you haven't heard of "UV on a chip"? It will be in every smart phone soon... ;-)

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

Looks ok to me. One suggestion though. There is a MAXSMP config option. I would suggest enabling UV if MAXSMP is enabled. This will help ensure that UV is tested more frequently & may minimize regressions.

Quoted 9 lines

Yeah.... I don't know. OTOH it would be more logical to enable MAXSMP iff UV is enabled (or change the MAXSMP limits for when UV is enabled). Or you could select Intel CPUs if UV is enabled, or disable GRU if UV is not set etc etc.

I didn't want to get too fancy with config options because arbitrary linkages seem to just cause headaches. I figure if someone wants to enable it, they can do so.

Hi Nick,

The problem arises that if the option becomes too obscure (and never enabled), then it won't get tested. We (as many companies do) rely on distros to certify applications and security features using a standard kernel, and if an option (such as X86_UV) causes any problems whatsoever, they'll drop it and we no longer have that application certification.

Currently, Ingo's test setup sets MAXSMP quite a bit and he's found many problems with large NR_CPUS counts that we never would have found ourselves. Please don't make that process any harder.

In fact, 13k is peanuts. Why don't you set something like "very minimal support" and drop all obsolete features, anything older than a couple of years, anything not available from Dell ;-) Perhaps call it "Desktop System"?

Thanks,
Mike

#9 lore raw
Quoted 8 lines · Mike Travis
Quoted 4 lines · Nick Piggin
Quoted 3 lines · Jack Steiner
Quoted 2 lines · Nick Piggin

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

What, you haven't heard of "UV on a chip"? It will be in every smart phone soon... ;-)

NUMAlink over microwave? Cool!

Quoted 15 lines
Quoted 5 lines
Quoted 4 lines

Looks ok to me. One suggestion though. There is a MAXSMP config option. I would suggest enabling UV if MAXSMP is enabled. This will help ensure that UV is tested more frequently & may minimize regressions.

Quoted 9 lines

Yeah.... I don't know. OTOH it would be more logical to enable MAXSMP iff UV is enabled (or change the MAXSMP limits for when UV is enabled). Or you could select Intel CPUs if UV is enabled, or disable GRU if UV is not set etc etc.

I didn't want to get too fancy with config options because arbitrary linkages seem to just cause headaches. I figure if someone wants to enable it, they can do so.

Quoted 7 lines

Hi Nick,

The problem arises that if the option becomes too obscure (and never enabled), then it won't get tested. We (as many companies do) rely on distros to certify applications and security features using a standard kernel, and if an option (such as X86_UV) causes any problems whatsoever, they'll drop it and we no longer have that application certification.

I wouldn't be so pessimistic ;) The people involved should have a shared interest in the feature so then they will fix it.

It might be nice for one person to enable their code on everyone's builds, but it's kind of a selfish viewpoint (imagine if everyone did it).

Quoted 3 lines

Currently, Ingo's test setup sets MAXSMP quite a bit and he's found many problems with large NR_CPUS counts that we never would have found ourselves. Please don't make that process any harder.

Ingo's setup does randconfigs I think? Then it should pick up this option.

Quoted 1 line

In fact, 13k is peanuts.

Ahh, you SGIers ;) Everything adds up, and 13k is a gold mine for some people, especially considering how unintrusive the patch is.

Quoted 4 lines

Why don't you set something like "very minimal
support" and drop all obsolete features, anything older than a couple of years, anything not available from Dell ;-) Perhaps call it "Desktop System"?

Well, because I don't perceive any benefit from doing that :)

In the end I don't want to make a big deal of it so long as it is configurable. I'll resubmit the patch, and let others play with Kconfig...

#10 lore raw
In reply to Mike Travis

Hi!

Quoted 5 lines

The problem arises that if the option becomes too obscure (and never enabled), then it won't get tested. We (as many companies do) rely on distros to certify applications and security features using a standard kernel, and if an option (such as X86_UV) causes any problems whatsoever, they'll drop it and we no longer have that application certification.

If SGI UV is really important, I'm sure you can ask distros to keep it enabled.

Quoted 3 lines

Currently, Ingo's test setup sets MAXSMP quite a bit and he's found many problems with large NR_CPUS counts that we never would have found ourselves. Please don't make that process any harder.

Yeah, and remove config_386 too. Just hardcode it to y.

No, sorry, I don't see why we should treat UV specially.

Quoted 1 line

In fact, 13k is peanuts. Why don't you set something like "very minimal

13K is quite a lot, actually.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#11 lore raw
In reply to Jack Steiner
Quoted 6 lines · Jack Steiner
Quoted 3 lines · Nick Piggin

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

Quoted 7 lines

Looks ok to me. One suggestion though. There is a MAXSMP config option. I would suggest enabling UV if MAXSMP is enabled. This will help ensure that UV is tested more frequently & may minimize regressions.

--- jack

Nick - would you add something like this to your patch? Thanks! Mike
---
Subject: x86: enable UV when MAXSMP is configured.

We want UV code to be tested even for non-UV architectures. Enabling MAXSMP specifies "maximizing the system capabitlity" and UV is one of these methods. Also helps distros select the correct config options for their default configurations.

---
 arch/x86/Kconfig |    1 +
 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
@@ -616,6 +616,7 @@ config MAXSMP
 	bool "Configure Maximum number of SMP Processors and NUMA Nodes"
 	depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL
 	select CPUMASK_OFFSTACK
+	select X86_UV
 	default n
 	help
 	  Configure maximum number of CPUS and NUMA Nodes for this architecture.
#12 lore raw
Quoted 15 lines · Mike Travis
Quoted 6 lines · Jack Steiner
Quoted 3 lines · Nick Piggin

UV is fairly rare.... and much of the support is already there to cope with 32-bit builds. So this makes sense I think.

Quoted 7 lines

Looks ok to me. One suggestion though. There is a MAXSMP config option. I would suggest enabling UV if MAXSMP is enabled. This will help ensure that UV is tested more frequently & may minimize regressions.

--- jack

Quoted 8 lines

Nick - would you add something like this to your patch? Thanks! Mike
---
Subject: x86: enable UV when MAXSMP is configured.

We want UV code to be tested even for non-UV architectures. Enabling MAXSMP specifies "maximizing the system capabitlity" and UV is one of these methods. Also helps distros select the correct config options for their default configurations.

I don't really follow. The config option I added is very visible and clear, isn't it? I don't think MAXSMP means that, otherwise it would basically be allyesconfig.

I wouldn't object to have a platform types menu like the processor types one. Or a generic architecture checkbox to select some of these things together.

#13 lore raw
In reply to Mike Travis

arch/x86/Kconfig config MAXSMP · line 621

Quoted 7 lines · Mike Travis
arch/x86/Kconfig +1 -0
@@ -616,6 +616,7 @@ config MAXSMP
 	bool "Configure Maximum number of SMP Processors and NUMA Nodes"
 	depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL
 	select CPUMASK_OFFSTACK
+	select X86_UV
 	default n
 	help

why not add this to X86_UV:

default MAXSMP

this way it still stays fully configurable, but it is default-enabled if someone strives for a big SMP kernel.

Ingo

#14 lore raw
Quoted 12 lines · Ingo Molnar

arch/x86/Kconfig config MAXSMP · line 621

Quoted 7 lines · Mike Travis
arch/x86/Kconfig +1 -0
@@ -616,6 +616,7 @@ config MAXSMP
 	bool "Configure Maximum number of SMP Processors and NUMA Nodes"
 	depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL
 	select CPUMASK_OFFSTACK
+	select X86_UV
 	default n
 	help

why not add this to X86_UV:

Quoted 6 lines

default MAXSMP

this way it still stays fully configurable, but it is default-enabled if someone strives for a big SMP kernel.

Ingo

Yes, that does sounds better, thanks!

Mike