RE: TSC unstable on Intel Pentium M processor 750

From: Mao Yilu
Date: Wed Apr 29 2009 - 20:34:56 EST


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@xxxxxxxxxxxxxxx [mailto:linux-kernel-owner@xxxxxxxxxxxxxxx] On Behalf Of Robert Hancock
Sent: Thursday, April 30, 2009 7:50 AM
To: Mao Yilu
Cc: linux-kernel@xxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/