2022-05-19
00:18haichenzhou[m] has joined #asahi-re
01:14riker77_ has joined #asahi-re
01:18riker77 has quit [Ping timeout: 480 seconds]
01:18riker77_ is now known as riker77
02:08phiologe has joined #asahi-re
02:10PhilippvK has quit [Ping timeout: 480 seconds]
02:38jakebot has quit [Quit: The Lounge - https://thelounge.chat]
03:00jakebot has joined #asahi-re
05:26nicolas17 has quit [Quit: Konversation terminated!]
07:09MajorBiscuit has joined #asahi-re
08:10the_lanetly_052 has joined #asahi-re
08:45MajorBiscuit has quit [Quit: WeeChat 3.4]
08:49MajorBiscuit has joined #asahi-re
09:16bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
09:43bisko has joined #asahi-re
10:25the_lanetly_052 has quit [Ping timeout: 480 seconds]
10:42bisko has quit [Ping timeout: 480 seconds]
11:37MajorBiscuit has quit [Ping timeout: 480 seconds]
11:43MajorBiscuit has joined #asahi-re
11:44MajorBiscuit has quit []
11:56bisko has joined #asahi-re
11:57bisko has quit []
12:35bisko has joined #asahi-re
13:27balrog has quit [Quit: Bye]
13:32balrog has joined #asahi-re
13:34nik875[m] has joined #asahi-re
14:28bisko has quit [Quit: Textual IRC Client: www.textualapp.com]
14:31skipwich has quit [Quit: DISCONNECT]
14:31skipwich has joined #asahi-re
14:48bisko has joined #asahi-re
14:50bisko has quit []
14:52bisko has joined #asahi-re
14:53skipwich has quit [Read error: Connection reset by peer]
14:53skipwich has joined #asahi-re
15:07bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:08bisko has joined #asahi-re
15:13bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:13bisko has joined #asahi-re
15:21bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:22bisko has joined #asahi-re
15:25bisko has quit []
15:44bisko has joined #asahi-re
15:46haichenzhou[m]is it possible to read the performance counters from user space on M1?
15:52haichenzhou[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?
15:55_jannau_haichenzhou[m]: not directly with an unmodified kernel. Apple doesn't have the ARM performance counters but their custome implementation
15:57_jannau_https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/perf/apple_m1_cpu_pmu.c
15:58marcanthe 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
15:58_jannau_overview about the apple registers: https://github.com/AsahiLinux/docs/wiki/HW:ARM-System-Registers#performance-counter-registers
16:00_jannau_the ARM performance registers have an userspace toggle as well, forcefully disabled in the kernel
16:02marcanhttps://oftc.irclog.whitequark.org/asahi/2021-11-16#30381586 <- this is how you use them from Linux userspace (via the kernel driver)
16:38bisko has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
16:45haichenzhou[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.
16:45haichenzhou[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?).
16:45haichenzhou[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
16:50haichenzhou[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.
16:50haichenzhou[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
16:50haichenzhou[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?).
16:51_jannau_user space access is possible after setting bit 30 in SYS_APL_PMCR0_EL1. I only tested reads from SYS_APL_PMCx though
16:52haichenzhou[m]Sure, I will have a try.
16:58amarioguy has joined #asahi-re
17:13nicolas17 has joined #asahi-re
17:32pazyleon[m] has joined #asahi-re
19:16holyspirit[m]can anyone help me to work out why my keyboard isnt responding in grub menu of asahi linux minimal isntall mac mini m1
19:18chengsun has quit [Quit: Quit]
19:18chengsun has joined #asahi-re
19:19holyspirit[m]how do you get mac mini m1 chip to allow keyboard to work on grub menu
19:29bisko has joined #asahi-re