I got that application in user-space can not access "PMCCNTR_EL0" commonly. So, I cross-compiled kernel-space code in github project above and insmod gennerated ko file on my rk3399 board.
However, I still could not access PMCCNTR_EL0 regsiter after that. I wonder that how could I fix it?
HiMy name is Stephen and I work at Arm.PMCCNTR_EL0 is in the Core power domain. Is it possible that the Linux kernel is powering down the core that you are trying to count cycles on? That could explain why you are sometimes unable to access PMCCNTR_EL0.developer.arm.com/.../PMCCNTR-EL0--Performance-Monitors-Cycle-Countersays PMCCNTR_EL0 is accessible through the external debug interface as follows: When IsCorePowered(), !DoubleLockStatus(), !OSLockStatus(), AllowExternalPMUAccess() and SoftwareLockStatus() accesses to this register are RO. When IsCorePowered(), !DoubleLockStatus(), !OSLockStatus(), AllowExternalPMUAccess() and !SoftwareLockStatus() accesses to this register are RW. Otherwise accesses to this register generate an error response. Hope this helpsStephen
Thanks for your reply ! When I disable all core couidle like below
for X in $(seq 0 3); do for Y in $(seq 1 6); do echo 1 > /sys/devices/system/cpu/cpu$X/cpuidle/state$Y/disable ; done ; done"asm volatile("mrs %0, pmccntr_el0" : "=r"(time_start))" will not lead to illegal instruction
for X in $(seq 0 3); do for Y in $(seq 1 6); do echo 1 > /sys/devices/system/cpu/cpu$X/cpuidle/state$Y/disable ; done ; done
What I want to know is does PMCCNTR_EL0 register being shared with each cpu core and will increment it self if any cpu core active? If that, how should I use PMCCNTR_EL0 ?
Hi again,Each core has its own Performance Monitoring Unit (PMU), and its own PMCCNTR_EL0, so the cycle counts read are per-core.Sorry, I don't recognise the error message that you are seeing. Is that coming from GCC?Are you using Arm Development Studio? This forum is for questions about Arm Development Studio.For questions about Arm processors, try the Architectures and Processors forum atcommunity.arm.com/.../architectures-and-processors-forumThe use of PMCCNTR_EL0 has been asked about by other people - try searching the Arm Community forum for "PMCCNTR_EL0" to see those discussions, e.g. community.arm.com/.../arm-v8-pmu-cycle-counterHope this helpsStephen