mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC patch] need check TSC wrap unconditionally
@ 2009-08-14  4:15 Luming Yu
  2009-08-21 16:37 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Luming Yu @ 2009-08-14  4:15 UTC (permalink / raw)
  To: LKML

[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]

Hi there,

we disabled tsc wrap check on any platform that has NOSTOP_TSC cpu. But this
will cause some real problem.For example, 1.CPU does has constant and
non_stop tsc, which means different CPU ticks at same rate in same domain,but
have been given different initial TSC value.Then at any given time,
CPUsare unsynchronized.
2. if those CPUs are sit in different domain..(multi-chassis cluster system?)

Please review. If make sense, please apply.

**The patch is enclosed in text attachment*
**Using web client to send the patch* *
**below is for review, please apply attached  patch*/

Thanks,
Luming

Signed-off-by: Yu Luming <luming.yu@intel.com>

 arch/x86/kernel/tsc_sync.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 027b5b4..312ba84 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -113,11 +113,6 @@ void __cpuinit check_tsc_sync_source(int cpu)
        if (unsynchronized_tsc())
                return;

-       if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) {
-               pr_info("Skipping synchronization checks as TSC is
reliable.\n");
-               return;
-       }
-
        pr_info("checking TSC synchronization [CPU#%d -> CPU#%d]:",
                smp_processor_id(), cpu);

@@ -171,7 +166,7 @@ void __cpuinit check_tsc_sync_target(void)
 {
        int cpus = 2;

-       if (unsynchronized_tsc() || boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
+       if (unsynchronized_tsc())
                return;

        /*

[-- Attachment #2: 7 --]
[-- Type: application/octet-stream, Size: 700 bytes --]

diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 027b5b4..312ba84 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -113,11 +113,6 @@ void __cpuinit check_tsc_sync_source(int cpu)
 	if (unsynchronized_tsc())
 		return;
 
-	if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) {
-		pr_info("Skipping synchronization checks as TSC is reliable.\n");
-		return;
-	}
-
 	pr_info("checking TSC synchronization [CPU#%d -> CPU#%d]:",
 		smp_processor_id(), cpu);
 
@@ -171,7 +166,7 @@ void __cpuinit check_tsc_sync_target(void)
 {
 	int cpus = 2;
 
-	if (unsynchronized_tsc() || boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
+	if (unsynchronized_tsc())
 		return;
 
 	/*

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

* Re: [RFC patch] need check TSC wrap unconditionally
  2009-08-14  4:15 [RFC patch] need check TSC wrap unconditionally Luming Yu
@ 2009-08-21 16:37 ` Peter Zijlstra
  2009-08-24  2:30   ` Luming Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2009-08-21 16:37 UTC (permalink / raw)
  To: Luming Yu; +Cc: LKML, Ingo Molnar, Thomas Gleixner

On Fri, 2009-08-14 at 12:15 +0800, Luming Yu wrote:
> Hi there,

Hi, thanks for CC'ing the right folks.

> we disabled tsc wrap check on any platform that has NOSTOP_TSC cpu. But this
> will cause some real problem.For example, 1.CPU does has constant and
> non_stop tsc, which means different CPU ticks at same rate in same domain,but
> have been given different initial TSC value.Then at any given time,
> CPUsare unsynchronized.
> 2. if those CPUs are sit in different domain..(multi-chassis cluster system?)
> 
> Please review. If make sense, please apply.

Right, so because your machine is funny, everybody with a good machine
should suffer?

If the TSCs run at identical frequency (one time domain) but at
different offsets, you can fix that by using cyc2ns_offset.

When the machine has unsynchonized frequencies (multiple time domains),
detect that during cpu enumeration and use that to disable the
optimization.

> Signed-off-by: Yu Luming <luming.yu@intel.com>

>  arch/x86/kernel/tsc_sync.c |    7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
> index 027b5b4..312ba84 100644
> --- a/arch/x86/kernel/tsc_sync.c
> +++ b/arch/x86/kernel/tsc_sync.c
> @@ -113,11 +113,6 @@ void __cpuinit check_tsc_sync_source(int cpu)
>         if (unsynchronized_tsc())
>                 return;
> 
> -       if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) {
> -               pr_info("Skipping synchronization checks as TSC is
> reliable.\n");
> -               return;
> -       }
> -
>         pr_info("checking TSC synchronization [CPU#%d -> CPU#%d]:",
>                 smp_processor_id(), cpu);
> 
> @@ -171,7 +166,7 @@ void __cpuinit check_tsc_sync_target(void)
>  {
>         int cpus = 2;
> 
> -       if (unsynchronized_tsc() || boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
> +       if (unsynchronized_tsc())
>                 return;
> 
>         /*

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

* Re: [RFC patch] need check TSC wrap unconditionally
  2009-08-21 16:37 ` Peter Zijlstra
@ 2009-08-24  2:30   ` Luming Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Luming Yu @ 2009-08-24  2:30 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: LKML, Ingo Molnar, Thomas Gleixner

On Sat, Aug 22, 2009 at 12:37 AM, Peter Zijlstra<peterz@infradead.org> wrote:
> On Fri, 2009-08-14 at 12:15 +0800, Luming Yu wrote:
>> Hi there,
>
> Hi, thanks for CC'ing the right folks.
>
>> we disabled tsc wrap check on any platform that has NOSTOP_TSC cpu. But this
>> will cause some real problem.For example, 1.CPU does has constant and
>> non_stop tsc, which means different CPU ticks at same rate in same domain,but
>> have been given different initial TSC value.Then at any given time,
>> CPUsare unsynchronized.
>> 2. if those CPUs are sit in different domain..(multi-chassis cluster system?)
>>
>> Please review. If make sense, please apply.
>
> Right, so because your machine is funny, everybody with a good machine
> should suffer?

How comes? Good machine will pass the check without any problem.

>
> If the TSCs run at identical frequency (one time domain) but at
> different offsets, you can fix that by using cyc2ns_offset.

iirc, in old kernel, there was a function trying to re-sync TSC. But
it has been removed..
Should I re-introduce something that has been deleted. It is odd to do such
kind of thing to me if I don't know why it was deleted.

>
> When the machine has unsynchonized frequencies (multiple time domains),
> detect that during cpu enumeration and use that to disable the
> optimization.

yes.

>
>> Signed-off-by: Yu Luming <luming.yu@intel.com>
>
>>  arch/x86/kernel/tsc_sync.c |    7 +------
>>  1 file changed, 1 insertion(+), 6 deletions(-)
>>
>> diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
>> index 027b5b4..312ba84 100644
>> --- a/arch/x86/kernel/tsc_sync.c
>> +++ b/arch/x86/kernel/tsc_sync.c
>> @@ -113,11 +113,6 @@ void __cpuinit check_tsc_sync_source(int cpu)
>>         if (unsynchronized_tsc())
>>                 return;
>>
>> -       if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) {
>> -               pr_info("Skipping synchronization checks as TSC is
>> reliable.\n");
>> -               return;
>> -       }
>> -
>>         pr_info("checking TSC synchronization [CPU#%d -> CPU#%d]:",
>>                 smp_processor_id(), cpu);
>>
>> @@ -171,7 +166,7 @@ void __cpuinit check_tsc_sync_target(void)
>>  {
>>         int cpus = 2;
>>
>> -       if (unsynchronized_tsc() || boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
>> +       if (unsynchronized_tsc())
>>                 return;
>>
>>         /*
>

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

end of thread, other threads:[~2009-08-24  2:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-14  4:15 [RFC patch] need check TSC wrap unconditionally Luming Yu
2009-08-21 16:37 ` Peter Zijlstra
2009-08-24  2:30   ` Luming Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®