x86: don't compile vsmp_64 for 32bit
PATCH 1/1 x86: don't compile vsmp_64 for 32bit
Impact: cleanup
that is only needed when CONFIG_X86_VSMP is defined with 64bit also remove dead code about PCI, because CONFIG_X86_VSMP depends on PCI
--- arch/x86/include/asm/apic.h | 7 +++++++ arch/x86/include/asm/setup.h | 4 ++++ arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/setup.c | 2 -- arch/x86/kernel/vsmp_64.c | 12 +----------- 5 files changed, 13 insertions(+), 14 deletions(-)
arch/x86/include/asm/apic.h +7 -0
@@ -75,7 +75,14 @@ static inline void default_inquire_remot#define setup_secondary_clock setup_secondary_APIC_clock#endif +#ifdef CONFIG_X86_VSMP extern int is_vsmp_box (void ); +#else +static inline int is_vsmp_box (void ) +{ +return 0 ; +} +#endif extern void xapic_wait_icr_idle (void );extern u32 safe_xapic_wait_icr_idle (void );extern void xapic_icr_write (u32 ,u32 );
arch/x86/include/asm/setup.h +4 -0
@@ -64,7 +64,11 @@ extern void x86_quirk_time_init(void);#include <asm/bootparam.h> /* Interrupt control for vSMPowered x86_64 systems */ +#ifdef CONFIG_X86_VSMP void vsmp_init (void ); +#else +static inline void vsmp_init (void ) { } +#endif void setup_bios_corruption_check (void );
arch/x86/kernel/Makefile +1 -1
@@ -70,7 +70,7 @@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += f obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o -obj-y += vsmp_64.o +obj-$(CONFIG_X86_VSMP) += vsmp_64.o obj-$(CONFIG_KPROBES) += kprobes.o obj-$(CONFIG_MODULES) += module_$(BITS).o obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
arch/x86/kernel/setup.c +0 -2
@@ -863,9 +863,7 @@ void __init setup_arch(char **cmdline_p)reserve_initrd (); -#ifdef CONFIG_X86_64 vsmp_init (); -#endif io_delay_init ();
arch/x86/kernel/vsmp_64.c +1 -11
@@ -22,7 +22,7 @@#include <asm/paravirt.h> #include <asm/setup.h> -#if definedCONFIG_PCI && definedCONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT /* * Interrupt control on vSMPowered systems: * ~AC is a shadow of IF. If IF is 'on' AC should be 'off'
@@ -114,7 +114,6 @@ static void __init set_vsmp_pv_ops(void) }#endif -#ifdef CONFIG_PCI static int is_vsmp =-1 ;static void __init detect_vsmp_box (void )
@@ -139,15 +138,6 @@ int is_vsmp_box(void)return 0 ; } } -#else -static void __init detect_vsmp_box (void ) -{ -} -int is_vsmp_box (void ) -{ -return 0 ; -} -#endif void __init vsmp_init (void ) {
Ingo Molnar
AppliedQuoted 8 lines · Yinghai Lu
Impact: cleanup
that is only needed when
CONFIG_X86_VSMPis defined with 64bit also remove dead code about PCI, becauseCONFIG_X86_VSMPdepends on PCISigned-off-by Yinghai Lu <[email protected]>
Quoted 7 lines
--- arch/x86/include/asm/apic.h | 7 +++++++ arch/x86/include/asm/setup.h | 4 ++++ arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/setup.c | 2 -- arch/x86/kernel/vsmp_64.c | 12 +----------- 5 files changed, 13 insertions(+), 14 deletions(-)
Applied to tip:x86/apic, thanks Yinghai!
Ingo
Quoted 8 lines · Yinghai Lu
Impact: cleanup
that is only needed when
CONFIG_X86_VSMPis defined with 64bit also remove dead code about PCI, becauseCONFIG_X86_VSMPdepends on PCISigned-off-by Yinghai Lu <[email protected]>
NAK!vsmp64.c is compiled unconditionally for a reason. There are ifdefs in the file to avoid code compilation based on config options. is_vsmp_box() is needed even when CONFIG_X86_VSMP is not enabled, since distro kernels don't ship with CONFIG_X86_VSMP, and since is_vsmp_box() is used to determine whether tsc's can be considered synced or not, this is needed.
In the future, I would appreciate if you copy me on cleanups/changes involving vsmp64.c
Thanks,
Kiran
Quoted 112 lines
---
arch/x86/include/asm/apic.h | 7 +++++++ arch/x86/include/asm/setup.h | 4 ++++ arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/setup.c | 2 -- arch/x86/kernel/vsmp_64.c | 12 +----------- 5 files changed, 13 insertions(+), 14 deletions(-)Index:
linux-2.6/arch/x86/include/asm/apic.h
===================================================================arch/x86/include/asm/apic.h +7
-0@@ -75,7 +75,14 @@ static inline void default_inquire_remot#define setup_secondary_clock setup_secondary_APIC_clock#endif +#ifdef CONFIG_X86_VSMP extern int is_vsmp_box (void ); +#else +static inline int is_vsmp_box (void ) +{ +return 0 ; +} +#endif extern void xapic_wait_icr_idle (void );extern u32 safe_xapic_wait_icr_idle (void );extern void xapic_icr_write (u32 ,u32 );Index:
linux-2.6/arch/x86/include/asm/setup.h
===================================================================arch/x86/include/asm/setup.h +4
-0@@ -64,7 +64,11 @@ extern void x86_quirk_time_init(void);#include <asm/bootparam.h> /* Interrupt control for vSMPowered x86_64 systems */ +#ifdef CONFIG_X86_VSMP void vsmp_init (void ); +#else +static inline void vsmp_init (void ) { } +#endif void setup_bios_corruption_check (void );Index: linux-2.6/arch/x86/kernel/Makefile
===================================================================arch/x86/kernel/Makefile +0
-0@@ -70,7 +70,7 @@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += fobj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o
obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).oarch/x86/kernel/Makefile +1
-1-obj-y += vsmp_64.o +obj-$(CONFIG_X86_VSMP) += vsmp_64.oobj-$(CONFIG_KPROBES) += kprobes.o
obj-$(CONFIG_MODULES) += module_$(BITS).o
obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
Index:linux-2.6/arch/x86/kernel/setup.c
===================================================================arch/x86/kernel/setup.c +0
-2@@ -863,9 +863,7 @@ void __init setup_arch(char **cmdline_p)reserve_initrd (); -#ifdef CONFIG_X86_64 vsmp_init (); -#endif io_delay_init ();Index:
linux-2.6/arch/x86/kernel/vsmp_64.c
===================================================================arch/x86/kernel/vsmp_64.c +1
-12@@ -22,7 +22,7 @@#include <asm/paravirt.h> #include <asm/setup.h> -#if definedCONFIG_PCI && definedCONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT /* * Interrupt control on vSMPowered systems: * ~AC is a shadow of IF. If IF is 'on' AC should be 'off' @@ -114,7 +114,6 @@ static void __init set_vsmp_pv_ops(void) }#endif -#ifdef CONFIG_PCI static int is_vsmp =-1 ;static void __init detect_vsmp_box (void )@@ -139,15 +138,6 @@ int is_vsmp_box(void)return 0 ; } } -#else -static void __init detect_vsmp_box (void ) -{ -} -int is_vsmp_box (void ) -{ -return 0 ; -} -#endif void __init vsmp_init (void ) { --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 9 lines · Ravikiran G Thirumalai
Quoted 7 lines · Yinghai Lu
Impact: cleanup
that is only needed when
CONFIG_X86_VSMPis defined with 64bit also remove dead code about PCI, becauseCONFIG_X86_VSMPdepends on PCISigned-off-by Yinghai Lu <[email protected]>
Quoted 6 lines
NAK!
vsmp64.cis compiled unconditionally for a reason. There are ifdefs in the file to avoid code compilation based on config options.is_vsmp_box()is needed even whenCONFIG_X86_VSMPis not enabled, since distro kernels don't ship withCONFIG_X86_VSMP, and sinceis_vsmp_box()is used to determine whether tsc's can be considered synced or not, this is needed.
so even CONFIG_X86_VSMP is not defined, you want all x86 systems including 32bit kernel and 64bit kernel to call
static int is_vsmp = -1;
static void __init detect_vsmp_box(void)
{
is_vsmp = 0;
if (!early_pci_allowed())
return;
/* Check if we are running on a ScaleMP vSMPowered box */
if (read_pci_config(0, 0x1f, 0, PCI_VENDOR_ID) ==
(PCI_VENDOR_ID_SCALEMP | (PCI_DEVICE_ID_SCALEMP_VSMP_CTL << 16)))
is_vsmp = 1;
}int is_vsmp_box(void)
{
if (is_vsmp != -1)
return is_vsmp;
else {
WARN_ON_ONCE(1);
return 0;
}
}Quoted 3 lines
In the future, I would appreciate if you copy me on cleanups/changes involving
vsmp64.c
i didn't touch vsmp64.c
YH
Quoted 116 lines
Thanks,
KiranQuoted 112 lines
---
arch/x86/include/asm/apic.h | 7 +++++++ arch/x86/include/asm/setup.h | 4 ++++ arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/setup.c | 2 -- arch/x86/kernel/vsmp_64.c | 12 +----------- 5 files changed, 13 insertions(+), 14 deletions(-)Index:
linux-2.6/arch/x86/include/asm/apic.h
===================================================================arch/x86/include/asm/apic.h +7
-0@@ -75,7 +75,14 @@ static inline void default_inquire_remot#define setup_secondary_clock setup_secondary_APIC_clock#endif +#ifdef CONFIG_X86_VSMP extern int is_vsmp_box (void ); +#else +static inline int is_vsmp_box (void ) +{ +return 0 ; +} +#endif extern void xapic_wait_icr_idle (void );extern u32 safe_xapic_wait_icr_idle (void );extern void xapic_icr_write (u32 ,u32 );Index:
linux-2.6/arch/x86/include/asm/setup.h
===================================================================arch/x86/include/asm/setup.h +4
-0@@ -64,7 +64,11 @@ extern void x86_quirk_time_init(void);#include <asm/bootparam.h> /* Interrupt control for vSMPowered x86_64 systems */ +#ifdef CONFIG_X86_VSMP void vsmp_init (void ); +#else +static inline void vsmp_init (void ) { } +#endif void setup_bios_corruption_check (void );Index: linux-2.6/arch/x86/kernel/Makefile
===================================================================arch/x86/kernel/Makefile +0
-0@@ -70,7 +70,7 @@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += fobj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o
obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).oarch/x86/kernel/Makefile +1
-1-obj-y += vsmp_64.o +obj-$(CONFIG_X86_VSMP) += vsmp_64.oobj-$(CONFIG_KPROBES) += kprobes.o
obj-$(CONFIG_MODULES) += module_$(BITS).o
obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
Index:linux-2.6/arch/x86/kernel/setup.c
===================================================================arch/x86/kernel/setup.c +0
-2@@ -863,9 +863,7 @@ void __init setup_arch(char **cmdline_p)reserve_initrd (); -#ifdef CONFIG_X86_64 vsmp_init (); -#endif io_delay_init ();Index:
linux-2.6/arch/x86/kernel/vsmp_64.c
===================================================================arch/x86/kernel/vsmp_64.c +1
-12@@ -22,7 +22,7 @@#include <asm/paravirt.h> #include <asm/setup.h> -#if definedCONFIG_PCI && definedCONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT /* * Interrupt control on vSMPowered systems: * ~AC is a shadow of IF. If IF is 'on' AC should be 'off' @@ -114,7 +114,6 @@ static void __init set_vsmp_pv_ops(void) }#endif -#ifdef CONFIG_PCI static int is_vsmp =-1 ;static void __init detect_vsmp_box (void )@@ -139,15 +138,6 @@ int is_vsmp_box(void)return 0 ; } } -#else -static void __init detect_vsmp_box (void ) -{ -} -int is_vsmp_box (void ) -{ -return 0 ; -} -#endif void __init vsmp_init (void ) { --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 10 lines · Ravikiran G Thirumalai
Quoted 8 lines · Yinghai Lu
Impact: cleanup
that is only needed when
CONFIG_X86_VSMPis defined with 64bit also remove dead code about PCI, becauseCONFIG_X86_VSMPdepends on PCISigned-off-by Yinghai Lu <[email protected]>
Quoted 6 lines
NAK!
vsmp64.cis compiled unconditionally for a reason. There are ifdefs in the file to avoid code compilation based on config options.is_vsmp_box()is needed even whenCONFIG_X86_VSMPis not enabled, since distro kernels don't ship withCONFIG_X86_VSMP, and sinceis_vsmp_box()is used to determine whether tsc's can be considered synced or not, this is needed.
is_vsmp_box() is always available:
Quoted 8 lines
arch/x86/include/asm/apic.h static inline void default_inquire_remot · line 85
Quoted 8 lines
+#ifdef
CONFIG_X86_VSMP
extern intis_vsmp_box(void);arch/x86/include/asm/apic.h +6
-0+#else +static inline int is_vsmp_box (void ) +{ +return 0 ; +} +#endif
What this patch does is it reduces the kernel's size when CONFIG_X86_VSMP is turned off and also makes the code arguably cleaner.
Quoted 2 lines
In the future, I would appreciate if you copy me on cleanups/changes involving
vsmp64.c
That is what i did when i queued up the change. That is how you became aware of this commit.
Ingo
Quoted 13 lines · Ingo Molnar
Quoted 10 lines · Ravikiran G Thirumalai
Quoted 8 lines · Yinghai Lu
Impact: cleanup
that is only needed when
CONFIG_X86_VSMPis defined with 64bit also remove dead code about PCI, becauseCONFIG_X86_VSMPdepends on PCISigned-off-by Yinghai Lu <[email protected]>
Quoted 8 lines
Quoted 6 lines
NAK!
vsmp64.cis compiled unconditionally for a reason. There are ifdefs in the file to avoid code compilation based on config options.is_vsmp_box()is needed even whenCONFIG_X86_VSMPis not enabled, since distro kernels don't ship withCONFIG_X86_VSMP, and sinceis_vsmp_box()is used to determine whether tsc's can be considered synced or not, this is needed.
is_vsmp_box()is always available:
Yes. But it does not really detect if the machine is vsmp. It is just a 'return 0'.
Quoted 13 lines
Quoted 9 lines
arch/x86/include/asm/apic.h static inline void default_inquire_remot · line 85
Quoted 9 lines
+#ifdef
CONFIG_X86_VSMP
extern intis_vsmp_box(void);arch/x86/include/asm/apic.h +6
-0+#else +static inline int is_vsmp_box (void ) +{ +return 0 ; +} +#endif What this patch does is it reduces the kernel's size when
CONFIG_X86_VSMPis turned off and also makes the code arguably cleaner.
True, but by how much? 212 bytes, out of 7285943 bytes which is very very small percentage wise.
-bash-3.1$ size results/2.6.29-rc6-defconfig/vmlinux
text data bss dec hex filename
7285943 1482684 812968 9581595 92341b results/2.6.29-rc6-defconfig/vmlinux -bash-3.1$ size results/2.6.29-rc6-defconfig+patch/vmlinux
text data bss dec hex filename
7285731 1482684 812968 9581383 923347 results/2.6.29-rc6-defconfig+patch/vmlinux
Note that most of the code within vsmp64.c is dependent on PARAVIRT and won't get compiled if PARAVIRT is not enabled.
We made this code dependent on PARAVIRT rather than CONFIG_X86_VSMP because, vsmp support has two aspects to it. One is a minimal paravirtualization part and the other is internode cacheline support. While CONFIG_X86_VSMP enables both, all that is needed for the paravirtualization part is PARAVIRT. And
it is not heavy or penalizing like the internode cacheline setting. This will
mean installation of distros with the distro provided installer kernels can be done
relatively easily if paravirt is enabled. That's all!
Quoted 7 lines
Quoted 3 lines
In the future, I would appreciate if you copy me on cleanups/changes involving
vsmp64.cThat is what i did when i queued up the change. That is how you became aware of this commit.
Thanks for that. But I started replying to the message before the patch was queued/received your email. But the patch was queued by the time i finished replying.
Quoted 40 lines · Ravikiran G Thirumalai
Quoted 13 lines · Ingo Molnar
Quoted 10 lines · Ravikiran G Thirumalai
Quoted 8 lines · Yinghai Lu
Impact: cleanup
that is only needed when
CONFIG_X86_VSMPis defined with 64bit also remove dead code about PCI, becauseCONFIG_X86_VSMPdepends on PCISigned-off-by Yinghai Lu <[email protected]>Quoted 8 lines
Quoted 6 lines
NAK!
vsmp64.cis compiled unconditionally for a reason. There are ifdefs in the file to avoid code compilation based on config options.is_vsmp_box()is needed even whenCONFIG_X86_VSMPis not enabled, since distro kernels don't ship withCONFIG_X86_VSMP, and sinceis_vsmp_box()is used to determine whether tsc's can be considered synced or not, this is needed.
is_vsmp_box()is always available:Yes. But it does not really detect if the machine is vsmp. It is just a 'return 0'.
Quoted 13 lines
Quoted 9 lines
arch/x86/include/asm/apic.h static inline void default_inquire_remot · line 85
Quoted 9 lines
+#ifdef
CONFIG_X86_VSMP
extern intis_vsmp_box(void);arch/x86/include/asm/apic.h +6
-0+#else +static inline int is_vsmp_box (void ) +{ +return 0 ; +} +#endif What this patch does is it reduces the kernel's size when
CONFIG_X86_VSMPis turned off and also makes the code arguably cleaner.
Quoted 2 lines
True, but by how much? 212 bytes, out of 7285943 bytes which is very very small percentage wise.
How does this eliminate the validity of the patch?
Ingo
Quoted 9 lines · Ingo Molnar
Quoted 3 lines · Ravikiran G Thirumalai
True, but by how much? 212 bytes, out of 7285943 bytes which is very very small percentage wise.
How does this eliminate the validity of the patch?
It costs 212 bytes to leave is_vsmp_box() to not just be a dummy no-op. Having is_vsmp_box() detect if the hardware is indeed vSMP, is meaningful even whenCONFIG_VSMP is not turned on. This is because is_vsmp_box() is used to
tell the kernel, that although the cpus being used are supposed to have TSCs in sync, they are not really in sync. This is because
you cannot ensure TSCs won't drift between multiple boards being aggregated
on vSMP systems. Take the case of distro kernels. Distro kernels typically do
not have CONFIG_X86_VSMP on. Due to the large internode cacheline setting, CONFIG_VSMP would not be on on the generic distro installer kernels. If is_vsmp_box() is a no-op, the generic distro installer kernels will assume TSCs to be synched, which is bad. Hence, it will be nice if, for the cost of 212 bytes, vsmp64.o be compiled either unconditionally, OR conditionally for 64bit architectures only. The question is, is 212 bytes out of 7285943 bytes too expensive for the generic kernels? I hope not.
Thanks,
Kiran
Quoted 8 lines · Ravikiran G Thirumalai
Quoted 6 lines · Ingo Molnar
Quoted 2 lines · Ravikiran G Thirumalai
True, but by how much? 212 bytes, out of 7285943 bytes which is very very small percentage wise.
How does this eliminate the validity of the patch?
Quoted 14 lines
It costs 212 bytes to leave
is_vsmp_box()to not just be a dummy no-op. Havingis_vsmp_box()detect if the hardware is indeed vSMP, is meaningful even whenCONFIG_VSMPis not turned on. This is becauseis_vsmp_box()is used to
tell the kernel, that although the cpus being used are supposed to have TSCs in sync, they are not really in sync. This is because
you cannot ensure TSCs won't drift between multiple boards being aggregated
on vSMP systems. Take the case of distro kernels. Distro kernels typically do
not haveCONFIG_X86_VSMPon. Due to the large internode cacheline setting,CONFIG_VSMPwould not be on on the generic distro installer kernels. Ifis_vsmp_box()is a no-op, the generic distro installer kernels will assume TSCs to be synched, which is bad. Hence, it will be nice if, for the cost of 212 bytes, vsmp64.o be compiled either unconditionally, OR conditionally for 64bit architectures only. The question is, is 212 bytes out of 7285943 bytes too expensive for the generic kernels? I hope not.
we may need to revisit apic_is_clustered_box()
/*
* apic_is_clustered_box() -- Check if we can expect good TSC *
* Thus far, the major user of this is IBM's Summit2 series:
*
* Clustered boxes may have unsynced TSC problems if they are
* multi-chassis. Use available data to take a good guess.
* If in doubt, go HPET.
*/__cpuinit int apic_is_clustered_box(void)
....
/*
* If clusters > 2, then should be multi-chassis.
* May have to revisit this when multi-core + hyperthreaded CPUs come
* out, but AFAIK this will work even for them.
*/
with intel new cpus with 8 cores and HT enabled, even 2 sockets system will get 3 (?) so called "apic cluster"
we really need to use dmi etc way to detect multi-chassis system from now on
YH
Quoted 11 lines · Ravikiran G Thirumalai
Quoted 9 lines · Ingo Molnar
Quoted 3 lines · Ravikiran G Thirumalai
True, but by how much? 212 bytes, out of 7285943 bytes which is very very small percentage wise.
How does this eliminate the validity of the patch?
Quoted 16 lines
It costs 212 bytes to leave
is_vsmp_box()to not just be a dummy no-op. Havingis_vsmp_box()detect if the hardware is indeed vSMP, is meaningful even whenCONFIG_VSMPis not turned on. This is becauseis_vsmp_box()is used to tell the kernel, that although the cpus being used are supposed to have TSCs in sync, they are not really in sync. This is because you cannot ensure TSCs won't drift between multiple boards being aggregated on vSMP systems. Take the case of distro kernels. Distro kernels typically do not haveCONFIG_X86_VSMPon. Due to the large internode cacheline setting,CONFIG_VSMPwould not be on on the generic distro installer kernels. Ifis_vsmp_box()is a no-op, the generic distro installer kernels will assume TSCs to be synched, which is bad. Hence, it will be nice if, for the cost of 212 bytes, vsmp64.o be compiled either unconditionally, OR conditionally for 64bit architectures only. The question is, is 212 bytes out of 7285943 bytes too expensive for the generic kernels? I hope not.
Sorry - got distracted and forgot about this thread. The TSC quirk indeed looks required for your systems - you dont have a reliable TSC due to virtualization, right?
Mind sending a patch (partial revert or so) against latest -tip that fixes that?
Ingo
Quoted 31 lines · Ingo Molnar
Quoted 11 lines · Ravikiran G Thirumalai
Quoted 9 lines · Ingo Molnar
Quoted 3 lines · Ravikiran G Thirumalai
True, but by how much? 212 bytes, out of 7285943 bytes which is very very small percentage wise.
How does this eliminate the validity of the patch?
Quoted 16 lines
It costs 212 bytes to leave
is_vsmp_box()to not just be a dummy no-op. Havingis_vsmp_box()detect if the hardware is indeed vSMP, is meaningful even whenCONFIG_VSMPis not turned on. This is becauseis_vsmp_box()is used to tell the kernel, that although the cpus being used are supposed to have TSCs in sync, they are not really in sync. This is because you cannot ensure TSCs won't drift between multiple boards being aggregated on vSMP systems. Take the case of distro kernels. Distro kernels typically do not haveCONFIG_X86_VSMPon. Due to the large internode cacheline setting,CONFIG_VSMPwould not be on on the generic distro installer kernels. Ifis_vsmp_box()is a no-op, the generic distro installer kernels will assume TSCs to be synched, which is bad. Hence, it will be nice if, for the cost of 212 bytes, vsmp64.o be compiled either unconditionally, OR conditionally for 64bit architectures only. The question is, is 212 bytes out of 7285943 bytes too expensive for the generic kernels? I hope not.
Quoted 4 lines
Sorry - got distracted and forgot about this thread. The TSC quirk indeed looks required for your systems - you dont have a reliable TSC due to virtualization, right?
Yes. Also, because there is no way to avoid tsc drift on multiple boards/nodes.
Quoted 3 lines
Mind sending a patch (partial revert or so) against latest -tip that fixes that?
Sure. Here's a revert, it is a partial revert which compiles vsmp64.c only for 64bit architectures.
Thanks,
Kiran
Partial revert of commit 129d8bc828e011bda0b7110a097bf3a0167f966e titled 'x86: don't compile vsmp_64 for 32bit'
Commit reverted to compile vsmp_64.c if CONFIG_X86_64 is defined, since is_vsmp_box() needs to indicate that TSCs are not synchronized, and hence, not a valid time source, even when CONFIG_X86_VSMP is not defined.
arch/x86/include/asm/apic.h +1 -1
@@ -75,7 +75,7 @@ static inline void default_inquire_remot#define setup_secondary_clock setup_secondary_APIC_clock#endif -#ifdef CONFIG_X86_VSMP +#ifdef CONFIG_X86_64 extern int is_vsmp_box (void );#else static inline int is_vsmp_box (void )
arch/x86/include/asm/setup.h +1 -1
@@ -64,7 +64,7 @@ extern void x86_quirk_time_init(void);#include <asm/bootparam.h> /* Interrupt control for vSMPowered x86_64 systems */ -#ifdef CONFIG_X86_VSMP +#ifdef CONFIG_X86_64 void vsmp_init (void );#else static inline void vsmp_init (void ) { }
arch/x86/kernel/Makefile +1 -1
@@ -71,7 +71,6 @@ obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace. obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o -obj-$(CONFIG_X86_VSMP) += vsmp_64.o obj-$(CONFIG_KPROBES) += kprobes.o obj-$(CONFIG_MODULES) += module_$(BITS).o obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
@@ -121,4 +120,5 @@ ifeq ($(CONFIG_X86_64),y) obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o + obj-y += vsmp_64.o endif
arch/x86/kernel/vsmp_64.c +11 -1
@@ -22,7 +22,7 @@#include <asm/paravirt.h> #include <asm/setup.h> -#ifdef CONFIG_PARAVIRT +#if definedCONFIG_PCI && definedCONFIG_PARAVIRT /* * Interrupt control on vSMPowered systems: * ~AC is a shadow of IF. If IF is 'on' AC should be 'off'
@@ -114,6 +114,7 @@ static void __init set_vsmp_pv_ops(void) }#endif +#ifdef CONFIG_PCI static int is_vsmp =-1 ;static void __init detect_vsmp_box (void )
@@ -139,6 +140,15 @@ int is_vsmp_box(void) } } +#else +static void __init detect_vsmp_box (void ) +{ +} +int is_vsmp_box (void ) +{ +return 0 ; +} +#endif void __init vsmp_init (void ) {detect_vsmp_box ();
Quoted 2 lines · Ravikiran G Thirumalai
Sure. Here's a revert, it is a partial revert which compiles
vsmp64.conly for 64bit architectures.
hm, why dont you add 'depends on X86_64' to the X86_VSMP Kconfig rules? That's far clear - or am i missing some detail?
Ingo
Quoted 8 lines · Ingo Molnar
Quoted 2 lines · Ravikiran G Thirumalai
Sure. Here's a revert, it is a partial revert which compiles
vsmp64.conly for 64bit architectures.hm, why dont you add 'depends on
X86_64' to theX86_VSMPKconfigrules? That's far clear - or am i missing some detail?
It is already there, and has been there! But we still need to make vsmp64.c compile only when CONFIG_X86_64 is defined no?
Thanks,
Kiran
Quoted 3 lines · Ravikiran G Thirumalai
It is already there, and has been there! But we still need to make
vsmp64.ccompile only whenCONFIG_X86_64is defined no?
I still think you should restructure it so that vsmp_64.c only gets compiled with CONFIG_X86_VSMP enabled. Having all that stuff compiled into every kernel seems pretty pointless.
J
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 3 lines · Ravikiran G Thirumalai
It is already there, and has been there! But we still need to make
vsmp64.ccompile only whenCONFIG_X86_64is defined no?I still think you should restructure it so that
vsmp_64.conly gets compiled withCONFIG_X86_VSMPenabled. Having all that stuff compiled into every kernel seems pretty pointless.
Well, not everything gets compiled in. Only the is_vsmp_box() logic and related stuff gets compiled in. Other paravirt related stuff in vsmp64.c depends on CONFIG_PARAVIRT.
Thanks,
Kiran
Quoted 8 lines · Ravikiran G Thirumalai
Quoted 6 lines · Jeremy Fitzhardinge
Quoted 4 lines · Ravikiran G Thirumalai
It is already there, and has been there! But we still need to make
vsmp64.ccompile only whenCONFIG_X86_64is defined no?
Quoted 8 lines
Quoted 3 lines
I still think you should restructure it so that
vsmp_64.conly gets compiled withCONFIG_X86_VSMPenabled. Having all that stuff compiled into every kernel seems pretty pointless.Well, not everything gets compiled in. Only the
is_vsmp_box()logic and related stuff gets compiled in. Other paravirt related stuff invsmp64.cdepends onCONFIG_PARAVIRT.
Sure, but it would be cleaner if the whole file were controlled by CONFIG_X86_VSMP. is_vsmp_box() is already defined as const inline returning 0 if !CONFIG_X86_VSMP.
J
Quoted 3 lines
Thanks,
Kiran
Quoted 14 lines · Jeremy Fitzhardinge
Quoted 13 lines · Ravikiran G Thirumalai
Quoted 10 lines · Jeremy Fitzhardinge
Quoted 3 lines · Ravikiran G Thirumalai
It is already there, and has been there! But we still need to make
vsmp64.ccompile only whenCONFIG_X86_64is defined no?I still think you should restructure it so that
vsmp_64.conly gets compiled withCONFIG_X86_VSMPenabled. Having all that stuff compiled into every kernel seems pretty pointless.
Quoted 9 lines
Quoted 4 lines
Well, not everything gets compiled in. Only the
is_vsmp_box()logic and related stuff gets compiled in. Other paravirt related stuff invsmp64.cdepends onCONFIG_PARAVIRT.Sure, but it would be cleaner if the whole file were controlled by
CONFIG_X86_VSMP.is_vsmp_box()is already defined as const inline returning 0 if !CONFIG_X86_VSMP.
The point in this thread was, is_vsmp_box() needs to be meaningful even when CONFIG_X86_VSMP is not on. This is needed because is_vsmp_box() is used to determine if the platform has reliable tscs.
Quoted 8 lines · Ravikiran G Thirumalai
Quoted 4 lines
Sure, but it would be cleaner if the whole file were controlled by
CONFIG_X86_VSMP.is_vsmp_box()is already defined as const inline returning 0 if !CONFIG_X86_VSMP.The point in this thread was,
is_vsmp_box()needs to be meaningful even whenCONFIG_X86_VSMPis not on. This is needed becauseis_vsmp_box()is used to determine if the platform has reliable tscs.
Did you even read what Jeremy wrote or bother to look at the code in arch/x86/include/asm/apic.h ?
#ifdef CONFIG_X86_VSMP
extern int is_vsmp_box(void);
#else
static inline int is_vsmp_box(void)
{
return 0;
}#endif
So the .c file is completely useless if CONFIG_X86_VSMP=n.
Thanks,
tglx
Quoted 4 lines · Ravikiran G Thirumalai
The point in this thread was,
is_vsmp_box()needs to be meaningful even whenCONFIG_X86_VSMPis not on. This is needed becauseis_vsmp_box()is used to determine if the platform has reliable tscs.
Well, as I said, that code is inoperative at present. But aside from that, how well will a non-VSMP kernel work on your hardware, with a normal cacheline, etc. Is the tsc stability really all that important, given that the kernel should notice if the tsc is busted pretty quickly anyway.
unsynchronized_tsc() just returns a guess anyway, and if you don't have X86_FEATURE_CONSTANT_TSC set, then it will return unstable for your hardware anyway, even without the is_vsmp_box() test.
Failing that, you could add yourself to bad_tsc_dmi_table[] and have that mark the tsc as unstable (you have DMI, right?).
J
Quoted 6 lines · Thomas Gleixner
Quoted 5 lines · Ravikiran G Thirumalai
Quoted 4 lines
Sure, but it would be cleaner if the whole file were controlled by
CONFIG_X86_VSMP.is_vsmp_box()is already defined as const inline returning 0 if !CONFIG_X86_VSMP.
Quoted 7 lines
Quoted 3 lines
The point in this thread was,
is_vsmp_box()needs to be meaningful even whenCONFIG_X86_VSMPis not on. This is needed becauseis_vsmp_box()is used to determine if the platform has reliable tscs.Did you even read what Jeremy wrote or bother to look at the code in
arch/x86/include/asm/apic.h?
Might I politely point out the origin of this code:
http://lkml.org/lkml/2009/2/26/5
Please note the subject of the patch in the link and the subject of this discussion. It is the same thread. The patch was commited to tip and is still being discussed if it is any clarification :)
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 6 lines · Ravikiran G Thirumalai
The point in this thread was,
is_vsmp_box()needs to be meaningful even whenCONFIG_X86_VSMPis not on. This is needed becauseis_vsmp_box()is used to
determine if the platform has reliable tscs.Well, as I said, that code is inoperative at present. But aside from that,
If you read this thread completely and the patch that is being discussed, you'd find that code would be operative.
Here's a threaded view of the complete discussion as we discuss for everyone's convenience, as people seem to be jumping into the discussion without actually reading up the context of the discussion.
http://lkml.org/lkml/2009/2/26/5
Quoted 4 lines
how well will a non-VSMP kernel work on your hardware, with a normal cacheline, etc. Is the tsc stability really all that important, given that the kernel should notice if the tsc is busted pretty quickly anyway.
The installer kernels do not have vSMP enabled, and needs to be atleast able to install the full distro reliably.
Quoted 3 lines
unsynchronized_tsc()just returns a guess anyway, and if you don't haveX86_FEATURE_CONSTANT_TSCset, then it will return unstable for your hardware anyway, even without theis_vsmp_box()test.
Unfortunately we use hardware which has X86_FEATURE_CONSTANT_TSC.
Quoted 4 lines
Failing that, you could add yourself to bad_tsc_dmi_table[] and have that mark the tsc as unstable (you have DMI, right?).
Newer versions of the VMM does, but older ones don't :(, and obviously we have older versions out in the field that still needs to be supported.
[tip:x86/apic] Revert "x86: don't compile vsmp_64 for 32bit"
In reply to Ravikiran G ThirumalaiCommit-ID: 70511134f61bd6e5eed19f767381f9fb3e762d49 Gitweb: http://git.kernel.org/tip/70511134f61bd6e5eed19f767381f9fb3e762d49 Author: Ravikiran G Thirumalai <[email protected]> AuthorDate: Mon, 23 Mar 2009 23:14:29 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 25 Mar 2009 21:34:28 +0100
Revert "x86: don't compile vsmp_64 for 32bit"
Partial revert of commit 129d8bc828e011bda0b7110a097bf3a0167f966e titled 'x86: don't compile vsmp_64 for 32bit'
Commit reverted to compile vsmp_64.c if CONFIG_X86_64 is defined, since is_vsmp_box() needs to indicate that TSCs are not synchronized, and hence, not a valid time source, even when CONFIG_X86_VSMP is not defined.
LKML-Reference: <20090324061429.GH7278@localdomain>
--- arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/setup.h | 2 +- arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/vsmp_64.c | 12 +++++++++++- 4 files changed, 14 insertions(+), 4 deletions(-)
arch/x86/include/asm/apic.h +1 -1
@@ -75,7 +75,7 @@ static inline void default_inquire_remote_apic(int apicid)#define setup_secondary_clock setup_secondary_APIC_clock#endif -#ifdef CONFIG_X86_VSMP +#ifdef CONFIG_X86_64 extern int is_vsmp_box (void );#else static inline int is_vsmp_box (void )
arch/x86/include/asm/setup.h +1 -1
@@ -64,7 +64,7 @@ extern void x86_quirk_time_init(void);#include <asm/bootparam.h> /* Interrupt control for vSMPowered x86_64 systems */ -#ifdef CONFIG_X86_VSMP +#ifdef CONFIG_X86_64 void vsmp_init (void );#else static inline void vsmp_init (void ) { }
arch/x86/kernel/Makefile +1 -1
@@ -70,7 +70,6 @@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o -obj-$(CONFIG_X86_VSMP) += vsmp_64.o obj-$(CONFIG_KPROBES) += kprobes.o obj-$(CONFIG_MODULES) += module_$(BITS).o obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
@@ -120,4 +119,5 @@ ifeq ($(CONFIG_X86_64),y) obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o + obj-y += vsmp_64.o endif
arch/x86/kernel/vsmp_64.c +11 -1
@@ -22,7 +22,7 @@#include <asm/paravirt.h> #include <asm/setup.h> -#ifdef CONFIG_PARAVIRT +#if definedCONFIG_PCI && definedCONFIG_PARAVIRT /* * Interrupt control on vSMPowered systems: * ~AC is a shadow of IF. If IF is 'on' AC should be 'off'
@@ -114,6 +114,7 @@ static void __init set_vsmp_pv_ops(void) }#endif +#ifdef CONFIG_PCI static int is_vsmp =-1 ;static void __init detect_vsmp_box (void )
@@ -139,6 +140,15 @@ int is_vsmp_box(void) } } +#else +static void __init detect_vsmp_box (void ) +{ +} +int is_vsmp_box (void ) +{ +return 0 ; +} +#endif void __init vsmp_init (void ) {detect_vsmp_box ();
Quoted 8 lines · Ravikiran G Thirumalai
Quoted 4 lines
unsynchronized_tsc()just returns a guess anyway, and if you don't haveX86_FEATURE_CONSTANT_TSCset, then it will return unstable for your hardware anyway, even without theis_vsmp_box()test.Unfortunately we use hardware which has
X86_FEATURE_CONSTANT_TSC.Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Failing that, you could add yourself to bad_tsc_dmi_table[] and have that mark the tsc as unstable (you have DMI, right?).
Newer versions of the VMM does, but older ones don't :(, and obviously we have older versions out in the field that still needs to be supported.
But those old versions wont have X86_FEATURE_CONSTANT_TSC set, right?
Ingo
Quoted 15 lines · Ingo Molnar
Quoted 12 lines · Ravikiran G Thirumalai
Quoted 4 lines
unsynchronized_tsc()just returns a guess anyway, and if you don't haveX86_FEATURE_CONSTANT_TSCset, then it will return unstable for your hardware anyway, even without theis_vsmp_box()test.Unfortunately we use hardware which has
X86_FEATURE_CONSTANT_TSC.Quoted 4 lines
Failing that, you could add yourself to bad_tsc_dmi_table[] and have that mark the tsc as unstable (you have DMI, right?).
Quoted 6 lines
Quoted 3 lines
Newer versions of the VMM does, but older ones don't :(, and obviously we have older versions out in the field that still needs to be supported.
But those old versions wont have
X86_FEATURE_CONSTANT_TSCset, right?
No, the old versions also do have X86_FEATURE_CONSTANT_TSC. The kernel assumes that even netburst based cpus have synced tscs (of course this is never mentioned in the intel documentation, but in the past we've been told that that intel engineers say so -- that tscs are synced and guaranteed to not drift between intel cpus)
Here's the code that sets X86_FEATURE_CONSTANT_TSC.
static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
{
if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
(c->x86 == 0x6 && c->x86_model >= 0x0e))
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);...
Thanks,
Kiran