Skip to content

Commit

Permalink
controller: add support for 64k-pages kernel on aarch64
Browse files Browse the repository at this point in the history
This commit consist of the following changes:
* Enhanced the performanceprofile controller to choose 64k-pages MC kernelType, when 64K pages specified.
* Added unit tests to cover the following scenarios:
 RealTime kernel disabled + 64K => 64-pages kernelType
 RealTime kernel disabled + 4K => default kernelType
 RealTime kernel enabled + 4K => realtime kernelType

Note that the case of RealTime kernel enabled + 64K is not tested, as it is expected to be rejected by validation.

Signed-off-by: Ronny Baturov <[email protected]>
  • Loading branch information
rbaturov committed Dec 22, 2024
1 parent 051a270 commit fc168a5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const (
MCKernelRT = "realtime"
// MCKernelDefault is the value of the kernel setting in MachineConfig for the default kernel
MCKernelDefault = "default"
// MCKernel64kPages is the value of the kernel setting in MachineConfig for 64k-pages kernel on aarch64
MCKernel64kPages = "64k-pages"
// HighPerformanceRuntime contains the name of the high-performance runtime
HighPerformanceRuntime = "high-performance"

Expand Down Expand Up @@ -146,8 +148,14 @@ func New(profile *performancev2.PerformanceProfile, opts *components.MachineConf
profile.Spec.RealTimeKernel.Enabled != nil &&
*profile.Spec.RealTimeKernel.Enabled

// Real time kernel with 64k-pages for aarch64 not yet supported and rejected in the validation webhook.
if enableRTKernel {
mc.Spec.KernelType = MCKernelRT

} else if profile.Spec.KernelPageSize != nil && *profile.Spec.KernelPageSize == performancev2.KernelPageSize("64K") {
// During validation, we ensure that nodes are based on aarch64 when the administrator specifies 64K for this field.
// Hence, this assignment is guaranteed to be safe.
mc.Spec.KernelType = MCKernel64kPages
} else {
mc.Spec.KernelType = MCKernelDefault
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,24 +395,31 @@ var _ = Describe("Controller", func() {
}
})

It("should update MC when RT kernel gets disabled", func() {
profile.Spec.RealTimeKernel.Enabled = ptr.To(false)
r := newFakeReconciler(profile, mc, kc, tunedPerformance, profileMCP, infra, clusterOperator)

Expect(reconcileTimes(r, request, 1)).To(Equal(reconcile.Result{}))

key := types.NamespacedName{
Name: machineconfig.GetMachineConfigName(profile.Name),
Namespace: metav1.NamespaceNone,
}

// verify MachineConfig update
mc := &mcov1.MachineConfig{}
err := r.Get(context.TODO(), key, mc)
Expect(err).ToNot(HaveOccurred())

Expect(mc.Spec.KernelType).To(Equal(machineconfig.MCKernelDefault))
})
DescribeTable("MachineConfig kernelType updates",
func(rtKernelEnabled bool, kernelPageSize *performancev2.KernelPageSize, expectedKernelType string) {
// Set up profile
profile.Spec.RealTimeKernel.Enabled = ptr.To(rtKernelEnabled)
profile.Spec.KernelPageSize = kernelPageSize

r := newFakeReconciler(profile, mc, kc, tunedPerformance, profileMCP, infra, clusterOperator)

Expect(reconcileTimes(r, request, 1)).To(Equal(reconcile.Result{}))

// Verify MachineConfig update
key := types.NamespacedName{
Name: machineconfig.GetMachineConfigName(profile.Name),
Namespace: metav1.NamespaceNone,
}

mc := &mcov1.MachineConfig{}
err := r.Get(context.TODO(), key, mc)
Expect(err).ToNot(HaveOccurred())
Expect(mc.Spec.KernelType).To(Equal(expectedKernelType))
},
Entry("should set kernelType to default when RealTimeKernel is disabled", false, nil, machineconfig.MCKernelDefault),
Entry("should set kernelType to 64k-pages when RT kernel disabled and 64K kernel page size selected", false, ptr.To(performancev2.KernelPageSize("64K")), machineconfig.MCKernel64kPages),
Entry("should set kernelType to realtime when RT kernel is enabled", true, nil, machineconfig.MCKernelRT),
)

It("should update MC, KC and Tuned when CPU params change", func() {
reserved := performancev2.CPUSet("0-1")
Expand Down

0 comments on commit fc168a5

Please sign in to comment.