cyring / CoreFreq

CoreFreq : CPU monitoring and tuning software designed for 64-bit processors.
https://www.cyring.fr
GNU General Public License v2.0
1.97k stars 126 forks source link

[SOLVED] AMD/Zen - Fixed performance counters garbage after S3 #312

Closed cyring closed 2 years ago

cyring commented 2 years ago

Discussed in https://github.com/cyring/CoreFreq/discussions/298

Originally posted by **cyring** November 11, 2021 # AMD/Matisse This is an unsolved issue about counters _corruption_ after resuming processor from S3 (Suspend To Ram). Looking into the UCC column, delta value of `18446744073709551615`, the positive value of `-1`, let me think that the counter is stuck to reset. UCC is bound to the x86 register `MSR_IA32_APERF` https://github.com/cyring/CoreFreq/blob/07069d5c80acb48f55f1b944b1424f6109175f6e/corefreqk.c#L10548 **The same test on a 5300U does not produce such issue!** Searching among the AMD specification updates has not revealed an errata. ## Before S3 ![2021-11-11-034240_1580x550_scrot](https://user-images.githubusercontent.com/11563789/141228454-21969576-2a36-43bd-80ab-dab6ccb17f6a.png) ![2021-11-11-034325_644x550_scrot](https://user-images.githubusercontent.com/11563789/141228473-b5f4708f-862d-4114-b847-6d4466e88f21.png) ## After S3 ![2021-11-11-034450_1588x550_scrot](https://user-images.githubusercontent.com/11563789/141228496-ee94e84e-ddeb-4488-9946-7388beecd33d.png) ![2021-11-11-034654_644x550_scrot](https://user-images.githubusercontent.com/11563789/141228510-f52edea9-6840-4749-9d99-34b8b682ccf3.png) ## Unexpected workaround Strangely, the effect tends to disappear over several periods and the `MSR_IA32_APERF` per CPU starts to count again, with occasional corruptions.
cyring commented 2 years ago

rdmsr -aX 0x000000e8 58DA1ED6 FFFFFFFD651E4C86 2CBB9199C 2CA06BAEE 2D692AD05 2D104EB8F 2CC5DE25B 2CF718AE4


* Resetting counters is the workaround which will be applied to all Zen & EPYC families