From 50ded9922f8c59d396f0c8b8650a87e8ba62c71c Mon Sep 17 00:00:00 2001 From: "Niranjan M.R" Date: Wed, 18 Dec 2024 21:28:54 +0530 Subject: [PATCH] Workload Hints E2E: Modify kernel args based on Vendor Adjust Workload Hints E2E test cases to verify kernel parameters depending on the Vendor in the case of x86_64 where kernel args are changed based on Intel or AMD. Signed-off-by: Niranjan M.R --- .../workloadhints.go | 65 +++++++++++++++---- 1 file changed, 54 insertions(+), 11 deletions(-) diff --git a/test/e2e/performanceprofile/functests/8_performance_workloadhints/workloadhints.go b/test/e2e/performanceprofile/functests/8_performance_workloadhints/workloadhints.go index c18a72274..7371093b0 100644 --- a/test/e2e/performanceprofile/functests/8_performance_workloadhints/workloadhints.go +++ b/test/e2e/performanceprofile/functests/8_performance_workloadhints/workloadhints.go @@ -3,6 +3,7 @@ package __performance_workloadhints import ( "context" "fmt" + "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/infrastructure" "path/filepath" "reflect" "strconv" @@ -55,6 +56,8 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific poolName string err error ctx context.Context = context.Background() + isIntel bool + isAMD bool ) nodeLabel := testutils.NodeSelectorLabels @@ -67,6 +70,12 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific profile, err = profiles.GetByNodeLabels(nodeLabel) Expect(err).ToNot(HaveOccurred()) klog.Infof("using profile: %q", profile.Name) + // Check if one of the nodes is intel or AMD . Here if it's not intel , it's AMD since we are running + // tests only on x86_64 architecture systems + isIntel, err = infrastructure.IsIntel(ctx, &workerRTNodes[0]) + Expect(err).ToNot(HaveOccurred(), "Unable to fetch Vendor ID") + isAMD, err = infrastructure.IsAMD(ctx, &workerRTNodes[0]) + Expect(err).ToNot(HaveOccurred(), "Unable to fetch Vendor ID") if !hypershift.IsHypershiftCluster() { poolName, err = mcps.GetByProfile(profile) Expect(err).ToNot(HaveOccurred()) @@ -237,8 +246,10 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific "kernel.sched_rt_runtime_us": "950000", "vm.stat_interval": "10", } - kernelParameters := []string{"processor.max_cstate=1", "intel_idle.max_cstate=0"} - + kernelParameters := []string{"processor.max_cstate=1"} + if isIntel { + kernelParameters = append(kernelParameters, "intel_idle.max_cstate=0") + } wg := sync.WaitGroup{} By("Waiting for TuneD to start on nodes") for i := 0; i < len(workerRTNodes); i++ { @@ -296,8 +307,10 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific "vm.stat_interval": "10", } kernelParameters := []string{noHzParam, "tsc=reliable", "nosoftlockup", "nmi_watchdog=0", "mce=off", "skew_tick=1", - "processor.max_cstate=1", "intel_idle.max_cstate=0", "idle=poll"} - + "processor.max_cstate=1", "idle=poll"} + if isIntel { + kernelParameters = append(kernelParameters, "intel_idle.max_cstate=0") + } wg := sync.WaitGroup{} By("Waiting for TuneD to start on nodes") for i := 0; i < len(workerRTNodes); i++ { @@ -319,6 +332,7 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific By(fmt.Sprintf("Checking TuneD parameters on %q", node.Name)) kernelParameters = append(kernelParameters, utilstuned.AddPstateParameter(context.TODO(), node)) + utilstuned.CheckParameters(context.TODO(), node, sysctlMap, kernelParameters, stalldEnabled, rtKernel) }() } @@ -349,9 +363,14 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific By("Verifying node kernel arguments") cmdline, err := nodes.ExecCommand(context.TODO(), &workerRTNodes[0], []string{"cat", "/proc/cmdline"}) Expect(err).ToNot(HaveOccurred()) - Expect(cmdline).To(ContainSubstring("intel_pstate=passive")) - Expect(cmdline).ToNot(ContainSubstring("intel_pstate=active")) + if isIntel { + Expect(cmdline).To(ContainSubstring("intel_pstate=passive")) + Expect(cmdline).ToNot(ContainSubstring("intel_pstate=active")) + } else { + Expect(cmdline).To(ContainSubstring("amd_pstate=passive")) + Expect(cmdline).ToNot(ContainSubstring("amd_pstate=active")) + } By("Verifying tuned profile") key := types.NamespacedName{ Name: components.GetComponentName(profile.Name, components.ProfileNamePerformance), @@ -371,6 +390,7 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific // This test requires real hardware with powermanagement settings done on BIOS // Using numa nodes to check if we are running on real hardware. checkHardwareCapability(context.TODO(), workerRTNodes) + // First enable HighPowerConsumption currentWorkloadHints := profile.Spec.WorkloadHints By("Modifying profile") @@ -404,8 +424,10 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific "vm.stat_interval": "10", } kernelParameters := []string{noHzParam, "tsc=reliable", "nosoftlockup", "nmi_watchdog=0", "mce=off", "skew_tick=1", - "processor.max_cstate=1", "intel_idle.max_cstate=0", "idle=poll"} - + "processor.max_cstate=1", "idle=poll"} + if isIntel { + kernelParameters = append(kernelParameters, "intel_idle.max_cstate=0") + } wg := sync.WaitGroup{} By("Waiting for TuneD to start on nodes") for i := 0; i < len(workerRTNodes); i++ { @@ -461,8 +483,15 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific "kernel.sched_rt_runtime_us": "-1", "vm.stat_interval": "10", } - kernelParameters = []string{noHzParam, "tsc=reliable", "nosoftlockup", "nmi_watchdog=0", "mce=off", "skew_tick=1", "intel_pstate=passive"} + kernelParameters = []string{noHzParam, "tsc=reliable", "nosoftlockup", "nmi_watchdog=0", "mce=off", "skew_tick=1"} + // Note: Here if it's not intel, its AMD + if isIntel { + kernelParameters = append(kernelParameters, "intel_pstate=passive") + } + if isAMD { + kernelParameters = append(kernelParameters, "amd_pstate=passive") + } wg = sync.WaitGroup{} By("Waiting for TuneD to start on nodes") for i := 0; i < len(workerRTNodes); i++ { @@ -526,7 +555,12 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific "vm.stat_interval": "10", } kernelParameters := []string{noHzParam, "tsc=reliable", "nosoftlockup", "nmi_watchdog=0", "mce=off", "skew_tick=1", "intel_pstate=passive"} - + if isIntel { + kernelParameters = append(kernelParameters, "intel_pstate=passive") + } + if isAMD { + kernelParameters = append(kernelParameters, "amd_pstate=passive") + } wg := sync.WaitGroup{} By("Waiting for TuneD to start on nodes") for i := 0; i < len(workerRTNodes); i++ { @@ -581,8 +615,11 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific "vm.stat_interval": "10", } kernelParameters = []string{noHzParam, "tsc=reliable", "nosoftlockup", "nmi_watchdog=0", "mce=off", "skew_tick=1", - "processor.max_cstate=1", "intel_idle.max_cstate=0", "idle=poll"} + "processor.max_cstate=1", "idle=poll"} + if isIntel { + kernelParameters = append(kernelParameters, "intel_idle.max_cstate=0") + } wg = sync.WaitGroup{} By("Waiting for TuneD to start on nodes") for i := 0; i < len(workerRTNodes); i++ { @@ -648,6 +685,9 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific var err error // This test requires real hardware with powermanagement settings done on BIOS // Using numa nodes to check if we are running on real hardware. + if isAMD { + Skip("Crio Powersave annotations test can only be run on Intel systems") + } checkHardwareCapability(context.TODO(), workerRTNodes) currentWorkloadHints := profile.Spec.WorkloadHints profile.Spec.WorkloadHints = &performancev2.WorkloadHints{ @@ -752,6 +792,9 @@ var _ = Describe("[rfe_id:49062][workloadHints] Telco friendly workload specific // This test requires real hardware with powermanagement settings done on BIOS // Using numa nodes to check if we are running on real hardware var containerCgroup, fullPath string + if isAMD { + Skip("Crio Performance annotations test can only be run on Intel systems") + } checkHardwareCapability(context.TODO(), workerRTNodes) currentWorkloadHints := profile.Spec.WorkloadHints profile.Spec.WorkloadHints = &performancev2.WorkloadHints{