-
Notifications
You must be signed in to change notification settings - Fork 5
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
HPET clocksource is forbidden #82
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
Comment on lines
+109
to
+110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this is good logic here. The first line is making sure that the current clocksource is one of the available clock sources? That is a given, right? This just seems unnecessary. The second line allows for partial matches which might not be a good thing at some point:
emits this when run: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The two lines should check: But yes, you are right. It is giving false positive on partial matches for the forbidden list. I'll change that logic. The tests go well until the substring test....
The partial match problem (substring): clock=pet and forbidden=hpet
I'll fix this. |
||
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 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how I feel about switching from a list of explicitly supported clocksources to a list of explicitly forbidden ones. I suppose that explicity forbidden is easier to maintain, but it also means we could be running with a clocksource that we have not validated to actually be acceptable. Thoughts @atheurer ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the purpose of checking what is available ?
If we have a hard coded list for supported_clocksources, there is no point in checking available ones in the clocksource dir.
The current code allows kvm and hyperv clocksources and even doesn't check if they are available.