Page MenuHomeFreeBSD

Add a custom implementation of cpu_lock_delay() for x86.
ClosedPublic

Authored by jhb on Nov 5 2018, 6:13 PM.
Tags
None
Referenced Files
F133130775: D17851.id50046.diff
Thu, Oct 23, 5:30 AM
F133130772: D17851.id.diff
Thu, Oct 23, 5:30 AM
F133130770: D17851.id50042.diff
Thu, Oct 23, 5:30 AM
F133089991: D17851.id50034.diff
Wed, Oct 22, 9:29 PM
Unknown Object (File)
Wed, Oct 22, 12:05 PM
Unknown Object (File)
Sat, Oct 18, 4:03 PM
Unknown Object (File)
Thu, Oct 16, 3:24 PM
Unknown Object (File)
Wed, Oct 1, 1:42 PM
Subscribers

Details

Summary

Avoid using DELAY() since it can try to use spin locks on CPUs without a
P-state invariant TSC. For cpu_lock_delay(), always use the TSC if it
exists (even if it is not P-state invariant) to delay for a microsecond.
If the TSC does not exist, read from I/O port 0x84 to delay instead.

PR: 228768

Test Plan
  • passed make tinderbox (aside from unrelated breakage in arm.GENERIC-NODEBUG)
  • booted in i386 and amd64 VMs
  • original PR reporter booted combined patch on amd64 machine

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib added inline comments.
sys/x86/x86/delay.c
125 ↗(On Diff #50034)

And there a comment why tsc_is_invariant check is omitted would be useful IMO.

This revision is now accepted and ready to land.Nov 5 2018, 9:21 PM
This revision now requires review to proceed.Nov 5 2018, 9:43 PM
jhb marked an inline comment as done.Nov 5 2018, 9:44 PM
This revision is now accepted and ready to land.Nov 5 2018, 9:59 PM
This revision was automatically updated to reflect the committed changes.