This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 7f8ef3c9d73092f84bad916e8d1739a5cea9c3e0
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Nov 17 14:03:18 2026 +0100

    arch/x86_64/intel64: Use the TSC for perf events only with a TSC timer.
    
    intel64_perf.c counts the TSC and converts with g_x86_64_timer_freq.
    Only the TSC DEADLINE and APIC timers set this frequency.  With the HPET
    timer it is 0: perf_getfreq() returns 0 and up_perf_convert() divides by
    0.  CONFIG_ARCH_PERF_EVENTS is on by default with SCHED_IRQMONITOR and
    SCHED_CRITMONITOR, so qemu-intel64:citest_smp (HPET) has it.
    
    Select ARCH_HAVE_PERF_EVENTS from ARCH_INTEL64_HAVE_TSC, not from
    ARCH_X86_64.  With the HPET timer, drivers/timers/arch_alarm.c then gives
    up_perf_*() from the HPET counter and its frequency.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 arch/Kconfig                    | 1 -
 arch/x86_64/src/intel64/Kconfig | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 616436bab92..f993b438ba5 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -174,7 +174,6 @@ config ARCH_X86_64
        select ARCH_HAVE_BACKTRACE
        select ARCH_HAVE_VFORK
        select ARCH_HAVE_SETJMP
-       select ARCH_HAVE_PERF_EVENTS
        select ARCH_HAVE_POWEROFF
        select ARCH_HAVE_SYSCALL if LIB_SYSCALL
        ---help---
diff --git a/arch/x86_64/src/intel64/Kconfig b/arch/x86_64/src/intel64/Kconfig
index e9fc38ae3d7..de7fa1425bc 100644
--- a/arch/x86_64/src/intel64/Kconfig
+++ b/arch/x86_64/src/intel64/Kconfig
@@ -29,6 +29,7 @@ comment "intel64 Configuration Options"
 
 config ARCH_INTEL64_HAVE_TSC
        bool
+       select ARCH_HAVE_PERF_EVENTS
 
 config ARCH_INTEL64_HAS_TSC_ADJUST
        bool "MSR_IA32_TSC_ADJUST support"

Reply via email to