|
Proposal v5: SBI PMU Extension
Hi All,
We don't have a dedicated RISC-V PMU extension for all privilege modes
but we do have M-mode HARDWARE performance counters such as MCYCLE CSR,
MINSTRET CSR, and MHPMCOUNTER CSRs which are
Hi All,
We don't have a dedicated RISC-V PMU extension for all privilege modes
but we do have M-mode HARDWARE performance counters such as MCYCLE CSR,
MINSTRET CSR, and MHPMCOUNTER CSRs which are
|
By
Anup Patel
·
#197
·
|
|
Re: Proposal v4: SBI PMU Extension
The SBI SOFTWARE events will be treated same as SBI HARDWARE RAW events in Linux PMU driver. The Bit63 of perf_event_attr.config will be used by Linux PMU driver to distinguish between SBI SOFTWARE
The SBI SOFTWARE events will be treated same as SBI HARDWARE RAW events in Linux PMU driver. The Bit63 of perf_event_attr.config will be used by Linux PMU driver to distinguish between SBI SOFTWARE
|
By
Anup Patel
·
#196
·
|
|
Re: Proposal v4: SBI PMU Extension
A normal SBI call is perhaps 2x faster than doing trap-n-emulate, but something like 100x slower than a shared memory read. If the reads are going to be very frequent we should go with the shared
A normal SBI call is perhaps 2x faster than doing trap-n-emulate, but something like 100x slower than a shared memory read. If the reads are going to be very frequent we should go with the shared
|
By
Jonathan Behrens <behrensj@...>
·
#195
·
|
|
Re: Proposal v4: SBI PMU Extension
Given the cost / complications to support making M-mode software counters directly readable by non-M-mode software, this compromise is probably a good one to make. (It's easy to conceptualize what
Given the cost / complications to support making M-mode software counters directly readable by non-M-mode software, this compromise is probably a good one to make. (It's easy to conceptualize what
|
By
Greg Favor
·
#194
·
|
|
Re: Proposal v4: SBI PMU Extension
Trap-n-emulate illegal instructions is bit expensive particularly when MTVAL/STVAL CSR does not have the illegal instruction encoding because in OpenSBI/Hypervisors we end-up doing unprivileged access
Trap-n-emulate illegal instructions is bit expensive particularly when MTVAL/STVAL CSR does not have the illegal instruction encoding because in OpenSBI/Hypervisors we end-up doing unprivileged access
|
By
Anup Patel
·
#193
·
|
|
Re: Proposal v4: SBI PMU Extension
Instead of SBI_PMU_SOFTWARE_COUNTER_READ, we could even just trap-and-emulate accesses to HPMCOUNTERx. The performance difference should be relatively minimal (at least compared to the shared memory
Instead of SBI_PMU_SOFTWARE_COUNTER_READ, we could even just trap-and-emulate accesses to HPMCOUNTERx. The performance difference should be relatively minimal (at least compared to the shared memory
|
By
Jonathan Behrens <behrensj@...>
·
#192
·
|
|
Re: Proposal v4: SBI PMU Extension
Ahh, I didn't realize that these were only M-mode software counters, i.e. they are only controlled and incremented by M mode.. That makes things clearer now.
In which case, why not go with the
Ahh, I didn't realize that these were only M-mode software counters, i.e. they are only controlled and incremented by M mode.. That makes things clearer now.
In which case, why not go with the
|
By
Greg Favor
·
#191
·
|
|
Re: Proposal v4: SBI PMU Extension
Instead of having separate physical address for each SOFTWARE counter, we can have single base physical address for all SOFTWARE counters. Each SOFTWARE counter will be written at address = <base> +
Instead of having separate physical address for each SOFTWARE counter, we can have single base physical address for all SOFTWARE counters. Each SOFTWARE counter will be written at address = <base> +
|
By
Anup Patel
·
#190
·
|
|
Re: Proposal v4: SBI PMU Extension
What I imagine is that a block of memory is allocated up front for software counters, and with PMPv2 that is made from within a "shared" region of memory. Individual counters are then allocated from
What I imagine is that a block of memory is allocated up front for software counters, and with PMPv2 that is made from within a "shared" region of memory. Individual counters are then allocated from
|
By
Greg Favor
·
#189
·
|
|
Re: Proposal v4: SBI PMU Extension
How about "Non-zero values for event_info are reserved. Future versions of this specification may use them to pass configuration flags like event filter, overflow interrupt, etc."
There likely
How about "Non-zero values for event_info are reserved. Future versions of this specification may use them to pass configuration flags like event filter, overflow interrupt, etc."
There likely
|
By
Jonathan Behrens <behrensj@...>
·
#188
·
|
|
Re: Proposal v4: SBI PMU Extension
For SBI_PMU_COUNTER_GET_PHYS_ADDR call, both OpenSBI and Hypervisors will have to show SOFTWARE counter memory as reserved memory regions in device-tree. This is straight forward for OpenSBI but it
For SBI_PMU_COUNTER_GET_PHYS_ADDR call, both OpenSBI and Hypervisors will have to show SOFTWARE counter memory as reserved memory regions in device-tree. This is straight forward for OpenSBI but it
|
By
Anup Patel
·
#187
·
|
|
Re: Proposal v4: SBI PMU Extension
The SBI_PMU_SOFTWARE_COUNTER_READ call certainly has performance issue. The only benefit it provides is no shared mapping. Anyway, we can’t compromise performance so let’s drop this idea.
The SBI_PMU_SOFTWARE_COUNTER_READ call certainly has performance issue. The only benefit it provides is no shared mapping. Anyway, we can’t compromise performance so let’s drop this idea.
|
By
Anup Patel
·
#186
·
|
|
Re: Proposal v4: SBI PMU Extension
If my last comments are valid, then it seems like we're back to having either SBI_PMU_COUNTER_GET_PHYS_ADDR or SBI_PMU_COUNTER_SET_PHYS_ADDR. In which case (since both S/HS and M modes need to
If my last comments are valid, then it seems like we're back to having either SBI_PMU_COUNTER_GET_PHYS_ADDR or SBI_PMU_COUNTER_SET_PHYS_ADDR. In which case (since both S/HS and M modes need to
|
By
Greg Favor
·
#185
·
|
|
Re: Proposal v4: SBI PMU Extension
Allowing event_info to be zero by default is OK. But as some of the higher bits of mhpmevent CSRs become standardized (or someone has non-standard bits up there), event_info will need to be non-zero
Allowing event_info to be zero by default is OK. But as some of the higher bits of mhpmevent CSRs become standardized (or someone has non-standard bits up there), event_info will need to be non-zero
|
By
Greg Favor
·
#184
·
|
|
Re: Proposal v4: SBI PMU Extension
I realize that in my comments below to Jonathon's SBI_PMU_COUNTER_SET_PHYS_ADDR question, I should have asked (to Anup) whether all allocation of counters is to be done by OS/hypervisor and M-mode
I realize that in my comments below to Jonathon's SBI_PMU_COUNTER_SET_PHYS_ADDR question, I should have asked (to Anup) whether all allocation of counters is to be done by OS/hypervisor and M-mode
|
By
Greg Favor
·
#183
·
|
|
Re: Proposal v4: SBI PMU Extension
Hi Jonathan,
I agree “the event_info is optional and can be zero” is totally misleading for HARDWARE and CACHE events. Thanks for pointing. Eventually, the event_info will be used to pass
Hi Jonathan,
I agree “the event_info is optional and can be zero” is totally misleading for HARDWARE and CACHE events. Thanks for pointing. Eventually, the event_info will be used to pass
|
By
Anup Patel
·
#182
·
|
|
Re: Proposal v4: SBI PMU Extension
Thanks. That's what I was speculating in the second half of my question, i.e. software will have to call SBI_PMU_COUNTER_GET_CSR N times no matter what (after obtaining 'N' from a call to
Thanks. That's what I was speculating in the second half of my question, i.e. software will have to call SBI_PMU_COUNTER_GET_CSR N times no matter what (after obtaining 'N' from a call to
|
By
Greg Favor
·
#181
·
|
|
Re: Proposal v4: SBI PMU Extension
Hi Greg,
We want to allow RISC-V implementation specific CSRs (apart from various HPMCOUNTER CSRs) as HARDWARE counters. Due to this reason, we have decoupled counter_idx from CSR number and we
Hi Greg,
We want to allow RISC-V implementation specific CSRs (apart from various HPMCOUNTER CSRs) as HARDWARE counters. Due to this reason, we have decoupled counter_idx from CSR number and we
|
By
Anup Patel
·
#180
·
|
|
Re: Proposal v4: SBI PMU Extension
Anup,
Wouldn't software want to more easily and directly know from SBI_PMU_NUM_COUNTERS how many hardware counters and software counters there are, instead of having to then call
Anup,
Wouldn't software want to more easily and directly know from SBI_PMU_NUM_COUNTERS how many hardware counters and software counters there are, instead of having to then call
|
By
Greg Favor
·
#179
·
|
|
Re: Proposal v4: SBI PMU Extension
Hi Greg,
The SBI_PMU_NUM_COUNTERS call will return total number of counters (HARDWARE as well as SOFTWARE).
We can distinguish between HARDWARE and SOFTWARE counters using the CSR_Number
Hi Greg,
The SBI_PMU_NUM_COUNTERS call will return total number of counters (HARDWARE as well as SOFTWARE).
We can distinguish between HARDWARE and SOFTWARE counters using the CSR_Number
|
By
Anup Patel
·
#178
·
|