Skip to content

Commit

Permalink
ufs/tpmi_ufs.sh: Fix possible false results when driver sysfs does no…
Browse files Browse the repository at this point in the history
…t exist

If the kernel is built without CONFIG_INTEL_UNCORE_FREQ_CONTROL enabled,
the driver sysfs path won't exist, so the tests are expected to fail,
but actually it gives PASS results:

<<<test start - 'tpmi_ufs.sh -t check_ufs_init_min_max_value'>>
ls: cannot access '/sys/devices/system/cpu/intel_uncore_frequency': No such file or directory
|1214_133318.071|TRACE|Uncore number: 0|
<<<test end, result: PASS, duration: 0.032>>

<<<test start - 'tpmi_ufs.sh -t check_ufs_min_equals_to_max'>>
ls: cannot access '/sys/devices/system/cpu/intel_uncore_frequency': No such file or directory
<<<test end, result: PASS, duration: 0.030>>

<<<test start - 'tpmi_ufs.sh -t check_ufs_max_equals_to_min'>>
ls: cannot access '/sys/devices/system/cpu/intel_uncore_frequency': No such file or directory
<<<test end, result: PASS, duration: 0.031>>

<<<test start - 'tpmi_ufs.sh -t check_ufs_current_dynamic'>>
ls: cannot access '/sys/devices/system/cpu/intel_uncore_frequency': No such file or directory
<<<test end, result: PASS, duration: 0.030>>

After CONFIG_INTEL_UNCORE_FREQ_CONTROL being enabled in the kernel, if
the uncore number is 0, the tests are not done, either, so it is
expected to be shown as BLOCK instead of PASS.

<<<test start - 'tpmi_ufs.sh -t check_ufs_init_min_max_value'>>
|0122_044137.087|TRACE|Uncore number: 0|
<<<test end, result: PASS, duration: 0.099>>

<<<test start - 'tpmi_ufs.sh -t check_ufs_min_equals_to_max'>>
<<<test end, result: PASS, duration: 0.089>>

<<<test start - 'tpmi_ufs.sh -t check_ufs_max_equals_to_min'>>
<<<test end, result: PASS, duration: 0.091>>

<<<test start - 'tpmi_ufs.sh -t check_ufs_current_dynamic'>>
<<<test end, result: PASS, duration: 0.099>>

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Yujie Liu <[email protected]>
  • Loading branch information
Yujie-Liu authored and ysun committed Jan 31, 2024
1 parent bdbc173 commit 96a42ee
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ufs/tpmi_ufs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ ufs_sysfs_attr() {
}

ufs_init_min_max_value() {
[[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist"
per_die_num=$(ls "$UFS_SYSFS_PATH" | grep -c uncore)
test_print_trc "Uncore number: $per_die_num"
[[ "$per_die_num" = 0 ]] && block_test "Uncore number is 0"
for ((i = 1; i <= per_die_num; i++)); do
per_die=$(ls "$UFS_SYSFS_PATH" | grep uncore | sed -n "$i,1p")
init_min=$(cat $UFS_SYSFS_PATH/"$per_die"/initial_min_freq_khz)
Expand All @@ -125,7 +127,10 @@ ufs_init_min_max_value() {
min_equals_to_max() {
# Test Uncore freq is based on per die, this function is to set
# Min_freq_khz to the same value of initial_max_freq_khz
[[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist"
per_die_num=$(ls "$UFS_SYSFS_PATH" | grep -c uncore)
test_print_trc "Uncore number: $per_die_num"
[[ "$per_die_num" = 0 ]] && block_test "Uncore number is 0"
for ((i = 1; i <= per_die_num; i++)); do
per_die=$(ls "$UFS_SYSFS_PATH" | grep uncore | sed -n "$i,1p")

Expand Down Expand Up @@ -173,7 +178,10 @@ the max test freq $init_max khz"
max_equals_to_min() {
# Test Uncore freq is based on per die, this function is to set
# Max_freq_khz to the same value of initial_min_freq_khz
[[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist"
per_die_num=$(ls "$UFS_SYSFS_PATH" | grep -c uncore)
test_print_trc "Uncore number: $per_die_num"
[[ "$per_die_num" = 0 ]] && block_test "Uncore number is 0"
for ((i = 1; i <= per_die_num; i++)); do
per_die=$(ls "$UFS_SYSFS_PATH" | grep uncore | sed -n "$i,1p")

Expand Down Expand Up @@ -223,7 +231,10 @@ min_max_dynamic() {

# Test Uncore freq is based on per die, this function is to set test freq to
# current_freq_khz value + 100000 khz
[[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist"
per_die_num=$(ls "$UFS_SYSFS_PATH" | grep -c uncore)
test_print_trc "Uncore number: $per_die_num"
[[ "$per_die_num" = 0 ]] && block_test "Uncore number is 0"
for ((i = 1; i <= per_die_num; i++)); do
per_die=$(ls "$UFS_SYSFS_PATH" | grep uncore | sed -n "$i,1p")

Expand Down Expand Up @@ -276,7 +287,10 @@ min and max test freq $test_freq khz"
}

pkg_max_min_freq_change() {
[[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist"
pkg_num=$(ls "$UFS_SYSFS_PATH" | grep -c package)
test_print_trc "Package number: $pkg_num"
[[ "$pkg_num" = 0 ]] && block_test "Package number is 0"

# All the packages initial_max_freq_khz and initial_min_freq_khz are same at boot
# So set test_max_freq and test_min_freq by referring any package
Expand Down

0 comments on commit 96a42ee

Please sign in to comment.