Page MenuHomeFreeBSD

vlapic: Schedule callouts on the local CPU

Authored by markj on Oct 19 2021, 3:34 PM.
Referenced Files
Unknown Object (File)
Thu, Mar 23, 5:10 AM
Unknown Object (File)
Feb 15 2023, 5:28 PM
Unknown Object (File)
Dec 14 2022, 6:12 AM



The virtual LAPIC driver uses callouts to implement the LAPIC timer.
Callouts are armed using callout_reset_sbt(), which currently puts
everything on CPU 0. On systems running many small bhyve VMs this
results in a large amount of contention for CPU 0's callout lock.

I can't see a reason to schedule everything on CPU 0. While the callout
interface should perhaps be changed to schedule on the current CPU by
default, it's easy to change vlapic to avoid the problem. With this
diff I can see callouts getting scheduled across all CPUs in the system
in my workload, and callout lock contention is mostly gone.

Diff Detail

rS FreeBSD src repository - subversion
Lint Passed
No Test Coverage
Build Status
Buildable 42254
Build 39142: arc lint + arc unit

Event Timeline

markj requested review of this revision.Oct 19 2021, 3:34 PM
This revision is now accepted and ready to land.Oct 19 2021, 6:22 PM

This may have been leftover from some early soft-partitioning work where the host was running on CPU 0 (and low CPUs) with bhyve and a single-guest running on the remainder with halt-exits disabled.

This revision was automatically updated to reflect the committed changes.