All of lore.kernel.org
 help / color / mirror / Atom feed
* TSC unstable on Intel Pentium M processor 750
@ 2009-04-26 14:59 ` Mao Yilu
  2009-04-29 23:50   ` Robert Hancock
       [not found]   ` <441049102.10204@ustc.edu.cn>
  0 siblings, 2 replies; 7+ messages in thread
From: Mao Yilu @ 2009-04-26 14:59 UTC (permalink / raw)
  To: linux-kernel

Hi,

I masked all the interrupts except keyboard interrupt before the instruction “hlt”, So the CPU ran nothing until I click the keyboard button. And I used “rdtscll” and “do_gettimeofday” to get the halt time. But the result of “do_gettimeofday” was longer than the one of “rdtscll” about 3s per minute. I don’t know why.
I timed some math job using the same way in contrary to the “hlt” instruction. The TSC was not correct either. In 3 minutes, the result of “do_gettimeofday” was longer than the one of “rdtscll” about 5s.
The processor is Intel Pentium M processor 750. From the software developer’s manual of Intel, the processor clock of Pentium M processors is impacted by Intel SpeedStep technology, while some other processors is not. Maybe this is another feature Pentium M processors own.
Pentium M processors support 5 C-states. I am sure the TSC doesn’t stop in C0 and C1 states. But I am not sure about other states. Maybe other states will stop the clock, and “hlt” instruction will make the CPU into deeper state.
These are my guess. I wanna the truth. Thank you.

Mao Yilu


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

* Re: TSC unstable on Intel Pentium M processor 750
  2009-04-26 14:59 ` Mao Yilu
@ 2009-04-29 23:50   ` Robert Hancock
       [not found]   ` <441049102.10204@ustc.edu.cn>
  1 sibling, 0 replies; 7+ messages in thread
From: Robert Hancock @ 2009-04-29 23:50 UTC (permalink / raw)
  To: Mao Yilu; +Cc: linux-kernel

Mao Yilu wrote:
> Hi,
> 
> I masked all the interrupts except keyboard interrupt before the instruction “hlt”, So the CPU ran nothing until I click the keyboard button. And I used “rdtscll” and “do_gettimeofday” to get the halt time. But the result of “do_gettimeofday” was longer than the one of “rdtscll” about 3s per minute. I don’t know why.
> I timed some math job using the same way in contrary to the “hlt” instruction. The TSC was not correct either. In 3 minutes, the result of “do_gettimeofday” was longer than the one of “rdtscll” about 5s.
> The processor is Intel Pentium M processor 750. From the software developer’s manual of Intel, the processor clock of Pentium M processors is impacted by Intel SpeedStep technology, while some other processors is not. Maybe this is another feature Pentium M processors own.
> Pentium M processors support 5 C-states. I am sure the TSC doesn’t stop in C0 and C1 states. But I am not sure about other states. Maybe other states will stop the clock, and “hlt” instruction will make the CPU into deeper state.
> These are my guess. I wanna the truth. Thank you.
> 
> Mao Yilu
> 

On many processors the TSC will stop in various C-states, and also the 
TSC frequency changes when CPU frequency changes. This is why using 
rdtsc in userspace is not reliable, since the code can't know whether or 
not TSC can be used on that CPU reliably or how to scale the results.

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

* RE: TSC unstable on Intel Pentium M processor 750
@ 2009-04-30  0:32       ` Mao Yilu
  0 siblings, 0 replies; 7+ messages in thread
From: Mao Yilu @ 2009-04-30  0:32 UTC (permalink / raw)
  To: 'Robert Hancock'; +Cc: linux-kernel

Thank you for your reply.
But I still don't know why the TSC is not correct in the C1 state (hlt instruction). Is there anything more to influence the TSC? What happened when the CPU is not running under hlt instruction?

Thank you.
Mao Yilu

-----Original Message-----
From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Robert Hancock
Sent: Thursday, April 30, 2009 7:50 AM
To: Mao Yilu
Cc: linux-kernel@vger.kernel.org
Subject: Re: TSC unstable on Intel Pentium M processor 750

Mao Yilu wrote:
> Hi,
> 
> I masked all the interrupts except keyboard interrupt before the instruction “hlt”, So the CPU ran nothing until I click the keyboard button. And I used “rdtscll” and “do_gettimeofday” to get the halt time. But the result of “do_gettimeofday” was longer than the one of “rdtscll” about 3s per minute. I don’t know why.
> I timed some math job using the same way in contrary to the “hlt” instruction. The TSC was not correct either. In 3 minutes, the result of “do_gettimeofday” was longer than the one of “rdtscll” about 5s.
> The processor is Intel Pentium M processor 750. From the software developer’s manual of Intel, the processor clock of Pentium M processors is impacted by Intel SpeedStep technology, while some other processors is not. Maybe this is another feature Pentium M processors own.
> Pentium M processors support 5 C-states. I am sure the TSC doesn’t stop in C0 and C1 states. But I am not sure about other states. Maybe other states will stop the clock, and “hlt” instruction will make the CPU into deeper state.
> These are my guess. I wanna the truth. Thank you.
> 
> Mao Yilu
> 

On many processors the TSC will stop in various C-states, and also the 
TSC frequency changes when CPU frequency changes. This is why using 
rdtsc in userspace is not reliable, since the code can't know whether or 
not TSC can be used on that CPU reliably or how to scale the results.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

* Re: TSC unstable on Intel Pentium M processor 750
@ 2009-04-30  3:11       ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 7+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-04-30  3:11 UTC (permalink / raw)
  To: Mao Yilu; +Cc: 'Robert Hancock', linux-kernel

On Thu, 30 Apr 2009, Mao Yilu wrote:
> But I still don't know why the TSC is not correct in the C1 state (hlt
> instruction). Is there anything more to influence the TSC? What happened
> when the CPU is not running under hlt instruction?

SMIs?  Laptops love that crap...

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* RE: TSC unstable on Intel Pentium M processor 750
@ 2009-04-30  7:40           ` Mao Yilu
  2009-04-30 14:32             ` Clark Williams
  0 siblings, 1 reply; 7+ messages in thread
From: Mao Yilu @ 2009-04-30  7:40 UTC (permalink / raw)
  To: 'Henrique de Moraes Holschuh'; +Cc: linux-kernel

> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org
> [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Henrique de Moraes
> Holschuh
> Sent: Thursday, April 30, 2009 11:12 AM
> To: Mao Yilu
> Cc: 'Robert Hancock'; linux-kernel@vger.kernel.org
> Subject: Re: TSC unstable on Intel Pentium M processor 750
> 
> On Thu, 30 Apr 2009, Mao Yilu wrote:
> > But I still don't know why the TSC is not correct in the C1 state (hlt
> > instruction). Is there anything more to influence the TSC? What happened
> > when the CPU is not running under hlt instruction?
> 
> SMIs?  Laptops love that crap...

What is SMIs?



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

* Re: TSC unstable on Intel Pentium M processor 750
@ 2009-04-30 14:31           ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 7+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-04-30 14:31 UTC (permalink / raw)
  To: Mao Yilu; +Cc: linux-kernel

On Thu, 30 Apr 2009, Mao Yilu wrote:
> > On Thu, 30 Apr 2009, Mao Yilu wrote:
> > > But I still don't know why the TSC is not correct in the C1 state (hlt
> > > instruction). Is there anything more to influence the TSC? What happened
> > > when the CPU is not running under hlt instruction?
> > 
> > SMIs?  Laptops love that crap...
> 
> What is SMIs?

http://en.wikipedia.org/wiki/System_Management_Mode

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* Re: TSC unstable on Intel Pentium M processor 750
  2009-04-30  7:40           ` Mao Yilu
@ 2009-04-30 14:32             ` Clark Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Clark Williams @ 2009-04-30 14:32 UTC (permalink / raw)
  To: Mao Yilu; +Cc: 'Henrique de Moraes Holschuh', linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=US-ASCII, Size: 1400 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 30 Apr 2009 15:40:02 +0800
"Mao Yilu" <ylmao@mail.ustc.edu.cn> wrote:

> > -----Original Message-----
> > From: linux-kernel-owner@vger.kernel.org
> > [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Henrique de Moraes
> > Holschuh
> > Sent: Thursday, April 30, 2009 11:12 AM
> > To: Mao Yilu
> > Cc: 'Robert Hancock'; linux-kernel@vger.kernel.org
> > Subject: Re: TSC unstable on Intel Pentium M processor 750
> > 
> > On Thu, 30 Apr 2009, Mao Yilu wrote:
> > > But I still don't know why the TSC is not correct in the C1 state (hlt
> > > instruction). Is there anything more to influence the TSC? What happened
> > > when the CPU is not running under hlt instruction?
> > 
> > SMIs?  Laptops love that crap...
> 
> What is SMIs?
> 
>

System Management Interrupt. Usually handled by BIOS code and
completely invisible to Linux. 

Laptops and big servers (rackmount/blades) typically have tons of SMIs
going off to do thermal management, statisics and remote management.

Clark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (GNU/Linux)

iEYEARECAAYFAkn5tpkACgkQHyuj/+TTEp1CjgCfZkG+/AU9CJrTSrk/+XVqPszS
4aoAoNgvDoLRMRUs1VSXqBRyg2HzPs6U
=drzY
-----END PGP SIGNATURE-----
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

end of thread, other threads:[~2009-04-30 14:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-26 14:59 TSC unstable on Intel Pentium M processor 750 Mao Yilu
2009-04-26 14:59 ` Mao Yilu
2009-04-29 23:50   ` Robert Hancock
     [not found]   ` <441049102.10204@ustc.edu.cn>
2009-04-30  0:32     ` Mao Yilu
2009-04-30  0:32       ` Mao Yilu
2009-04-30  3:11       ` Henrique de Moraes Holschuh
     [not found]       ` <441061189.03958@ustc.edu.cn>
2009-04-30  7:40         ` Mao Yilu
2009-04-30  7:40           ` Mao Yilu
2009-04-30 14:32             ` Clark Williams
2009-04-30 14:31           ` Henrique de Moraes Holschuh

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.