skipwich has quit [Read error: Connection reset by peer]
skipwich has joined #asahi-re
bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bisko has joined #asahi-re
bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bisko has joined #asahi-re
bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bisko has joined #asahi-re
bisko has quit []
bisko has joined #asahi-re
<haichenzhou[m]>
is it possible to read the performance counters from user space on M1?
<haichenzhou[m]>
I'm currently reversing the M1 performance counters. when I execute `mrs pmuserenr_el0, 0xf` to enable user space access to performance counter, there is an illegal instruction error. I'm not sure if that is because both msr and mrs instruction can only be used under R0. So what I need to do is using a kernel module to read the performance counters?
<_jannau_>
haichenzhou[m]: not directly with an unmodified kernel. Apple doesn't have the ARM performance counters but their custome implementation
<_jannau_>
a driver for it is already in the kernel
<marcan>
the Apple implementation does have a userspace access toggle, but I don't think our kernel driver currently supports it and either way it's completely incompatible with the ARM version, so you need custom userspace too at that point
bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<haichenzhou[m]>
Thanks, it seems that the msr name i used was ARM's and Apple does have a different name. Now I successfully read the content in my kernel module.
<haichenzhou[m]>
registers a syscall, thus I can simply use inline assembly to get the value of certain system register. But as you show, there is already a driver with good functionalities. Could I just used the driver in userspace? (like perf executable do?).
<haichenzhou[m]>
I still don't understand how to access the driver or use my own kernel module from userspace. (Sorry I'm really a newbie into kernel). What I want to do is fuzzing all the event_id based on whether certain code is runned (either causing loads of cache hit or no cache hit), to determine which id is related to certain event. I'm not sure if that is doable and how to do that. My initial guess was that I could make a kernel module which
<haichenzhou[m]>
* Thanks, it seems that the msr name i used was ARM's and Apple does have a different name. Now I successfully read the content in my kernel module.
<haichenzhou[m]>
I still don't understand how to access the driver or use my own kernel module from userspace. (Sorry I'm really a newbie into kernel). What I want to do is fuzzing all the event_id based on whether certain code is runned (either causing loads of cache hit or no cache hit), to determine which id is related to certain event. I'm not sure if that is doable and how to do that. My initial guess was that I could make a kernel module which
<haichenzhou[m]>
registers a syscall, thus I can simply use inline assembly to get the value of certain system register. But as you show, there is already a driver with good functionalities. Could I just used the driver in userspace? (like what perf executable does?).
<_jannau_>
user space access is possible after setting bit 30 in SYS_APL_PMCR0_EL1. I only tested reads from SYS_APL_PMCx though
<haichenzhou[m]>
Sure, I will have a try.
amarioguy has joined #asahi-re
nicolas17 has joined #asahi-re
pazyleon[m] has joined #asahi-re
<holyspirit[m]>
can anyone help me to work out why my keyboard isnt responding in grub menu of asahi linux minimal isntall mac mini m1
chengsun has quit [Quit: Quit]
chengsun has joined #asahi-re
<holyspirit[m]>
how do you get mac mini m1 chip to allow keyboard to work on grub menu