Page MenuHomeFreeBSD

vlapic: Schedule callouts on the local CPU
ClosedPublic

Authored by markj on Oct 19 2021, 3:34 PM.

Details

Summary

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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.