Check and correct host tuning at startup and on drift
This commit is contained in:
@@ -329,11 +329,27 @@ func main() {
|
||||
rcvbuf = flag.Int("rcvbuf", 64<<20, "SO_RCVBUFFORCE per rx socket")
|
||||
txCPUs = flag.String("txcpus", "", "comma-separated CPUs to pin tx workers to")
|
||||
rxCPUs = flag.String("rxcpus", "", "comma-separated CPUs to pin rx workers to")
|
||||
tune = flag.Bool("tune", true, "check host settings at startup and correct them; without this they are only reported")
|
||||
governor = flag.String("governor", "performance", "required cpufreq governor")
|
||||
coalesce = flag.Uint("coalesce-usecs", 25, "required fixed rx/tx coalesce usecs, with adaptive coalescing off")
|
||||
rxRing = flag.Uint("rx-ring", 8160, "required rx ring size, clamped to hardware maximum")
|
||||
txRing = flag.Uint("tx-ring", 4096, "required tx ring size, clamped to hardware maximum")
|
||||
setRings = flag.Bool("set-rings", true, "allow ring resizing at startup, which resets the link")
|
||||
)
|
||||
flag.Parse()
|
||||
|
||||
tcfg := tuneConfig{
|
||||
enabled: *tune,
|
||||
governor: *governor,
|
||||
rxUsecs: uint32(*coalesce),
|
||||
txUsecs: uint32(*coalesce),
|
||||
rxRing: uint32(*rxRing),
|
||||
txRing: uint32(*txRing),
|
||||
setRings: *setRings,
|
||||
}
|
||||
|
||||
if err := run(*aName, *bName, *sizesArg, *patArg, *fanout, *txCPUs, *rxCPUs,
|
||||
*duration, *interval, *drain, *txN, *rxN, *batch, *sndbuf, *rcvbuf, *verify, *duplex); err != nil {
|
||||
*duration, *interval, *drain, *txN, *rxN, *batch, *sndbuf, *rcvbuf, *verify, *duplex, tcfg); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "error:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -341,7 +357,7 @@ func main() {
|
||||
|
||||
func run(aName, bName, sizesArg, patArg, fanout, txCPUsArg, rxCPUsArg string,
|
||||
duration, interval, drain time.Duration, txN, rxN, batch, sndbuf, rcvbuf int,
|
||||
verify, duplex bool) error {
|
||||
verify, duplex bool, tcfg tuneConfig) error {
|
||||
|
||||
if aName == "" || bName == "" {
|
||||
return fmt.Errorf("both -a and -b are required")
|
||||
@@ -378,6 +394,19 @@ func run(aName, bName, sizesArg, patArg, fanout, txCPUsArg, rxCPUsArg string,
|
||||
}
|
||||
}
|
||||
|
||||
ifnames := []string{a.name, b.name}
|
||||
fmt.Println("host settings:")
|
||||
var fatal []string
|
||||
for _, r := range applyTuning(tcfg, ifnames) {
|
||||
fmt.Println(r)
|
||||
if r.fatal {
|
||||
fatal = append(fatal, r.item)
|
||||
}
|
||||
}
|
||||
if len(fatal) > 0 {
|
||||
return fmt.Errorf("cannot test with %s in this state", strings.Join(fatal, ", "))
|
||||
}
|
||||
|
||||
cfg := config{
|
||||
txWorkers: txN,
|
||||
rxWorkers: rxN,
|
||||
@@ -464,6 +493,9 @@ loop:
|
||||
case now := <-tick.C:
|
||||
secs := now.Sub(last).Seconds()
|
||||
last = now
|
||||
for _, w := range verifyTuning(tcfg, ifnames) {
|
||||
fmt.Println(w)
|
||||
}
|
||||
for _, d := range dirs {
|
||||
fmt.Println(d.reportInterval(secs))
|
||||
if s := d.reportNIC(); s != "" {
|
||||
|
||||
Reference in New Issue
Block a user