Skip to content

Commit f2f63f7

Browse files
committed
KVM: x86/pmu: Stop calling kvm_pmu_reset() at RESET (it's redundant)
Drop kvm_vcpu_reset()'s call to kvm_pmu_reset(), the call is performed only for RESET, which is really just the same thing as vCPU creation, and kvm_arch_vcpu_create() *just* called kvm_pmu_init(), i.e. there can't possibly be any work to do. Unlike Intel, AMD's amd_pmu_refresh() does fill all_valid_pmc_idx even if guest CPUID is empty, but everything that is at all dynamic is guaranteed to be '0'/NULL, e.g. it should be impossible for KVM to have already created a perf event. Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Link: https://lore.kernel.org/r/20231103230541.352265-4-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 1647b52 commit f2f63f7

File tree

3 files changed

+1
-3
lines changed

3 files changed

+1
-3
lines changed

arch/x86/kvm/pmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
657657
return 0;
658658
}
659659

660-
void kvm_pmu_reset(struct kvm_vcpu *vcpu)
660+
static void kvm_pmu_reset(struct kvm_vcpu *vcpu)
661661
{
662662
struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
663663
struct kvm_pmc *pmc;

arch/x86/kvm/pmu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ bool kvm_pmu_is_valid_msr(struct kvm_vcpu *vcpu, u32 msr);
243243
int kvm_pmu_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info);
244244
int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info);
245245
void kvm_pmu_refresh(struct kvm_vcpu *vcpu);
246-
void kvm_pmu_reset(struct kvm_vcpu *vcpu);
247246
void kvm_pmu_init(struct kvm_vcpu *vcpu);
248247
void kvm_pmu_cleanup(struct kvm_vcpu *vcpu);
249248
void kvm_pmu_destroy(struct kvm_vcpu *vcpu);

arch/x86/kvm/x86.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12221,7 +12221,6 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
1222112221
}
1222212222

1222312223
if (!init_event) {
12224-
kvm_pmu_reset(vcpu);
1222512224
vcpu->arch.smbase = 0x30000;
1222612225

1222712226
vcpu->arch.msr_misc_features_enables = 0;

0 commit comments

Comments
 (0)