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

FEXCore: Dynamically scale TSC #4033

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

Sonicadvance1
Copy link
Member

When I implemented TSC scaling originally, I chose a scale factor of 128 because it basically covered the range of devices we cared about without going too high. I also only tested devices that had a TSC scale factor from 19.2Mhz to 34Mhz. Turns out there is hardware that also has a 48Mhz cycle counter, which cause them to effectively have a 6.1Ghz cycle counter, which is kind of absurd.

Instead of a fixed scale, just calculate the amount of scaling we need to get >= the minimum threshold of 1Ghz. This will change the shift from 7 to 5 or 6 for the faster cycle counter devices.

Of course if someone wants to know the scale factor they can still use cpuid function 15h to know it.

Fixes #4026

When I implemented TSC scaling originally, I chose a scale factor of 128
because it basically covered the range of devices we cared about without
going too high. I also only tested devices that had a TSC scale factor
from 19.2Mhz to 34Mhz. Turns out there is hardware that also has a 48Mhz
cycle counter, which cause them to effectively have a 6.1Ghz cycle
counter, which is kind of absurd.

Instead of a fixed scale, just calculate the amount of scaling we need
to get >= the minimum threshold of 1Ghz. This will change the shift from
7 to 5 or 6 for the faster cycle counter devices.

Of course if someone wants to know the scale factor they can still use
cpuid function 15h to know it.

Fixes FEX-Emu#4026
These will differ depending on which runner they are running on. Just
disable them but keep the instructions around so show how bad rdtscp is,
but how good rdtsc is.
@Sonicadvance1 Sonicadvance1 merged commit 46a2a06 into FEX-Emu:main Sep 3, 2024
12 checks passed
@Sonicadvance1 Sonicadvance1 deleted the dynamic_scale_support branch September 3, 2024 23:11
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.

Support scaling cyclecounter dynamically
2 participants