Asked by:
Trying to disable Processor idle states (C states) on Windows PC

Question
-
I need to prevent the processor from entering an idle state (non C0 C state). Admittedly I do not know much about processor C and P states so bear with me. We use a camera from a third party vendor which occasionally delivers corrupted frames. The vendor has determined that when the CPU enters an idle state it interferes with the transmission of the frame over the firewire. To confirm this I used the following code on a Windows 7 PC and indeed, disabling the idle states resolved the issue.
//WIN7
const DWORD DISABLED = 1;
const DWORD ENABLED = 0;
GUID *scheme;
PowerGetActiveScheme(NULL, &scheme);
PowerWriteACValueIndex(NULL, scheme, &GUID_PROCESSOR_SETTINGS_SUBGROUP, &GUID_PROCESSOR_IDLE_DISABLE, DISABLED);
PowerSetActiveScheme(NULL, scheme);...
If I run my application and open Windows permon and add the %C1 Time, %C2 Time and %C3 time I see that they are all zero when I disable these states, when I enable them I see quite a bit of time spent in the C3 state (this is on a Dell Precision T3500 quad core PC).
I also need to do this on XP however these calls are not available on XP. So I attempted to do the following to disable the idle states
unsigned int ActPwrSch;
DWORD currPolicy,newPolicy, curr1Policy,curr2Policy, new1Policy, new2Policy;
MACHINE_PROCESSOR_POWER_POLICY Policy;
if(GetActivePwrScheme(&ActPwrSch))
{
if(ReadProcessorPwrScheme(ActPwrSch,&Policy))
{
printf("Read Power Scheme:\n");
//if(Policy.ProcessorPolicyAc.DisableCStates!=0)
currPolicy = Policy.ProcessorPolicyAc.Policy[0].AllowPromotion;
curr1Policy = Policy.ProcessorPolicyAc.Policy[1].AllowPromotion;
curr2Policy = Policy.ProcessorPolicyAc.Policy[2].AllowPromotion;
Policy.ProcessorPolicyAc.Policy[0].AllowPromotion = 0;
Policy.ProcessorPolicyAc.Policy[1].AllowPromotion = 0;
Policy.ProcessorPolicyAc.Policy[2].AllowPromotion = 0;
newPolicy = Policy.ProcessorPolicyAc.Policy[0].AllowPromotion;if(WriteProcessorPwrScheme(ActPwrSch,&Policy))
{
printf("WriteProcessorPwrScheme succeed\n");
if(SetActivePwrScheme(ActPwrSch,0,0))
{
printf("SetActivePwrScheme succeed!!\n");
}
}}
...
However when I run my application I still see that the processor is spending time in the C1 state (by looking at the same counters in perfmon). And I still get my corrupted image problem. The XP PC is an single core Dell optiplex PC.
Does anybody know how I can prevent entry into any of the C1-C3 states on XP? As I said it seems that I have done it on Windows 7.
Thursday, March 15, 2012 5:39 PM
All replies
-
I a mnot sure if this will work, but you could try setting the power management policy to "Max performance". I don't know exactly if this disables C states on XP, but it may be a simple fix. Let me know if that works out for you.Thursday, March 22, 2012 8:01 AM
-
Hi Kim, no unfortunately that doesn't seem to have any effect on the C states. Below are some other things I've tried that don't seem to disable the C states, I added them to my XP code included in my original post. Thanks
Policy.ProcessorPolicyAc.DisableCStates = 1;
Policy.ProcessorPolicyAc.DynamicThrottle = PO_THROTTLE_NONE;
Friday, March 23, 2012 3:05 PM -
That may be your best bet. The processor does manage these at a level below the operating system, and treat instructions from the OS on C-state usage as a recommendation. For example, if an OS keeps telling the processor to drop into a C-state and the processor determines that it came back out to quickly to save energy, it will eventually stop going into the C-state.Tuesday, March 27, 2012 9:20 PM
-
Hey, I recently found this article which covers a lot of things close to your question. Hopefully it leads you towards the answer you want. It does talk quite a biut about the processor driver, so one thing that you might want to make sure of is that you have an up to date processor driver installed. Here is the article: http://msdn.microsoft.com/en-us/windows/gg566941Monday, April 2, 2012 7:30 PM
-
Hi Kim, Thanks. The document looks great but it looks like it is specific to Win7. I have no problem disabling C states on Win7, I only have a problem on WinXP which this doc doesn't seem to cover?
Thanks
Monday, April 2, 2012 7:41 PM