Skip to content

Commit

Permalink
Force hyperthreading on masters/workers
Browse files Browse the repository at this point in the history
TODO: filter out RHCOS systems
  • Loading branch information
vrutkovs committed Oct 23, 2019
1 parent 2827ba5 commit 30f7af9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pkg/asset/machines/machineconfig/hyperthreading.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,32 @@ func ForHyperthreadingDisabled(role string) *mcfgv1.MachineConfig {
},
}
}

// ForceHyperthreadingEnabled creates the MachineConfig to force enabled hyperthreading.
// FCOS ships with "mitigations=auto,nosmt" karg, which needs to be disabled to avoid bumping up instance sizes
func ForceHyperthreadingEnabled(role string) *mcfgv1.MachineConfig {
return &mcfgv1.MachineConfig{
TypeMeta: metav1.TypeMeta{
APIVersion: "machineconfiguration.openshift.io/v1",
Kind: "MachineConfig",
},
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("99-%s-force-enabled-hyperthreading", role),
Labels: map[string]string{
"machineconfiguration.openshift.io/role": role,
},
},
Spec: mcfgv1.MachineConfigSpec{
Config: igntypes.Config{
Ignition: igntypes.Ignition{
Version: igntypes.MaxVersion.String(),
},
Storage: igntypes.Storage{
Files: []igntypes.File{
ignition.FileFromString("/etc/pivot/kernel-args", "root", 0600, "DELETE mitigations=auto,nosmt"),
},
},
},
},
}
}
2 changes: 2 additions & 0 deletions pkg/asset/machines/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ func (m *Master) Generate(dependencies asset.Parents) error {
machineConfigs := []*mcfgv1.MachineConfig{}
if pool.Hyperthreading == types.HyperthreadingDisabled {
machineConfigs = append(machineConfigs, machineconfig.ForHyperthreadingDisabled("master"))
} else {
machineConfigs = append(machineConfigs, machineconfig.ForceHyperthreadingEnabled("master"))
}
if ic.SSHKey != "" {
machineConfigs = append(machineConfigs, machineconfig.ForAuthorizedKeys(ic.SSHKey, "master"))
Expand Down
2 changes: 2 additions & 0 deletions pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ func (w *Worker) Generate(dependencies asset.Parents) error {
for _, pool := range ic.Compute {
if pool.Hyperthreading == types.HyperthreadingDisabled {
machineConfigs = append(machineConfigs, machineconfig.ForHyperthreadingDisabled("worker"))
} else {
machineConfigs = append(machineConfigs, machineconfig.ForceHyperthreadingEnabled("worker"))
}
if ic.SSHKey != "" {
machineConfigs = append(machineConfigs, machineconfig.ForAuthorizedKeys(ic.SSHKey, "worker"))
Expand Down

0 comments on commit 30f7af9

Please sign in to comment.