Skip to content

Commit

Permalink
HPET clocksource is forbidden
Browse files Browse the repository at this point in the history
Change validate_clocksources logic to support all the available
clocks except hpet. This eliminates the need of arch dependent
code and simplifies the validation.
  • Loading branch information
rafaelfolco committed Aug 21, 2024
1 parent e4ad968 commit 6a49757
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions bash/library/bench-base
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,29 @@ function validate_sw_prereqs() {
}

function validate_clocksource() {
local clocksource clocksource_dir available_clocksources
local clocksource clocksource_dir available_clocksources forbidden_clocksources

clocksource_dir="/sys/devices/system/clocksource/clocksource0"

if pushd ${clocksource_dir} > /dev/null; then
clocksource=$(cat current_clocksource)
available_clocksources=$(cat available_clocksource)
supported_clocksources="tsc kvm-clock hyperv_clocksource_tsc_page"
clocksource="$(cat current_clocksource)"
available_clocksources="$(cat available_clocksource)"
forbidden_clocksources="hpet"

popd > /dev/null

case "${clocksource}" in
"tsc"|"kvm-clock"|"hyperv_clocksource_tsc_page")
echo "Verified clocksource is ${clocksource}"
if [[ "${available_clocksources}" == *"${clocksource}"* ]]; then
if [[ "${forbidden_clocksources}" != *"${clocksource}"* ]]; then
echo "Verified clocksource is ${clocksource}."
return 0
;;
*)
echo "ERROR: Unsupported clocksource. Current clocksource is ${clocksource}. Available clocksources are: ${available_clocksources}. Supported clocksources are: ${supported_clocksources}"
return 2
;;
esac
fi
fi
echo "ERROR: Unsupported clocksource. Current clocksource is ${clocksource}."
echo "Available clocksources are: ${available_clocksources}."
echo "Forbidden clocksources are: ${forbidden_clocksources}."
return 2
else
echo "ERROR: Could not pushd to ${clocksource_dir}"
echo "ERROR: Could not pushd to ${clocksource_dir} and verify clocksource."
return 1
fi
}

0 comments on commit 6a49757

Please sign in to comment.