public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-19 19:42   ` john stultz
@ 2005-09-19 19:49     ` Andi Kleen
  2005-09-20 18:59       ` john stultz
  0 siblings, 1 reply; 12+ messages in thread
From: Andi Kleen @ 2005-09-19 19:49 UTC (permalink / raw)
  To: john stultz; +Cc: Andi Kleen, Andrew Morton, lkml, discuss

On Mon, Sep 19, 2005 at 12:42:16PM -0700, john stultz wrote:
> On Mon, 2005-09-19 at 21:31 +0200, Andi Kleen wrote:
> > On Mon, Sep 19, 2005 at 12:16:43PM -0700, john stultz wrote:
> > > 	This patch should resolve the issue seen in bugme bug #5105, where it
> > > is assumed that dualcore x86_64 systems have synced TSCs. This is not
> > > the case, and alternate timesources should be used instead.
> > 
> > 
> > I asked AMD some time ago and they told me it was synchronized.
> > The TSC on K8 is C state invariant, but not P state invariant,
> > but P states always happen synchronized on dual cores.
> > 
> > So I'm not quite convinced of your explanation yet.
> 
> Would a litter userspace test checking the TSC synchronization maybe
> shed additional light on the issue?

Sure you can try it.

-Andi

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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-19 19:49     ` [discuss] " Andi Kleen
@ 2005-09-20 18:59       ` john stultz
  2005-09-21  4:03         ` Daniel Jacobowitz
  0 siblings, 1 reply; 12+ messages in thread
From: john stultz @ 2005-09-20 18:59 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, lkml, discuss

On Mon, 2005-09-19 at 21:49 +0200, Andi Kleen wrote:
> On Mon, Sep 19, 2005 at 12:42:16PM -0700, john stultz wrote:
> > On Mon, 2005-09-19 at 21:31 +0200, Andi Kleen wrote:
> > > On Mon, Sep 19, 2005 at 12:16:43PM -0700, john stultz wrote:
> > > > 	This patch should resolve the issue seen in bugme bug #5105, where it
> > > > is assumed that dualcore x86_64 systems have synced TSCs. This is not
> > > > the case, and alternate timesources should be used instead.
> > > 
> > > 
> > > I asked AMD some time ago and they told me it was synchronized.
> > > The TSC on K8 is C state invariant, but not P state invariant,
> > > but P states always happen synchronized on dual cores.
> > > 
> > > So I'm not quite convinced of your explanation yet.
> > 
> > Would a litter userspace test checking the TSC synchronization maybe
> > shed additional light on the issue?
> 
> Sure you can try it.

So, bugzilla.kernel.org has (temporarily at least) lost the reports from
yesterday, but from the email i got, folks using my TSC consistency
check that I posted were seeing what appears to be unsynched TSCs on
dualcore AMD systems.

Personally I suspect that the powernow driver is putting the cores
independently into low power sleep and the TSCs are being independently
halted, causing them to become unsynchronized.

Do you still feel there is some other issue here? Any ideas for shaking
out whatever else might in play?

thanks
-john




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

* RE: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
@ 2005-09-20 19:13 Langsdorf, Mark
  2005-09-20 19:24 ` Scott Lampert
  0 siblings, 1 reply; 12+ messages in thread
From: Langsdorf, Mark @ 2005-09-20 19:13 UTC (permalink / raw)
  To: john stultz, Andi Kleen; +Cc: Andrew Morton, lkml, discuss

> On Mon, 2005-09-19 at 21:49 +0200, Andi Kleen wrote:
> > On Mon, Sep 19, 2005 at 12:42:16PM -0700, john stultz wrote:
> > > On Mon, 2005-09-19 at 21:31 +0200, Andi Kleen wrote:
> > > > On Mon, Sep 19, 2005 at 12:16:43PM -0700, john stultz wrote:
> > > > > 	This patch should resolve the issue seen in 
> bugme bug #5105, 
> > > > > where it is assumed that dualcore x86_64 systems have synced 
> > > > > TSCs. This is not the case, and alternate timesources 
> should be 
> > > > > used instead.
> > > > 
> > > > 
> > > > I asked AMD some time ago and they told me it was synchronized. 
> > > > The TSC on K8 is C state invariant, but not P state 
> invariant, but 
> > > > P states always happen synchronized on dual cores.
> > > > 
> > > > So I'm not quite convinced of your explanation yet.
> > > 
> > > Would a litter userspace test checking the TSC 
> synchronization maybe 
> > > shed additional light on the issue?
> > 
> > Sure you can try it.
> 
> So, bugzilla.kernel.org has (temporarily at least) lost the 
> reports from yesterday, but from the email i got, folks using 
> my TSC consistency check that I posted were seeing what 
> appears to be unsynched TSCs on dualcore AMD systems.

My understanding was that each TSC on a dual-core processor
will advance individually and atomically.  They will not 
always be in synchronization.

> Personally I suspect that the powernow driver is putting the 
> cores independently into low power sleep and the TSCs are 
> being independently halted, causing them to become unsynchronized.

The powernow-k8 driver doesn't know what a low power sleep state
is, so I strongly doubt it is involved here.  It only handles
pstates.
 
-Mark Langsdorf
K8 PowerNow! Maintainer
AMD, Inc.


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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-20 19:13 [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs Langsdorf, Mark
@ 2005-09-20 19:24 ` Scott Lampert
  2005-09-20 19:30   ` john stultz
  0 siblings, 1 reply; 12+ messages in thread
From: Scott Lampert @ 2005-09-20 19:24 UTC (permalink / raw)
  To: Langsdorf, Mark; +Cc: john stultz, Andi Kleen, Andrew Morton, lkml, discuss

Langsdorf, Mark wrote:

>>On Mon, 2005-09-19 at 21:49 +0200, Andi Kleen wrote:
>>    
>>
>>>On Mon, Sep 19, 2005 at 12:42:16PM -0700, john stultz wrote:
>>>      
>>>
>>>>On Mon, 2005-09-19 at 21:31 +0200, Andi Kleen wrote:
>>>>        
>>>>
>>>>>On Mon, Sep 19, 2005 at 12:16:43PM -0700, john stultz wrote:
>>>>>          
>>>>>
>>>>>>	This patch should resolve the issue seen in 
>>>>>>            
>>>>>>
>>bugme bug #5105, 
>>    
>>
>>>>>>where it is assumed that dualcore x86_64 systems have synced 
>>>>>>TSCs. This is not the case, and alternate timesources 
>>>>>>            
>>>>>>
>>should be 
>>    
>>
>>>>>>used instead.
>>>>>>            
>>>>>>
>>>>>I asked AMD some time ago and they told me it was synchronized. 
>>>>>The TSC on K8 is C state invariant, but not P state 
>>>>>          
>>>>>
>>invariant, but 
>>    
>>
>>>>>P states always happen synchronized on dual cores.
>>>>>
>>>>>So I'm not quite convinced of your explanation yet.
>>>>>          
>>>>>
>>>>Would a litter userspace test checking the TSC 
>>>>        
>>>>
>>synchronization maybe 
>>    
>>
>>>>shed additional light on the issue?
>>>>        
>>>>
>>>Sure you can try it.
>>>      
>>>
>>So, bugzilla.kernel.org has (temporarily at least) lost the 
>>reports from yesterday, but from the email i got, folks using 
>>my TSC consistency check that I posted were seeing what 
>>appears to be unsynched TSCs on dualcore AMD systems.
>>    
>>
>
>My understanding was that each TSC on a dual-core processor
>will advance individually and atomically.  They will not 
>always be in synchronization.
>
>  
>
>>Personally I suspect that the powernow driver is putting the 
>>cores independently into low power sleep and the TSCs are 
>>being independently halted, causing them to become unsynchronized.
>>    
>>
>
>The powernow-k8 driver doesn't know what a low power sleep state
>is, so I strongly doubt it is involved here.  It only handles
>pstates.
> 
>-Mark Langsdorf
>K8 PowerNow! Maintainer
>AMD, Inc.
>
>  
>

Just to add some end-user input here, I see the same issues regardless 
of whether I'm running with the powernow-k8 or not.  The clock problems 
seem to be unrelated to that, at least on my system.
    -Scott

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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-20 19:24 ` Scott Lampert
@ 2005-09-20 19:30   ` john stultz
  0 siblings, 0 replies; 12+ messages in thread
From: john stultz @ 2005-09-20 19:30 UTC (permalink / raw)
  To: Scott Lampert; +Cc: Langsdorf, Mark, Andi Kleen, Andrew Morton, lkml, discuss

On Tue, 2005-09-20 at 12:24 -0700, Scott Lampert wrote:
> Langsdorf, Mark wrote:
> >>Personally I suspect that the powernow driver is putting the 
> >>cores independently into low power sleep and the TSCs are 
> >>being independently halted, causing them to become unsynchronized.
> >
> >The powernow-k8 driver doesn't know what a low power sleep state
> >is, so I strongly doubt it is involved here.  It only handles
> >pstates.
> > 
> Just to add some end-user input here, I see the same issues regardless 
> of whether I'm running with the powernow-k8 or not.  The clock problems 
> seem to be unrelated to that, at least on my system.

Hmmm. Ok, I don't know the cpufreq/power management code well enough. 

I know some Intel cpus halt the TSC in C3. Could the ACPI code be
causing this? 

Could anyone with better knowledge speak to why it looks like the TSCs
are unsynced? Is my test flawed?

thanks
-john



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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-20 18:59       ` john stultz
@ 2005-09-21  4:03         ` Daniel Jacobowitz
  2005-09-21 15:15           ` Ray Bryant
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2005-09-21  4:03 UTC (permalink / raw)
  To: john stultz; +Cc: Andi Kleen, Andrew Morton, lkml, discuss

On Tue, Sep 20, 2005 at 11:59:45AM -0700, john stultz wrote:
> So, bugzilla.kernel.org has (temporarily at least) lost the reports from
> yesterday, but from the email i got, folks using my TSC consistency
> check that I posted were seeing what appears to be unsynched TSCs on
> dualcore AMD systems.
> 
> Personally I suspect that the powernow driver is putting the cores
> independently into low power sleep and the TSCs are being independently
> halted, causing them to become unsynchronized.
> 
> Do you still feel there is some other issue here? Any ideas for shaking
> out whatever else might in play?

FYI, at least I have reproduced this without powernow loaded.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-21 15:15           ` Ray Bryant
@ 2005-09-21 15:04             ` Andi Kleen
  2005-09-21 15:46               ` Ray Bryant
  2005-09-21 20:17               ` Andrew Morton
  0 siblings, 2 replies; 12+ messages in thread
From: Andi Kleen @ 2005-09-21 15:04 UTC (permalink / raw)
  To: Ray Bryant
  Cc: Daniel Jacobowitz, john stultz, Andi Kleen, Andrew Morton, lkml,
	discuss

On Wed, Sep 21, 2005 at 10:15:08AM -0500, Ray Bryant wrote:
> On Tuesday 20 September 2005 23:03, Daniel Jacobowitz wrote:
> 
> >
> > FYI, at least I have reproduced this without powernow loaded.
> 
> There are cases that we are aware of where the TSC will count slower while the 
> processor is halted.    This can make TSC's get out of sync on dual cores.

Ok thanks for the confirmation. I guess John's patch is ok then.
Drawback is much slower to extremly slow gettimeofday  (depending
if the chipset/BIOS has usable HPET, most seem not to) 

> 
> I wonder if you can reproduce this problem while also running a pair of cpu 
> bound tasks on your dual core box.   If you can't, then this is the culprit.
> 
> In general, however, on multisocket systems, you can't depend on TSC's being 
> synchronized between sockets, so all of this is moot.   We just have to deal 
> with it. 

We handle this, but single socket dual core was special cased because
I was told previously it should be ok.

-Andi

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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-21  4:03         ` Daniel Jacobowitz
@ 2005-09-21 15:15           ` Ray Bryant
  2005-09-21 15:04             ` Andi Kleen
  0 siblings, 1 reply; 12+ messages in thread
From: Ray Bryant @ 2005-09-21 15:15 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: john stultz, Andi Kleen, Andrew Morton, lkml, discuss

On Tuesday 20 September 2005 23:03, Daniel Jacobowitz wrote:

>
> FYI, at least I have reproduced this without powernow loaded.

There are cases that we are aware of where the TSC will count slower while the 
processor is halted.    This can make TSC's get out of sync on dual cores.

I wonder if you can reproduce this problem while also running a pair of cpu 
bound tasks on your dual core box.   If you can't, then this is the culprit.

In general, however, on multisocket systems, you can't depend on TSC's being 
synchronized between sockets, so all of this is moot.   We just have to deal 
with it. 

-- 
Ray Bryant
AMD Performance Labs                   Austin, Tx
512-602-0038 (o)                 512-507-7807 (c)


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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-21 15:04             ` Andi Kleen
@ 2005-09-21 15:46               ` Ray Bryant
  2005-09-22  8:00                 ` Jonas Oreland
  2005-09-21 20:17               ` Andrew Morton
  1 sibling, 1 reply; 12+ messages in thread
From: Ray Bryant @ 2005-09-21 15:46 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Daniel Jacobowitz, john stultz, Andrew Morton, lkml, discuss

On Wednesday 21 September 2005 10:04, Andi Kleen wrote:

>
> We handle this, but single socket dual core was special cased because
> I was told previously it should be ok.
>
> -Andi

AFAIK there is a processor state bit that enables/disables this behavior.
Apparently some BIOS's are setting this one way for desktop systems and the 
other way for servers.   If it is thought to be important I can track that 
down and see if it can be externally documented.  (It may actually be in the 
bios and kernel developer guide...)

-- 
Ray Bryant
AMD Performance Labs                   Austin, Tx
512-602-0038 (o)                 512-507-7807 (c)


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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-21 15:04             ` Andi Kleen
  2005-09-21 15:46               ` Ray Bryant
@ 2005-09-21 20:17               ` Andrew Morton
  1 sibling, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2005-09-21 20:17 UTC (permalink / raw)
  To: Andi Kleen; +Cc: raybry, dan, johnstul, ak, linux-kernel, discuss

Andi Kleen <ak@suse.de> wrote:
>
> On Wed, Sep 21, 2005 at 10:15:08AM -0500, Ray Bryant wrote:
> > On Tuesday 20 September 2005 23:03, Daniel Jacobowitz wrote:
> > 
> > >
> > > FYI, at least I have reproduced this without powernow loaded.
> > 
> > There are cases that we are aware of where the TSC will count slower while the 
> > processor is halted.    This can make TSC's get out of sync on dual cores.

You mean a single `hlt' instruction?   I guess that rules out resyncing them.

> Ok thanks for the confirmation. I guess John's patch is ok then.
> Drawback is much slower to extremly slow gettimeofday  (depending
> if the chipset/BIOS has usable HPET, most seem not to) 

That's a really big drawback.   Will this affect many CPU types?

If the user was prepared to use `idle=poll' then they could get their fast
gettimeofday() back, perhaps.


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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-09-21 15:46               ` Ray Bryant
@ 2005-09-22  8:00                 ` Jonas Oreland
  0 siblings, 0 replies; 12+ messages in thread
From: Jonas Oreland @ 2005-09-22  8:00 UTC (permalink / raw)
  To: Ray Bryant
  Cc: Andi Kleen, Daniel Jacobowitz, john stultz, Andrew Morton, lkml,
	discuss

Ray Bryant wrote:
> On Wednesday 21 September 2005 10:04, Andi Kleen wrote:
> 
> 
>>We handle this, but single socket dual core was special cased because
>>I was told previously it should be ok.
>>
>>-Andi
> 
> 
> AFAIK there is a processor state bit that enables/disables this behavior.
> Apparently some BIOS's are setting this one way for desktop systems and the 
> other way for servers.   If it is thought to be important I can track that 
> down and see if it can be externally documented.  (It may actually be in the 
> bios and kernel developer guide...)
> 

Hi,

This would be very good (for us single socket dual core users)
I tried a very small benchmark:

clock_gettime(CLOCK_REALTIME): elapsed 7336657 -> 733.665700ns/call
clock_gettime(CLOCK_PROCESS_CPUTIME_ID): elapsed 763247 -> 76.324700ns/call

It's a factor 10 faster if the TSC were to be in sync.

/Jonas

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

* Re: [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs
  2005-10-07 14:15     ` Vladimir B. Savkin
@ 2005-10-07 14:21       ` Velu Erwan
  0 siblings, 0 replies; 12+ messages in thread
From: Velu Erwan @ 2005-10-07 14:21 UTC (permalink / raw)
  To: Vladimir B. Savkin; +Cc: Andi Kleen, lkml, Andrew Morton, john stultz, discuss

Vladimir B. Savkin a écrit :

>Well, I think not.
>Asus file download page is unavailable since yesterday.
>  
>
Agreed but ftp://ftp.asus.com:/pub/ASUS/mb/socket939/a8v-deluxe is still 
available ;)

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

end of thread, other threads:[~2005-10-07 14:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-20 19:13 [discuss] Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs Langsdorf, Mark
2005-09-20 19:24 ` Scott Lampert
2005-09-20 19:30   ` john stultz
  -- strict thread matches above, loose matches on Subject: below --
2005-09-19 19:16 john stultz
2005-09-19 19:31 ` Andi Kleen
2005-09-19 19:42   ` john stultz
2005-09-19 19:49     ` [discuss] " Andi Kleen
2005-09-20 18:59       ` john stultz
2005-09-21  4:03         ` Daniel Jacobowitz
2005-09-21 15:15           ` Ray Bryant
2005-09-21 15:04             ` Andi Kleen
2005-09-21 15:46               ` Ray Bryant
2005-09-22  8:00                 ` Jonas Oreland
2005-09-21 20:17               ` Andrew Morton
2005-10-07 12:26 ` Vladimir B. Savkin
2005-10-07 12:31   ` Andi Kleen
2005-10-07 14:15     ` Vladimir B. Savkin
2005-10-07 14:21       ` [discuss] " Velu Erwan

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