#
✕ nick:YichaoYu[m]
#asahi-dev · 2022-03-30 13:32
YichaoYu[m]but why shouldn't one put it in the kernel so that perf_type-hardware can be supported?
#asahi-dev · 2022-03-30 13:31
YichaoYu[m]as in `numactl --physcpubind=4 perf stat sleep 1` prints cycles + instructions unsupported
#asahi-dev · 2022-03-30 13:30
YichaoYu[m]if I don't want to use raw events
#asahi-dev · 2022-03-30 13:30
YichaoYu[m]yeah I know that, but there are also generic hardware event
#asahi-dev · 2022-03-30 13:29
YichaoYu[m]Even for perf_type_hardware?
#asahi-dev · 2022-03-30 13:28
YichaoYu[m]But perf print not counting for cycles if the process runs on the p core
#asahi-dev · 2022-03-30 13:28
YichaoYu[m]I mean, if I do to want to use it, and for the purpose of putting those info into the kernel driver, does it need to be re’d?
#asahi-dev · 2022-03-30 13:26
YichaoYu[m]Even if the thread/process is pinned to one core?
#asahi-dev · 2022-03-30 13:26
YichaoYu[m]And does it mean that perf will never be able to print something that makes sense for cycle count?
#asahi-dev · 2022-03-30 13:26
YichaoYu[m]So what do we need to hook it up so that perf can understand them without referring to apple data?
#asahi-dev · 2022-03-30 13:25
YichaoYu[m]Ah yeah missed that…. I thought the unknow_xx is some twisted form of knowing….
#asahi-dev · 2022-03-30 13:20
YichaoYu[m]since just from counting lines, m1_pmu_events only have 31 listed but https://github.com/dougallj/applecpu/blob/main/timer-hacks/bench.py#L85 has about twice that
#asahi-dev · 2022-03-30 13:19
YichaoYu[m]does it mean that I can pass in something that isn't in m1_pmu_events to perf_event_open?
#asahi-dev · 2022-03-30 12:59
YichaoYu[m]oh I see someone mentioned rr there already. yeah I'm mostly interested in finding reliable counters so that rr can work
#asahi-dev · 2022-03-30 12:57
YichaoYu[m]also how was the current list in the kernel generate? is it known to be complete?
#asahi-dev · 2022-03-30 12:55
YichaoYu[m]but before I go taking a deep look at any of these, do any of these count as sources that can be used to write a linux driver?
#asahi-dev · 2022-03-30 12:53
YichaoYu[m]trying to find the a14.plist and then realize that I'm under linux.....
#asahi-dev · 2022-03-30 12:12
YichaoYu[m]I found a few simple ones that are clearly related to memory access and branches but if someone have figured it out already I don't need to redo it...
#asahi-dev · 2022-03-30 12:11
YichaoYu[m]is https://github.com/AsahiLinux/linux/blob/00e23945f258f06ed0cb0dd9ea44272cbdfc7346/drivers/perf/apple_m1_cpu_pmu.c#L31 still the current understanding?
#asahi-dev · 2022-03-30 11:17
YichaoYu[m](also I felt like between cpu frequency change and hitting different bottleneck in different part of the code I've already accepted that unless the code is fully warmed up the number might be difficult to interpret = = .....)
#asahi-dev · 2022-03-30 11:16
YichaoYu[m]true, but it's unfortunate that the default `perf stat` is a bit useless, and also instructions count should at least work across cores...
#asahi-dev · 2022-03-30 11:10
YichaoYu[m](and re exclude_guest, it's just that almost none of the simple example code I've found mentioned that, which is kinda fair since it's new in 3.2. it's not until I straced perf that I gave it a try....)
#asahi-dev · 2022-03-30 11:08
YichaoYu[m]what does it take for teaching the kernel how to count instructions and cycles across cores?
#asahi-dev · 2022-03-30 11:08
YichaoYu[m]and for specifying the event, instead of using PERF_TYPE_RAW or PERF_TYPE_HARDWARE, I should use the /sys/bus/event_source/devices/apple_{firestorm,icestorm}_pmu/type instead?
#asahi-dev · 2022-03-30 11:06
YichaoYu[m]k
#asahi-dev · 2022-03-30 11:05
YichaoYu[m]I mean shouldn't the default be something like I don't care and so it should work?
#asahi-dev · 2022-03-30 10:57
YichaoYu[m]and I had assumed that if I'm not running a vm anywhere, not specifying this option shouldn't make a difference?
#asahi-dev · 2022-03-30 10:56
YichaoYu[m]maz: the manpage for perf_event_open says that exclude_guest is x86 only
#asahi-dev · 2022-03-30 02:38
YichaoYu[m]also somehow I must set `exclude_guest` or perf_event_open will return not supported
#asahi-dev · 2022-03-30 02:36
YichaoYu[m](and attempting to use the raw counter also seems to turn up all 0 on the P core)
#asahi-dev · 2022-03-30 02:36
YichaoYu[m]using numactl to pin the process to the P core cause it to not count anythng for both the cycles and instructions
#asahi-dev · 2022-03-30 02:35
YichaoYu[m]is it expected that the counter only work on the E core?
#asahi-dev · 2022-03-30 02:35
YichaoYu[m]playing with the perf counter on a 13" air.