When the !popolicy experiment was used in an earlier part of this chapter, it showed you only the system power policy, not the entire policy, which also covers PPM. By using the dt command with the correct structure type, you are also able to see the PPM policy, which covers the policy GUIDs that were shown in the preceding tables. Because the system power policy starts at offset 4, simply subtract 4 from the pointer returned by !popolicy.lkd> !popolicy
SYSTEM_POWER_POLICY (R.1) @ 0x8377a6c4
lkd> dt nt!_POP_POWER_SETTING_VALUES 8377a6c0
...
+0x10c AllowThrottling : 0 ''
+0x10d PerfHistoryCount : 0x20 ' '
+0x110 PerfTimeCheck : 0xf
+0x114 PerfIncreaseTime : 1
+0x118 PerfDecreaseTime : 1
+0x11c PerfIncreaseThreshold : 0x1e ''
+0x11d PerfDecreaseThreshold : 0xa ''
+0x11e PerfIncreasePolicy : 0x2 ''
+0x11f PerfDecreasePolicy : 0x1 ''
+0x120 PerfMinPolicy : 0x5 ''
+0x121 PerfMaxPolicy : 0x64 'd'
+0x124 PerfBoostPolicy : 0x64
+0x128 CoreParkingIncreaseThreshold : 0x55 'U'
+0x129 CoreParkingDecreaseThreshold : 0x32 '2'
+0x12a CoreParkingMaxCores : 0x64 'd'
+0x12b CoreParkingMinCores : 0xa ''
+0x12c CoreParkingIncreasePolicy : 0 ''
+0x12d CoreParkingDecreasePolicy : 0 ''
+0x130 CoreParkingIncreaseTime : 7
+0x134 CoreParkingDecreaseTime : 0x14
+0x138 CoreParkingAffinityHistoryDecreaseFactor : 0x2 ''
+0x13a CoreParkingAffinityHistoryThreshold : 0x96
+0x13c CoreParkingAffinityWeighting : 0x64
+0x13e CoreParkingOverUtilizationHistoryDecreaseFactor : 0x2 ''
+0x140 CoreParkingOverUtilizationHistoryThreshold : 0x28
+0x142 CoreParkingOverUtilizationWeighting : 0x64
+0x144 CoreParkingOverUtilizationThreshold : 0x3c '<'
+0x145 ParkingCoreOverride : 0x1 ''
+0x146 ParkingPerfState : 0 ''
Another way to see a more limited set of the current policy is to use the !ppmperfpolicy extension, which displays a few of the core policy settings:lkd> !ppmperfpolicy
MaxPerf: 100%
MinPerf: 5%
TimeCheck: 15 ms
IncreaseTime: 1 time check period(s)
DecreaseTime: 1 time check period(s)
IncreaseThreshold: 30%
DecreaseThreshold: 10%
IncreasePolicy: 2
DecreasePolicy: 1
HistoryCount: 1
BoostPolicy: 100
Performance Check
The algorithm that powers the PPM engine is called the performance check. It is executed by the PpmCheckStart timer callback, which runs periodically based on the current policy’s performance-check interval. The callback acquires the policy lock and sets the initial phase to PpmCheckPhaseInitiate. It calls PpmCheckRun, which runs the algorithm illustrated in the following diagram.
The steps shown in the diagram line up with the PPM_CHECK_PHASE enumeration described in Table 8-15.
Table 8-15. PPM Check Phases
Phase Name
Phase Meaning
PpmCheckPhaseInitiate
Notifies the vendor-supplied processor power driver that the core parking engine is about to start its performance check
PpmCheckPhaseRecordUtility
Runs on each processor to calculate the utility function for each core
PpmCheckPhaseCalculateCoreParkingMask
Using the utility function, current core parking status, affinitization, and overutilization history, organizes all the cores in different sets that are used to determine the best cores to unpark or park. It then performs the unparking of cores
PpmCheckPhaseReportUnparkedCores
Runs on each unparked processor to notify the scheduler that the core has been unparked
PpmCheckPhaseSelectProcessorState
Computes the new performance state (target frequency) for each processor based on its parking state and utility
PpmCheckPhaseSelectDomainState
Selects the best performance state for all the processors in a given domain based on the constraints, and switches to the new processor performance state
PpmCheckPhaseCommitDomainState
Calls the vendor-supplied processor power driver to commit the new processor performance states
PpmCheckPhaseReportParkedCores
Runs on each parked processor to notify the scheduler that the core has been unparked. Any ongoing or queued thread activity is moved off the core.
PpmCheckPhaseEnd
Releases the policy lock and switches the phase to the not-running phase
PpmCheckPhaseNotRunning
Indicates that the performance check is not running
Some of the steps in Table 8-15 require a bit more discussion than just a single line. Here are extended details.