On 03.03.2026 15:56, Bertrand Marquis wrote:
>> On 26 Feb 2026, at 12:51, Oleksii Kurochko <[email protected]> 
>> wrote:
>>
>> ticks_to_ns() and ns_to_ticks() are not architecture-specific, so provide a
>> common implementation that is more resilient to overflow than the historical
>> Arm version. This is not a practical issue for Arm, as the latest ARM ARM
>> that timer frequency should be fixed at 1 GHz and older platforms used much
>> lower rates, which is shy of 32-bit overflow. As the helpers are declared
>> as static inline, they should not affect x86, which does not use them.
>>
>> On Arm, these helpers were historically implemented as out-of-line functions
>> because the counter frequency was originally defined as static and 
>> unavailable
>> to headers [1]. Later changes [2] removed this restriction, but the helpers
>> remained unchanged. Now they can be implemented as static inline without any
>> issues.
>>
>> Centralising the helpers avoids duplication and removes subtle differences
>> between architectures while keeping the implementation simple.
>>
>> Drop redundant <asm/time.h> includes where <xen/time.h> already pulls it in.
>>
>> No functional change is intended.
>>
>> [1] ddee56dc2994 arm: driver for the generic timer for ARMv7
>> [2] 096578b4e489 xen: move XEN_SYSCTL_physinfo, XEN_SYSCTL_numainfo and
>>                      XEN_SYSCTL_topologyinfo to common code
>>
>> Suggested-by: Jan Beulich <[email protected]>
>> Signed-off-by: Oleksii Kurochko <[email protected]>
>> Reviewed-by: Jan Beulich <[email protected]>
> 
> Computation is changing a bit from MS to S removing the 1000 factor on arm
> but i do not think this would have an impact so:

Well, as the description says, this removal eliminates a theoretical risk of
overflow. So there is some "impact".

Jan

> Acked-by: Bertrand Marquis <[email protected]>
> 
> Cheers
> Bertrand

Reply via email to