HomeFreeBSD

x86: Guard clock frequency against a divide by 0

Description

x86: Guard clock frequency against a divide by 0

We may be running in a Virtual Machine which may not fully support
hardware performance counters. If the MPERF counter somehow ends up
at zero, return an error and fail gracefully instead of panicking.
This patch is part of Google Cloud Engine (GCE) C4-LSSD turnup.

Sponsored by: Google
Tested by: NetApp (previous)
PR: 292808
MFC after: 3 days
Co-authored-by: Aymeric Wibo <obiwac@google.com>
Co-authored-by: Jim Mattson <jmattson@google.com>
Suggested by: jrtc27 (split out this part)
Reviewed by: imp, obiwac, olce
Differential Revision: https://reviews.freebsd.org/D56056

(cherry picked from commit c505fc1468849150f48484b225b6476d8316de57)

Details

Provenance
Matt Delco <delco@google.com>Authored on Mar 26 2026, 5:22 PM
ziaeeCommitted on Aug 6 2026, 10:25 PM
Reviewer
imp
Differential Revision
D56056: x86: Guard clock frequency against a divide by 0
Parents
rGa1479a37fcf8: dwcotg.4: Initial manual page
Branches
Unknown
Tags
Unknown