Page MenuHomeFreeBSD

arm: Add a userspace physical timer check
ClosedPublic

Authored by andrew on Aug 23 2023, 2:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 1, 12:31 PM
Unknown Object (File)
Dec 23 2023, 3:06 AM
Unknown Object (File)
Dec 20 2023, 12:49 AM
Unknown Object (File)
Sep 30 2023, 7:19 PM
Unknown Object (File)
Sep 21 2023, 10:27 PM
Unknown Object (File)
Sep 6 2023, 12:13 AM
Unknown Object (File)
Sep 1 2023, 10:07 AM
Unknown Object (File)
Aug 23 2023, 2:16 PM
Subscribers

Details

Summary

We currently use the same Arm generic time in both userspace and the
kernel. As we always enable userspace access to the virtual timer we
can tell userspace to use it.

Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

andrew created this revision.
This revision is now accepted and ready to land.Aug 23 2023, 2:27 PM
This revision was automatically updated to reflect the committed changes.

I'm afraid that using virtual time outside the hypervisor environment is somewhat problematic, or creates a new (not always fulfilled) dependency on firmware. The virtual timer uses the value stored in CNTVOFF as an offset to generate the timer value. CNTVOFF is stored in a bank with an undefined reset value, so it *MUST* be initialized, otherwise we can end up with a situation where each core will have a different, non-zero value - so each core will have a different time. So the actual code expects someone (firmware, hypervisor) to initialize CNTVOFF on all cores - which is not always true (or better said, it is uncommon in the ARMv7 world and guaranteed in ARM64 ).

Another problem is that CNTVOFF is only accessible from hypervisor mode - it cannot be expected to always be accessible from the kernel. So I think this change does no good and just creates problems.