casaroli opened a new pull request, #21964:
URL: https://github.com/apache/nuttx/pull/21964

   ## Summary
   
   On x86_64 (intel64), the APIC timer (`CONFIG_ARCH_INTEL64_TSC`) with 
`CONFIG_SCHED_TICKLESS` does not build: `intel64_tsc_oneshot.c:64: error: 
'const struct oneshot_operations_s' has no member named 'start_absolute'`. The 
tickless driver needs `ONESHOT`, `ONESHOT_COUNT` and `ALARM_ARCH`, and only the 
TSC DEADLINE and HPET timers select them. To select them for the APIC timer is 
not a fix: the driver programs `MSR_IA32_TSC_DEADLINE`, and the CPU ignores 
writes to this MSR when the APIC timer is not in TSC-deadline mode (Intel SDM 
Vol. 3A, "TSC-Deadline Mode"), so no timer interrupt comes.
   
   `ARCH_INTEL64` selects `ARCH_HAVE_TICKLESS` for all three timers. The two 
timers with a tickless driver select `ALARM_ARCH`, which selects 
`ARCH_HAVE_TICKLESS` already. This PR removes the select from `ARCH_INTEL64`, 
so `CONFIG_SCHED_TICKLESS` is not available with the APIC timer. The help text 
of `ARCH_INTEL64_TSC` and the clock source section of 
`Documentation/platforms/x86_64/intel64/index.rst` say it.
   
   A `depends on !SCHED_TICKLESS` on `ARCH_INTEL64_TSC` does not work: kconfig 
reports a dependency loop (`SCHED_TICKLESS` -> `ARCH_HAVE_TICKLESS` <- 
`ALARM_ARCH` <- `ARCH_INTEL64_TSC_DEADLINE` -> the timer choice -> 
`ARCH_INTEL64_TSC`). The same loop stops `select ALARM_ARCH if SCHED_TICKLESS` 
on `ARCH_INTEL64_TSC`.
   
   ## Impact
   
   x86_64 intel64 only. With the TSC DEADLINE timer or the HPET, nothing 
changes: `ALARM_ARCH` still gives `ARCH_HAVE_TICKLESS`. With the APIC timer, 
`CONFIG_SCHED_TICKLESS` is not available; before, that configuration did not 
build. All qemu-intel64 defconfigs use the TSC DEADLINE timer or the HPET, and 
`make savedefconfig` gives the same defconfig for each of them. No API change, 
no build file change.
   
   ## Testing
   
   QEMU 10.2.2 under KVM, GCC 12.3 in the NuttX CI image, make, 
`qemu-intel64:nsh`. master: TSC deadline and HPET with `SCHED_TICKLESS` build 
and `sleep 1` works; APIC timer with `SCHED_TICKLESS` fails to build 
(`intel64_tsc_oneshot.c:64`). This PR: the APIC timer without `SCHED_TICKLESS` 
(`USEC_PER_TICK=10000`) builds, boots and `sleep 1` / `sleep 5` return; HPET 
without tickless the same on both. All 17 qemu-intel64 defconfigs build with 
this PR and the other three intel64 fixes applied, and `make savedefconfig` 
gives the same defconfig for each.
   
   This PR with the APIC timer and `SCHED_TICKLESS` asked for (`kconfig-tweak 
--enable SCHED_TICKLESS`, then `make olddefconfig`): `SCHED_TICKLESS` is not 
set; `nsh` and `knsh_romfs` build, and `nsh` boots and `sleep 1` and `sleep 5` 
return. With the TSC deadline timer and with the HPET, `SCHED_TICKLESS` stays 
on, the build and `sleep` work as on master. The runtime claim about 
`MSR_IA32_TSC_DEADLINE` comes from the Intel SDM: a master build with the 
tickless driver for the APIC timer was not possible (`ONESHOT_COUNT` has no 
prompt and only the two other timers select it).
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
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]

Reply via email to