armv8_pmu_cycle_counter_el0 icon indicating copy to clipboard operation
armv8_pmu_cycle_counter_el0 copied to clipboard

Got "illegal instruction" after insmod ko and read pmccntr_el0 in user-space application

Open peyer opened this issue 3 years ago • 3 comments

@jerinjacobk I have cross-compiled your provided kernel-space code, and insmod it on my develop board, but I still got "illegal instruction", How could I fix it ?

I have typed lsmod command, it shown like below Module Size Used by pmu_el0_cycle_counter 16384 0

peyer avatar Dec 30 '21 03:12 peyer

@peyer Are you running Linux perf application in parallel? . Share the kernel version, board name, cpu name and which instruction causing illegal instruction

jerinjacobk avatar Dec 30 '21 04:12 jerinjacobk

I have captured all infomation like below image

After loading module, I just use "asm volatile("mrs %0, pmccntr_el0" : "=r"(val));", which lead to illegal instruction. My board is Firefly-RK3399,

peyer avatar Dec 30 '21 07:12 peyer

@jerinjacobk I also tried some other github project

  1. https://github.com/thoughtpolice/enable_arm_pmu
  2. https://github.com/XKCP/XKCP/blob/master/support/Kernel-PMU/enable_arm_pmu.c
  3. https://ilinuxkernel.com/?p=1755

Unfortunately, I still could not access pmccntr_el0 in my application.

peyer avatar Dec 30 '21 07:12 peyer