Hi Chris,
Thanks for your feedback.
On Wed, Mar 14, 2018 at 08:07:49PM -0700, Christopher Celio wrote:
> Great to see progress on this front!
>
> > • There is no mode control mechanism for counters, so that perf cannot explicitly count user-/kernel-space-only events.
>
> Does that have to be OS visible? In the hardware, I can trivially use 1 or 2 bits of the XLEN event ID selector to specify which mode I want the event to trigger on.
I don't known much how dtrace deal with these issues, but in Linux landscape,
monitoring tools especially perf can take advantage of this feature to accurately
count/sample events in different processor mode.
For example, a classical usage of perf is like
> $ perf record -e cycles:u -a -- sleep 5
which means that perf will sample the cycle count of "sleep 5" in user space ONLY.
The same goes to kernel space.
Note that in such use case, the mode information should not only be visible to S-mode,
but also modifiable. I guess this somehow violates the RISC-V philosophy, so more
detail in this later.
>
> > There is no interrupt for a counter overflow events. Assume that this is important to be appended in the spec in the future, or most of the vendors will support this feature,
>
> Is this fundamental to performance monitoring, or is this just what happened to exist in x86 land, so perf was implemented to utilize those features?
Please allow me to quote this paragraph from the Perf Wiki
(
https://perf.wiki.kernel.org/index.php/Tutorial#Event-based_sampling_overview)
> Perf_events is based on event-based sampling. The period is expressed as the number of occurrences of an event, not the number of timer ticks. A sample is recorded when the sampling counter overflows, i.e., wraps from 2^64 back to 0. No PMU implements 64-bit hardware counters, but perf_events emulates such counters in software.
So, the kernel just needs some asynchronous signal to tell it which and when
the counters overflowed, and many other legacy ISAs did support this.
> I hate to take on other ISAs' legacy baggage if it's not fundamental.
We understand that.
What I can provide in this discussion is the perspective of users
, who are Linux guys and tend to rely on perf, the most popular and
most general performance monitoring tool now, to tune their software and systems.
Fundamental or not, it is not my call.
We known that such hardware units may not conform to the design philosophy, but
it would be helpful if those registers/mechanisms becomes part of the standard spec.
Not only because some users do need them to be supported, but also we will do them
in our IPs.
I hope these explanation helps,
Alan Kao, Andes Technology
> To view this discussion on the web visit
https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/403B4B5F-AE1F-466C-9B8D-BFA7CF9B7AD4%40eecs.berkeley.edu.