Power: 2 streams and a 2.0 GHz clock pinned by a new checkMaxFreq SETTINGS check (performance governor + scaling_max_freq = fixed clock) take line rate from 80 W to 29.7 W package, qualified 96 s zero-loss; measured on the bench: streams buy scheduling headroom not watts (C1-parked threads, lonelier spinners boost harder), relaxed cpu_dma_latency never reaches deep idle (scheduler spreads wakeups, ~2% residency), offlining E-cores saves 1.7 W and is wire-invisible mid-run, the cliff is TX starvation below 1.6 GHz (1.2 GHz sags to ~18 G, zero errors)
This commit is contained in:
@@ -312,6 +312,7 @@ type ethtoolCoalesce struct {
|
||||
|
||||
const (
|
||||
wantGovernor = "performance"
|
||||
wantMaxFreqKHz = "2000000"
|
||||
wantCoalesceUsecs = 25
|
||||
wantRxRing = 8160
|
||||
wantTxRing = 4096
|
||||
@@ -562,6 +563,50 @@ func checkGovernor(want string) checkResult {
|
||||
return res
|
||||
}
|
||||
|
||||
// Under the performance governor a max-frequency bound is a fixed clock, not a
|
||||
// ceiling the cores rove beneath, so the line-rate margin it was qualified with
|
||||
// is the margin every run gets.
|
||||
func checkMaxFreq(wantKHz string) checkResult {
|
||||
res := checkResult{item: "cpu max frequency"}
|
||||
paths, err := filepath.Glob("/sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq")
|
||||
if err != nil || len(paths) == 0 {
|
||||
res.err = fmt.Errorf("no cpufreq max frequencies found")
|
||||
return res
|
||||
}
|
||||
var wrong []string
|
||||
counts := map[string]int{}
|
||||
for _, p := range paths {
|
||||
b, err := os.ReadFile(p)
|
||||
if err != nil {
|
||||
res.err = err
|
||||
return res
|
||||
}
|
||||
got := strings.TrimSpace(string(b))
|
||||
counts[got]++
|
||||
if got != wantKHz {
|
||||
wrong = append(wrong, p)
|
||||
}
|
||||
}
|
||||
if len(wrong) == 0 {
|
||||
res.state = fmt.Sprintf("%s kHz on all %d cpus", wantKHz, len(paths))
|
||||
return res
|
||||
}
|
||||
var found []string
|
||||
for k, v := range counts {
|
||||
found = append(found, fmt.Sprintf("%s:%d", k, v))
|
||||
}
|
||||
for _, p := range wrong {
|
||||
if err := os.WriteFile(p, []byte(wantKHz), 0o644); err != nil {
|
||||
res.err = err
|
||||
res.state = fmt.Sprintf("could not set %s", p)
|
||||
return res
|
||||
}
|
||||
}
|
||||
res.fixed = true
|
||||
res.state = fmt.Sprintf("was %s, now %s kHz on all %d cpus", strings.Join(found, " "), wantKHz, len(paths))
|
||||
return res
|
||||
}
|
||||
|
||||
// Bounds how far into idle any cpu may sink, so a worker or interrupt never
|
||||
// waits behind a deep state's exit. Ten microseconds admits C1, whose exit is
|
||||
// noise under the interrupt coalescing already in the path, and blocks the
|
||||
@@ -690,7 +735,8 @@ func withIoctlSocket(fn func(fd int) []checkResult) []checkResult {
|
||||
// under test, so with no cable there is never going to be one.
|
||||
func configureSystem(ifnames []string, ethertypes []uint16) []checkResult {
|
||||
return withIoctlSocket(func(fd int) []checkResult {
|
||||
out := []checkResult{checkGovernor(wantGovernor), checkIdleLatency(wantIdleLatency)}
|
||||
out := []checkResult{checkGovernor(wantGovernor), checkMaxFreq(wantMaxFreqKHz),
|
||||
checkIdleLatency(wantIdleLatency)}
|
||||
for _, ifname := range ifnames {
|
||||
out = append(out, checkLinkUp(fd, ifname))
|
||||
out = append(out, checkMTU(fd, ifname, wantMTU))
|
||||
|
||||
Reference in New Issue
Block a user