Page MenuHomeFreeBSD

cpu_auxmsr: assert caller is preventing CPU migration
ClosedPublic

Authored by adam_fenn.io on Aug 23 2020, 9:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 23, 5:24 AM
Unknown Object (File)
Wed, Dec 18, 5:05 AM
Unknown Object (File)
Wed, Dec 4, 5:45 AM
Unknown Object (File)
Nov 26 2024, 12:54 PM
Unknown Object (File)
Nov 26 2024, 12:54 PM
Unknown Object (File)
Nov 26 2024, 12:52 PM
Unknown Object (File)
Nov 26 2024, 12:52 PM
Unknown Object (File)
Nov 26 2024, 12:52 PM
Subscribers

Details

Test Plan

Peformed the following sanity-checks:

  • i386
    • Confirmed assertion is not triggered during boot of a 4-CPU system (a bhyve VM).
  • amd64
    • Confirmed assertion is not triggered during boot of a 4-CPU system (a VMWare VM).
    • Confirmed assertion is not triggered in the VM entry/exit code path (used an invocation of dtrace -f fbt:kernel:cpu_auxmsr to confirm this routine was, as expected, being called while a bhyve VM was running).

The resume codepaths were not sanity-checked, but, by inspection, these appear equally clear as contexts with interrupts disabled as the cases that were sanity-checked.

Diff Detail

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

Event Timeline

adam_fenn.io held this revision as a draft.
sys/amd64/amd64/initcpu.c
224 ↗(On Diff #76121)

I suggest to trim this sentence to just

Caller should prevent CPU migration.
235 ↗(On Diff #76121)

I am not sure the comment is useful. If somebody is using this in context that only prevents scheduling, e.g. in critical section, he should be qualified enough to change assert to accommodate new situation. Comment above the function gives enough clue, if needed.

237 ↗(On Diff #76121)

Indent of contig lines should be +4 spaces, no alignment to opening braces. Also I believe the message could be made much shorter without loosing the information.

adam_fenn.io marked an inline comment as done.

Incorporate @kib's review feedback.

sys/amd64/amd64/initcpu.c
229 ↗(On Diff #76127)

I suggest to write the message Context switch possible instead of interrupts enabled which just repeats the assert code. It is more to the point IMO.

230 ↗(On Diff #76127)

Remove blank line.

This revision is now accepted and ready to land.Aug 23 2020, 11:44 PM

Thanks kib@, I can commit this.