HomeFreeBSD

x86: x86_msr_op(): MSR_OP_LOCAL: Disable interrupts on atomic ops

Description

x86: x86_msr_op(): MSR_OP_LOCAL: Disable interrupts on atomic ops

On MSR_OP_LOCAL and non-naturally-atomic operations (MSR_OP_ANDNOT and
MSR_OP_OR), there is no guarantee that we are not interrupted between
reading and writing the MSR, and that interruption could actually
perform some operation on that MSR, which would be lost.

Prevent that problem by temporarily disabling interrupts around MSR
manipulation.

Reviewed by: kib
Discussed with: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54996

Details

Provenance
olceAuthored on Jan 23 2026, 8:52 PM
Reviewer
kib
Differential Revision
D54996: x86: x86_msr_op(): Add comments, guarantee atomicity
Parents
rGa1a8bcdfde2e: x86: x86_msr_op(): Simplify assertions
Branches
Unknown
Tags
Unknown