64 bit race on timer counter in cavs_timer #31599
Labels
bug
The issue is a bug, or the PR is fixing a bug
platform: Intel ADSP
Intel Audio platforms
priority: low
Low impact/importance bug
The CAVS hardware has a 64 bit timer counter (it's the same device as the HD Audio wall clock timer). But the code to read it looks like this:
When compiled on Xtensa, this produces two sequential 32 bit reads of the value. And that's wrong, because the hardware continues to run. It's possible for the two reads to straddle a rollover of the low word and increment of the high word.
This needs to be fixed to be safe. The simplest scheme is to read the high word twice, compare the two values, and repeat the process if they don't match.
The text was updated successfully, but these errors were encountered: