Page MenuHomeFreeBSD

rtc: fix inverted resolution check
ClosedPublic

Authored by royger on May 3 2016, 9:55 AM.
Tags
None
Referenced Files
F131702213: D6185.diff
Fri, Oct 10, 11:38 AM
Unknown Object (File)
Aug 8 2025, 12:36 PM
Unknown Object (File)
Jul 27 2025, 2:07 AM
Unknown Object (File)
Jul 26 2025, 11:33 PM
Unknown Object (File)
Jul 26 2025, 10:16 AM
Unknown Object (File)
Jul 11 2025, 8:26 PM
Unknown Object (File)
Jul 8 2025, 4:57 AM
Unknown Object (File)
Jul 6 2025, 10:20 AM
Subscribers

Details

Summary

The current code in clock_register checks if the newly added clock has a
resolution value higher than the current one in order to make it the
default, which is wrong. Clocks with a lower resolution value should be
better than ones with a higher resolution value, in fact with the current
code FreeBSD is always selecting the worse clock.

Sponsored by: Citrix Systems R&D

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 3548
Build 3588: arc lint + arc unit

Event Timeline

royger retitled this revision from to rtc: fix inverted resolution check.
royger updated this object.
royger edited the test plan for this revision. (Show Details)
royger added reviewers: jkim, lstewart, jhb, kib.
kib edited edge metadata.

Was it dormant because typical system is x86 with only one RTC clock ?

This revision is now accepted and ready to land.May 3 2016, 11:51 AM
jhb edited edge metadata.

It's also kind of "backwards" (like thread priorities) where a numerically lower value means "higher" precision (i.e. more precise). Given the text in the printf I think it's easy to get the expression wrong.

jkim edited edge metadata.
In D6185#131704, @kib wrote:

Was it dormant because typical system is x86 with only one RTC clock ?

AFAICT yes, most platforms only have one clock available, so this bug has never surfaced.

Thanks all for the review.

This revision was automatically updated to reflect the committed changes.