// SPDX-License-Identifier: GPL-2.0-only /* * Test for KVM_X86_DISABLE_EXITS_APERFMPERF * * Copyright (C) 2025, Google LLC. * * Test the ability to disable VM-exits for rdmsr of IA32_APERF and * IA32_MPERF. When these VM-exits are disabled, reads of these MSRs * return the host's values. * * Note: Requires read access to /dev/cpu/<lpu>/msr to read host MSRs.
*/
/* * Enable MSR bitmaps (the bitmap itself is allocated, zeroed, and set * in the VMCS by prepare_vmcs()), as MSR exiting mandatory on Intel.
*/
vmwrite(CPU_BASED_VM_EXEC_CONTROL,
vmreadz(CPU_BASED_VM_EXEC_CONTROL) | CPU_BASED_USE_MSR_BITMAPS);
/* Sanity check that APERF/MPERF are unsupported by default. */
vm = vm_create_with_one_vcpu(&vcpu, guest_no_aperfmperf);
vcpu_run(vcpu);
TEST_ASSERT_EQ(get_ucall(vcpu, NULL), UCALL_DONE);
kvm_vm_free(vm);
cpu = pin_self_to_any_cpu();
msr_fd = open_dev_msr(cpu);
/* * This test requires a non-standard VM initialization, because * KVM_ENABLE_CAP cannot be used on a VM file descriptor after * a VCPU has been created.
*/
vm = vm_create(1);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.