-
Notifications
You must be signed in to change notification settings - Fork 6
Release v1.3.0 ACPI Driver #12
Changes from 5 commits
53ab5aa
74fb7a8
6fb9dfd
0005de4
1f788de
67ec0a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -189,17 +189,22 @@ C4E/C5 Enhanced Deeper Sleep | |||||
C6 Deep Power Down | ||||||
```` | ||||||
|
||||||
## P-State Governor | ||||||
## Scaling Driver | ||||||
|
||||||
The P-state governor feature allows the user to check if the P-state driver is enabled on the system. If the P-state | ||||||
driver is enabled while using the Kubernetes Power Manger, users may select a P-state governor per core, which are | ||||||
described as "performance" and "powersave" governors in the Power Profiles. | ||||||
### P-state | ||||||
The P-state governor feature allows the user to check if the P-state driver is enabled on the system. If the P-state | ||||||
driver is enabled while using the Kubernetes Power Manager, users may select a P-state governor per core, which are | ||||||
described as "performance" and "powersave" governors in the Power Profiles. | ||||||
|
||||||
* Performance governor - The CPUfreq governor "performance" sets the CPU statically to the highest frequency within the | ||||||
borders of scaling_min_freq and scaling_max_freq. | ||||||
* Powersave governor - The CPUfreq governor "powersave" sets the CPU statically to the lowest frequency within the | ||||||
borders of scaling_min_freq and scaling_max_freq. | ||||||
|
||||||
### acpi-cpufreq | ||||||
The acpi-cpufreq driver operates much like the P-state driver but has a number of both static and dynamic governors. For more information see [here](https://www.kernel.org/doc/html/v4.12/admin-guide/pm/cpufreq.html). | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
One thing to note is that acpi-cpufreq reports the base clock as the frequency hardware limits however the P-state driver uses turbo frequency limits. | ||||||
Both drivers can make use of turbo frequency however acpi-cpufreq will exceed its hardware frequency limits when using turbo frequency. This is important to take into account when setting frequencies for profiles. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
## Topology | ||||||
|
||||||
Topology discovery is done via reading /sys/devices/system/cpuN/topology/{physical_package_id,die_id,core_id}. Based on | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,15 @@ package power | |
|
||
import ( | ||
"fmt" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/mock" | ||
"os" | ||
"path/filepath" | ||
"strconv" | ||
"strings" | ||
"sync" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type cpuMock struct { | ||
|
@@ -45,7 +46,7 @@ func (m *cpuMock) SetPool(pool Pool) error { | |
return m.Called(pool).Error(0) | ||
} | ||
|
||
func setupCpuPStatesTests(cpufiles map[string]map[string]string) func() { | ||
func setupCpuScalingTests(cpufiles map[string]map[string]string) func() { | ||
origBasePath := basePath | ||
basePath = "testing/cpus" | ||
defaultDefaultPowerProfile := defaultPowerProfile | ||
|
@@ -56,7 +57,7 @@ func setupCpuPStatesTests(cpufiles map[string]map[string]string) func() { | |
getNumberOfCpus = func() uint { return uint(len(cpufiles)) } | ||
|
||
// "initialise" P-States feature | ||
featureList[PStatesFeature].err = nil | ||
featureList[FreqencyScalingFeature].err = nil | ||
|
||
// if cpu0 is here we set its values to temporary defaultPowerProfile | ||
if cpu0, ok := cpufiles["cpu0"]; ok { | ||
|
@@ -91,14 +92,16 @@ func setupCpuPStatesTests(cpufiles map[string]map[string]string) func() { | |
os.WriteFile(filepath.Join(cpudir, scalingMinFile), []byte(value+"\n"), 0644) | ||
os.WriteFile(filepath.Join(cpudir, cpuMinFreqFile), []byte(value+"\n"), 0644) | ||
case "package": | ||
os.WriteFile(filepath.Join(cpudir,packageIdFile),[]byte(value+"\n"), 0644) | ||
os.WriteFile(filepath.Join(cpudir, packageIdFile), []byte(value+"\n"), 0644) | ||
case "die": | ||
os.WriteFile(filepath.Join(cpudir,dieIdFile),[]byte(value+"\n"), 0644) | ||
os.WriteFile(filepath.Join(cpudir,coreIdFile),[]byte(cpuName[3:]+"\n"), 0644) | ||
os.WriteFile(filepath.Join(cpudir, dieIdFile), []byte(value+"\n"), 0644) | ||
os.WriteFile(filepath.Join(cpudir, coreIdFile), []byte(cpuName[3:]+"\n"), 0644) | ||
case "epp": | ||
os.WriteFile(filepath.Join(cpudir, eppFile), []byte(value+"\n"), 0644) | ||
case "governor": | ||
os.WriteFile(filepath.Join(cpudir, scalingGovFile), []byte(value+"\n"), 0644) | ||
case "available_governors": | ||
os.WriteFile(filepath.Join(cpudir, availGovFile), []byte(value+"\n"), 0644) | ||
} | ||
} | ||
} | ||
|
@@ -110,7 +113,7 @@ func setupCpuPStatesTests(cpufiles map[string]map[string]string) func() { | |
// revert get number of system cpus function | ||
getNumberOfCpus = origGetNumOfCpusFunc | ||
// revert p-states feature to un initialised state | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably want to update this comment. |
||
featureList[PStatesFeature].err = uninitialisedErr | ||
featureList[FreqencyScalingFeature].err = uninitialisedErr | ||
// revert default powerProfile | ||
defaultPowerProfile = defaultDefaultPowerProfile | ||
} | ||
|
@@ -124,7 +127,7 @@ func TestNewCore(t *testing.T) { | |
"epp": "some", | ||
}, | ||
} | ||
defer setupCpuPStatesTests(cpufiles)() | ||
defer setupCpuScalingTests(cpufiles)() | ||
|
||
// happy path - ensure values from files are read correctly | ||
core := &cpuCore{} | ||
|
@@ -140,7 +143,7 @@ func TestNewCore(t *testing.T) { | |
}, cpu) | ||
|
||
// now "break" P-States by setting a feature error | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably want to update this comment. |
||
featureList[PStatesFeature].err = fmt.Errorf("some error") | ||
featureList[FreqencyScalingFeature].err = fmt.Errorf("some error") | ||
|
||
cpu, err = newCpu(0, nil) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,9 +41,8 @@ func initHost(nodeName string) (Host, error) { | |
host := &hostImpl{ | ||
name: nodeName, | ||
exclusivePools: PoolList{}, | ||
featureStates: &featureList, | ||
} | ||
|
||
host.featureStates = &featureList | ||
Comment on lines
43
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a small question: why is this needed? It seems like we're doing the same thing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't remember exactly why I did this but I think it was because I was getting some weird behavior where the host was using a snapshot of the pointers' value instead of the pointer itself. Think this was just for the purposes of debugging to see the field go from unassigned to assigned but probably best to leave as is right now just in case and revert it for next time around |
||
// create predefined pools | ||
host.reservedPool = &reservedPoolType{poolImpl{ | ||
name: reservedPoolName, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.