HomeFreeBSD

kvmclock: Fix initialization when EARLY_AP_STARTUP is not defined

Description

kvmclock: Fix initialization when EARLY_AP_STARTUP is not defined

To attach to the hypervisor, kvmclock needs to write a per-CPU MSR.
When EARLY_AP_STARTUP is not defined, device attach happens too early:
APs are not yet spun up, so smp_rendezvous only runs the callback on the
local CPU. As a result, the timecounter only gets initialized on the
BSP, and then timekeeping is broken on SMP systems.

Implement handling for !EARLY_AP_STARTUP kernels: keep track of the CPU
on which device attach ran, and then use a SI_SUB_SMP SYSINIT to
register the rest of the CPUs with the hypervisor.

Reported by: Shrikanth R Kamath <kshrikanth@juniper.net>
Reviewed by: kib, jhb (earlier versions)
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37705

(cherry picked from commit 568f552b0410f4f72db9ce710f7803acca23f79f)

Details

Provenance
markjAuthored on Jan 13 2023, 3:01 PM
Reviewer
kib
Differential Revision
D37705: kvmclock: Fix initialization when EARLY_AP_STARTUP is not defined
Parents
rG668a32ab231d: netpfil tests: improve pfsync_defer.py
Branches
Unknown
Tags
Unknown