Hi,Sorry for my previous description. Not only user space, but also any pmccntr_el0 reading
On Thu, Nov 16, 2017 at 06:27:28AM +0000, Jia He wrote:
Sometimes userspace need a high resolution cycle counter by readingI appreciate that you may wish to make use of the cycle counter from
pmccntr_el0.
In commit da4e4f18afe0 ("drivers/perf: arm_pmu: implement CPU_PM
notifier"), it resets all the counters even when the pmcr_el0.E and
pmcntenset_el0.C are both 1 . That is incorrect.
userspace, but this is the intended behaviour kernel-side. Direct
userspace counter acceess is not supported.
In power states where context is lost, any perf events are
saved/restored by cpu_pm_pmu_setup(). So we certainly shouldn't be
modifying the counter registers in any other PM code.
We *could* expose counters to userspace on homogeneous systems, so long
as users stuck to the usual perf data page interface. However, this
comes with a number of subtle problems, and no-one's done the work to
enable this.
Even then, perf may modify counters at any point in time, and
monotonicity (and/or presence) of counters is not guaranteed.