casaroli opened a new pull request, #21425: URL: https://github.com/apache/nuttx/pull/21425
## Summary QEMU counts the PMU cycle counter (PMCCNTR) at a fixed 1 GHz, with TCG and with HVF. The qemu boards give up_perf_init() a lower rate: qemu-armv8a gives 62.5 MHz, and qemu-armv7a/qemu-armv7r give 0, so arm_perf.c uses the generic timer rate (62.5 MHz). As a result, perf_convert() and the CPU-time clocks of SCHED_CRITMONITOR run 16 times too fast: a busy loop of 200 ms gives 3200 ms of CPU time. This PR gives up_perf_init() 1 GHz on arch/arm64/src/qemu and arch/arm/src/qemu (one commit each). ## Impact Only the qemu boards with ARCH_PERF_EVENTS (the default with SCHED_CRITMONITOR, SCHED_IRQMONITOR, RPMSG_PING and SEGGER_SYSVIEW). Perf times (critmon, irq monitor, sched notes, CPU-time clocks) are now correct. No API change. With KVM the counter is the cycle counter of the host, whose rate NuttX does not know. This PR does not change that case. No documentation change: Documentation/ gives no rate for these boards. ## Testing Test program perfclk.c: it runs a busy loop of 200 ms (CLOCK_MONOTONIC) and compares it with the change of CLOCK_THREAD_CPUTIME_ID and of the run time in /proc/self/critmon. Configs: SCHED_CRITMONITOR + ARCH_PERF_EVENTS. | config | accel | master (CPU time for 200 ms) | this PR | |---|---|---|---| | qemu-armv8a:nsh (flat) | HVF | 3200 ms | 200 ms | | qemu-armv8a:nsh (flat) | TCG | 3205 ms | 227 ms (busy 216 ms) | | qemu-armv8a:knsh (kernel) | HVF | 3535 ms (busy 220 ms) | 200 ms | | qemu-armv7a:nsh (flat) | TCG | 3247 ms | 202 ms | ostest exits with status 0 on qemu-armv8a:knsh and qemu-armv8a:nsh (HVF). Builds with -Werror: qemu-armv8a:knsh, qemu-armv7a:nsh, qemu-armv7a:knsh, qemu-armv7r:pnsh (protected). qemu-armv7r is build-tested only: the QEMU here has no cortex-r5f for the virt machine. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
