Page MenuHomeFreeBSD

vlapic: Schedule callouts on the local CPU
ClosedPublic

Authored by markj on Oct 19 2021, 3:34 PM.
Tags
None
Referenced Files
F81948071: D32559.id.diff
Tue, Apr 23, 3:11 PM
Unknown Object (File)
Wed, Apr 17, 1:42 AM
Unknown Object (File)
Sun, Apr 14, 12:08 AM
Unknown Object (File)
Thu, Apr 11, 9:33 AM
Unknown Object (File)
Fri, Apr 5, 11:08 AM
Unknown Object (File)
Sat, Mar 30, 5:23 PM
Unknown Object (File)
Thu, Mar 28, 6:15 PM
Unknown Object (File)
Thu, Mar 28, 8:27 AM
Subscribers

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.