AsahiLinux / muvm

muvm - run programs from your system in a microVM
387 stars 22 forks source link

CPU p-core detection should use capacity, not freq #43

Open asahilina opened 4 months ago

asahilina commented 4 months ago

Right now the code uses cpufreq/cpuinfo_max_freq. The correct way to identify different core types is the cpu_capacity file (/sys/devices/system/cpu/cpu3/cpu_capacity). This should be 1024 for p-cores, though it's probably safer to keep the current logic of taking the max number as the p-cores.

teohhanhui commented 4 months ago

Oops. Didn't know about that. Thanks!

It doesn't seem like cpu_capacity is always defined, so I think we still need a fallback to cpuinfo_max_freq?

asahilina commented 4 months ago

I think cpu_capacity should always be defined for a system with properly configured big.LITTLE, but I guess maybe some platforms aren't always doing that? It might make sense to keep the cpuinfo_max_freq fallback then, yeah ^^