Skip to content

Added Kernel Level testcases #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2025
Merged

Conversation

vnarapar
Copy link
Contributor

Added the below testcases

  • DCVS testcase
  • CPU_Affinity testcase from Scheduler
  • Enhanced existing IOMMU test

@vnarapar vnarapar requested review from mwasilew and smuppand May 26, 2025 06:00
exit 1
fi
done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better move this logic to functestlib.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved his function to functestlib.sh

Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move DCVS out of baseport and create under FunctionaArea

fi
return 0
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved to functestlib.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved his function to functestlib.sh

return 0
}

check_dt_nodes() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be moved to functestlib.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved his function to functestlib.sh

return 1
}

check_driver_loaded() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also can be moved to functestlib.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to functestlib.sh

@vnarapar vnarapar force-pushed the main branch 4 times, most recently from f495f75 to 2322190 Compare May 28, 2025 05:24
@@ -48,6 +48,17 @@ find_test_case_script_by_name() {
find "$base_dir" -type d -iname "$test_name" -print -quit 2>/dev/null
}

check_kernel_config() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some Improvements can be done.

  • Add ; or line breaks for POSIX shell between statements.

  • Always quote variables in command substitutions.

  • Use return 1 right after logging failure, and only one return at the end.

  • Good idea to log both PASS and FAIL for clear CI visibility.

  • if you want it extended for “=m” (module) configs as well!

@vnarapar vnarapar force-pushed the main branch 2 times, most recently from 7cdfdbe to f6f346e Compare May 28, 2025 06:45
check_kernel_config "CONFIG_IOMMU_SUPPORT" || pass=false
check_kernel_config "CONFIG_QCOM_IOMMU" || pass=false
check_kernel_config "CONFIG_ARM_SMMU" || pass=false

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with a loop for easier maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this and added loops

@vnarapar vnarapar force-pushed the main branch 2 times, most recently from 06f8566 to 82a7c2c Compare May 28, 2025 12:25

CONFIGS="CONFIG_IOMMU_SUPPORT CONFIG_QCOM_IOMMU CONFIG_ARM_SMMU"
check_kernel_config "$CONFIGS" || {
log_fail "Device tree validation failed."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you are loging wrong statement. Please correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated log statement

}
LOADED_MODULES="msm_iommu arm_smmu"
check_driver_loaded "$LOADED_MODULES" || {
log_fail "Device tree validation failed."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct the log statement according to the modules

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated log statement

Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor changes. Rest LGTM.



check_kernel_config CONFIG_CPU_FREQ CONFIG_CPU_FREQ_GOV_SCHEDUTIL CONFIG_CPU_FREQ_GOV_PERFORMANCE

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add checks similar to IOMMU test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the required checks


check_kernel_config CONFIG_CPU_FREQ CONFIG_CPU_FREQ_GOV_SCHEDUTIL CONFIG_CPU_FREQ_GOV_PERFORMANCE

CPUFREQ_PATH="/sys/devices/system/cpu/cpu0/cpufreq"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to check for all cpu* instead only cpu0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added logic to check for all CPUs

echo "$TESTNAME PASS" > "$res_file"
else
log_fail "Failed to set CPU affinity"
echo "$TESTNAME FAIL" > "$test_path"/$TESTNAME.res
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better main consistency of logging across the scripts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated logging

echo "$TESTNAME PASS" > "$res_file"
else
log_fail "Unexpected scheduling policy. Test Failed"
echo "$TESTNAME FAIL" > "$test_path"/$TESTNAME.res
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better main consistency of logging across the scripts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated logging

@@ -0,0 +1,37 @@
# IOMMU Validation Test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test name is wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated test name

@@ -0,0 +1,37 @@
# IOMMU Validation Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document title it wrong, it should be scheduler instead of IOMMU

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated title

@vnarapar
Copy link
Contributor Author

@smuppand all comments fixed now

CPUFREQ_BASE_PATH="/sys/devices/system/cpu"
i=0

while [ "$i" -le 7 ]; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to make this function generic and target-agnostic. So it works on any number of cpus/cores across the platforms.

  • Dynamically enumerate CPUs from /sys/devices/system/cpu/ (look for cpu[0-9]* directories).
  • Iterate over these directories to check for cpufreq presence.
  • Fail only if at least one CPU should support CPUFreq but doesn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

log_info "CPU frequency range: $MIN_FREQ - $MAX_FREQ"

log_info "Triggering frequency update via governor"
cat /dev/urandom | head -c 1000M > /dev/null &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not the best or most idiomatic way to use of cat. Instead use head -c 1000M /dev/urandom > /dev/null &

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated command with dd if=/dev/urandom of=/dev/null bs=1M count=1000 &


log_info "Creating a CPU-bound background task..."
cpu_task() {
while :; do :; done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loop while :; do :; done is fine for an infinite loop, but it may be more readable as while true; do :; done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified as suggested

Copy link
Contributor

@mwasilew mwasilew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last commit with common functions should be moved to be the 1st commit.

Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase your feature branch on top of the latest main. This makes the PR earier to review and merge.

vnarapar added 4 commits June 4, 2025 16:55
This commit is to add check_kernel_config function in common functions
This function will check if the corresponding configs are enabled in
/proc/config.gz

Added check_driver_loaded to check if any driver is loaded.
Added check_dt_nodes to check if DT nodes are present

Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
This testcase vaildates configs like CONFIG_CPU_FREQ
CONFIG_CPU_FREQ_GOV_SCHEDUTIL CONFIG_CPU_FREQ_GOV_PERFORMANCE and checks
cpu frequencies` before and after a load is applied

Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
This test validates the Scheduler support by checking corresponding
SCHED configs and checks cpu affinity by creating a CPU-bound background task

Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
This test validates the IOMMU (Input-Output Memory Management Unit) support
by checking IOMMU configs and checks if the corresponding drivers are
loaded instead of just checking the dmesg logs.

Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vnarapar vnarapar dismissed mwasilew’s stale review June 4, 2025 11:57

Need for addressing CI failures

@smuppand smuppand merged commit e39ea74 into qualcomm-linux:main Jun 4, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants