Questions on HPMs

Beeman Strong

Hi there,

I'm working on PMU definition at Rivos, and had some questions about the HPM architecture (including Sscofpmf extension).  I started just a couple of weeks ago, and while I tried to do my homework by digging through old messages I may have missed some, so forgive me if some of these questions have been answered before.

1) I notice that the instret and cycle counters have been excluded from filtering/sampling support with Sscofpmf.  Doesn't the inability to filter these counters based on privilege level (PL) create problems for exposing them to lower PLs?  For instance, a guest OS running in VS may be confused when a guest page fault causes the instret value to be inflated by the HS fault handler.  Such cross-PL exposure could even be a side-channel threat, enabling code in U to discern the number of instructions retired handling an ECALL in S/M.

2) I haven't seen a clear definition of what instret counts, other than:

* The minstret CSR counts the number of instructions the hart has retired.
* As ECALL and EBREAK cause synchronous exceptions, they are not considered to retire, and should not increment the minstret CSR.

From this I'm inferring that neither interrupts nor instructions that take exceptions increment instret.  Is that right?


Join to automatically receive all group messages.