Skip to content
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

Closed
wants to merge 1 commit into from
Closed

HPET clocksource is forbidden #82

wants to merge 1 commit into from

Conversation

rafaelfolco
Copy link
Contributor

Change validate_clocksources logic to support all the available clocks except hpet. This eliminates the need of arch dependent code and simplifies the validation.

Change validate_clocksources logic to support all the available
clocks except hpet. This eliminates the need of arch dependent
code and simplifies the validation.
@rafaelfolco rafaelfolco requested a review from k-rister August 21, 2024 13:30
Comment on lines +109 to +110
if [[ "${available_clocksources}" == *"${clocksource}"* ]]; then
if [[ "${forbidden_clocksources}" != *"${clocksource}"* ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The 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:

list="foo bar zorg"
item="mzorg"
if [[ "${list}" != *"${item}"* ]]; then echo match; else echo "no match"; fi

emits this when run: match

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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:

list="foo bar zorg"
item="mzorg"
if [[ "${list}" != *"${item}"* ]]; then echo match; else echo "no match"; fi

emits this when run: match

The two lines should check:
if available && !forbidden

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....

# forbidden="hpet"
# available="tsc foo bar"
# clock="tsc"

# if [[ "${available}" == *"${clock}"* ]]; then echo "ok"; else echo "unavailable"; fi
ok
# if [[ "${forbidden}" != *"${clock}"* ]]; then echo "ok"; else echo "forbidden"; fi
ok

# clock="hpet"
# if [[ "${forbidden}" != *"${clock}"* ]]; then echo "ok"; else echo "forbidden"; fi
forbidden

# clock="new"
# if [[ "${available}" == *"${clock}"* ]]; then echo "ok"; else echo "unavailable"; fi
unavailable

# clock="Xhpet"
# if [[ "${forbidden}" != *"${clock}"* ]]; then echo "ok"; else echo "forbidden"; fi
ok
# if [[ "${available}" == *"${clock}"* ]]; then echo "ok"; else echo "unavailable"; fi
unavailable

The partial match problem (substring): clock=pet and forbidden=hpet

# clock="pet"
# if [[ "${forbidden}" != *"${clock}"* ]]; then echo "ok"; else echo "forbidden"; fi
forbidden

I'll fix this.

Comment on lines -103 to +105
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"
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

@rafaelfolco rafaelfolco deleted the clock-arm branch August 21, 2024 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants