This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 00d1fe5d903dc5a3398d4b5fd70a8f64678316fd Author: Marco Casaroli <[email protected]> AuthorDate: Tue Nov 3 21:43:17 2026 +0100 arch/arm/goldfish: Give up_perf_init() the 1 GHz rate of the QEMU PMU. goldfish_boot.c calls up_perf_init(0). arm_perf.c then uses the rate of the generic timer, but the goldfish emulator (QEMU) counts the PMU cycle counter (PMCCNTR) at a fixed 1 GHz. So perf_convert() and the CPU-time clocks of SCHED_CRITMONITOR run too fast. Give up_perf_init() 1 GHz. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- arch/arm/src/goldfish/goldfish_boot.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/goldfish/goldfish_boot.c b/arch/arm/src/goldfish/goldfish_boot.c index 7a7e38afc7e..b258197e142 100644 --- a/arch/arm/src/goldfish/goldfish_boot.c +++ b/arch/arm/src/goldfish/goldfish_boot.c @@ -46,6 +46,14 @@ #include <nuttx/syslog/syslog_rpmsg.h> +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* The emulator (QEMU) counts the PMU cycle counter at 1 GHz */ + +#define GOLDFISH_PMU_CYCLES_PER_SEC 1000000000 + /**************************************************************************** * Private Data ****************************************************************************/ @@ -71,7 +79,7 @@ void arm_boot(void) #ifdef CONFIG_ARCH_PERF_EVENTS /* Perf init */ - up_perf_init(0); + up_perf_init((void *)GOLDFISH_PMU_CYCLES_PER_SEC); #endif /* Set the page table for section */
