[PATCH v10 15/33] KVM: arm64: Construct mdcr_el2 in a local variable in kvm_arm_setup_mdcr_el2()
Colton Lewis
coltonlewis at google.com
Thu Dec 3 11:13:00 PST 2026
Oliver Upton <oupton at kernel.org> writes:
> On Thu, Nov 19, 2026 at 06:51:57PM +0000, Colton Lewis wrote:
>> Construct the new MDCR_EL2 value in a local variable before writing it
>> once to vcpu->arch.mdcr_el2. This avoids exposing intermediate states in
>> vcpu->arch.mdcr_el2 to interrupt or NMI handlers that may inspect it,
>> and simplifies upcoming Partitioned PMU modifications to MDCR_EL2.
>
> Is this actually necessary? The number of PMCs is fixed for the lifetime
> of the VM.
It's not necessary. Sashiko suggested it initially but it's not needed
since patch 16 changed to local_daif_save() anyway.
More information about the linux-arm-kernel
mailing list