All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: fix numaq_tsc_disable calling
@ 2008-07-13  5:52 Yinghai Lu
  2008-07-13  6:25 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Yinghai Lu @ 2008-07-13  5:52 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: LKML


got
calling  numaq_tsc_disable+0x0/0x39
NUMAQ: disabling TSC
initcall numaq_tsc_disable+0x0/0x39 returned 0 after 0 msecs

we can not use arch_initcall to call it.

need to call it in setup_arch before time_init()/tsc_init()
and call it init_intel to make cpu feature right.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/cpu/intel.c |    4 ++++
 arch/x86/kernel/numaq_32.c  |    7 ++++---
 arch/x86/kernel/setup.c     |    8 ++++++++
 include/asm-x86/numaq.h     |    2 ++
 4 files changed, 18 insertions(+), 3 deletions(-)

Index: linux-2.6/arch/x86/kernel/cpu/intel.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/intel.c
+++ linux-2.6/arch/x86/kernel/cpu/intel.c
@@ -227,6 +227,10 @@ static void __cpuinit init_intel(struct
 
 	if (cpu_has_bts)
 		ptrace_bts_init_intel(c);
+
+#ifdef CONFIG_X86_NUMAQ
+	numaq_tsc_disable();
+#endif
 }
 
 static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 *c, unsigned int size)
Index: linux-2.6/arch/x86/kernel/numaq_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/numaq_32.c
+++ linux-2.6/arch/x86/kernel/numaq_32.c
@@ -93,12 +93,13 @@ int __init get_memcfg_numaq(void)
 	return 1;
 }
 
-static int __init numaq_tsc_disable(void)
+void __init numaq_tsc_disable(void)
 {
+	if (!found_numaq)
+		return -1;
+
 	if (num_online_nodes() > 1) {
 		printk(KERN_DEBUG "NUMAQ: disabling TSC\n");
 		setup_clear_cpu_cap(X86_FEATURE_TSC);
 	}
-	return 0;
 }
-arch_initcall(numaq_tsc_disable);
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -859,6 +859,14 @@ void __init setup_arch(char **cmdline_p)
 	init_cpu_to_node();
 #endif
 
+#ifdef CONFIG_X86_NUMAQ
+	/*
+	 * need to check online nodes num, call it
+	 * here before time_init/tsc_init
+	 */
+	numaq_tsc_disable();
+#endif
+
 	init_apic_mappings();
 	ioapic_init_mappings();
 
Index: linux-2.6/include/asm-x86/numaq.h
===================================================================
--- linux-2.6.orig/include/asm-x86/numaq.h
+++ linux-2.6/include/asm-x86/numaq.h
@@ -157,6 +157,8 @@ struct sys_cfg_data {
 	struct		eachquadmem eq[MAX_NUMNODES];	/* indexed by quad id */
 };
 
+void numaq_tsc_disable(void);
+
 #else
 static inline int get_memcfg_numaq(void)
 {

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: fix numaq_tsc_disable calling
  2008-07-13  5:52 [PATCH] x86: fix numaq_tsc_disable calling Yinghai Lu
@ 2008-07-13  6:25 ` Ingo Molnar
  2008-07-13  6:31   ` Yinghai Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2008-07-13  6:25 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, LKML


* Yinghai Lu <yhlu.kernel@gmail.com> wrote:

>  	if (cpu_has_bts)
>  		ptrace_bts_init_intel(c);
> +
> +#ifdef CONFIG_X86_NUMAQ
> +	numaq_tsc_disable();
> +#endif

could you please one more cleanup and hide the CONFIG_X86_NUMAQ in the 
header file, so that we can just call numaq_tsc_disable() without an
#ifdef?

also, that TSC quirk should probably be turned into an explicit quirk 
function pointer initialized by the early-init NUMAQ code and left NULL 
by everything else - like we it on visws. See include/asm-x86/setup.h:

 /*
  * Any setup quirks to be performed?
  */
 extern int (*arch_time_init_quirk)(void);
 extern int (*arch_pre_intr_init_quirk)(void);
 extern int (*arch_intr_init_quirk)(void);
 extern int (*arch_trap_init_quirk)(void);
 extern char * (*arch_memory_setup_quirk)(void);
 extern int (*mach_get_smp_config_quirk)(unsigned int early);
 extern int (*mach_find_smp_config_quirk)(unsigned int reserve);

the goal is to offload all non-standard setup that is not a reasonable 
deviation of some of the major vendors to such a quirk handler. Quirks 
are a lot easier to maintain and a lot easier to think about - they can 
be just by-line functionality to the main body of default behavior.

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: fix numaq_tsc_disable calling
  2008-07-13  6:25 ` Ingo Molnar
@ 2008-07-13  6:31   ` Yinghai Lu
  2008-07-13  6:48     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Yinghai Lu @ 2008-07-13  6:31 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, H. Peter Anvin, LKML

On Sat, Jul 12, 2008 at 11:25 PM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>
>>       if (cpu_has_bts)
>>               ptrace_bts_init_intel(c);
>> +
>> +#ifdef CONFIG_X86_NUMAQ
>> +     numaq_tsc_disable();
>> +#endif
>
> could you please one more cleanup and hide the CONFIG_X86_NUMAQ in the
> header file, so that we can just call numaq_tsc_disable() without an
> #ifdef?
>
> also, that TSC quirk should probably be turned into an explicit quirk
> function pointer initialized by the early-init NUMAQ code and left NULL
> by everything else - like we it on visws. See include/asm-x86/setup.h:
>
>  /*
>  * Any setup quirks to be performed?
>  */
>  extern int (*arch_time_init_quirk)(void);
>  extern int (*arch_pre_intr_init_quirk)(void);
>  extern int (*arch_intr_init_quirk)(void);
>  extern int (*arch_trap_init_quirk)(void);
>  extern char * (*arch_memory_setup_quirk)(void);
>  extern int (*mach_get_smp_config_quirk)(unsigned int early);
>  extern int (*mach_find_smp_config_quirk)(unsigned int reserve);
>
> the goal is to offload all non-standard setup that is not a reasonable
> deviation of some of the major vendors to such a quirk handler. Quirks
> are a lot easier to maintain and a lot easier to think about - they can
> be just by-line functionality to the main body of default behavior.

looks neat.

can we use one big arch_mach_quicks struct..?

YH

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: fix numaq_tsc_disable calling
  2008-07-13  6:31   ` Yinghai Lu
@ 2008-07-13  6:48     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2008-07-13  6:48 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, LKML


* Yinghai Lu <yhlu.kernel@gmail.com> wrote:

> On Sat, Jul 12, 2008 at 11:25 PM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> >
> >>       if (cpu_has_bts)
> >>               ptrace_bts_init_intel(c);
> >> +
> >> +#ifdef CONFIG_X86_NUMAQ
> >> +     numaq_tsc_disable();
> >> +#endif
> >
> > could you please one more cleanup and hide the CONFIG_X86_NUMAQ in the
> > header file, so that we can just call numaq_tsc_disable() without an
> > #ifdef?
> >
> > also, that TSC quirk should probably be turned into an explicit quirk
> > function pointer initialized by the early-init NUMAQ code and left NULL
> > by everything else - like we it on visws. See include/asm-x86/setup.h:
> >
> >  /*
> >  * Any setup quirks to be performed?
> >  */
> >  extern int (*arch_time_init_quirk)(void);
> >  extern int (*arch_pre_intr_init_quirk)(void);
> >  extern int (*arch_intr_init_quirk)(void);
> >  extern int (*arch_trap_init_quirk)(void);
> >  extern char * (*arch_memory_setup_quirk)(void);
> >  extern int (*mach_get_smp_config_quirk)(unsigned int early);
> >  extern int (*mach_find_smp_config_quirk)(unsigned int reserve);
> >
> > the goal is to offload all non-standard setup that is not a reasonable
> > deviation of some of the major vendors to such a quirk handler. Quirks
> > are a lot easier to maintain and a lot easier to think about - they can
> > be just by-line functionality to the main body of default behavior.
> 
> looks neat.
> 
> can we use one big arch_mach_quicks struct..?

yeah, good idea.

Perhaps name it x86_quirks to make it really short to check it. Then 
consolidate all of our scattered quirks into it. I bet we could get some 
of the paravirt details into this as well.

So something like:

        if (arch_time_init_quirk) {
                /*
                 * A nonzero return code does not mean failure, it means
                 * that the architecture quirk does not want any
                 * generic (timer) setup to be performed after this:
                 */
                if (arch_time_init_quirk())
                        return;
        }

Would turn into:

	if (x86_quirks.time_init) {
		if (x86_quirks.time_init())
			return;
	}
	[ ... regular init ...]

So that the return code of x86_quirks.time_init() can be used to signal 
whether a quirk wants the regular init to run or not. In the VisWS case 
this allowed further consolidation.

We dont want any chaining (i.e. dont use notifiers or anything) as these 
quirks are all exclusive anyway.

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-13  6:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-13  5:52 [PATCH] x86: fix numaq_tsc_disable calling Yinghai Lu
2008-07-13  6:25 ` Ingo Molnar
2008-07-13  6:31   ` Yinghai Lu
2008-07-13  6:48     ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.