]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Update vPMCs when retiring branch instructions
authorEric Hankland <ehankland@google.com>
Tue, 30 Nov 2021 07:42:21 +0000 (15:42 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Jan 2022 15:44:43 +0000 (10:44 -0500)
commit145f5688167b29c181fad8133a3e6c4d43d82495
tree02ade9fea7be0648987ab9070a66bfe7276d7a89
parent91d2f9f5e6606aa12fc376060cf6be28de3f8976
KVM: x86: Update vPMCs when retiring branch instructions

When KVM retires a guest branch instruction through emulation,
increment any vPMCs that are configured to monitor "branch
instructions retired," and update the sample period of those counters
so that they will overflow at the right time.

Signed-off-by: Eric Hankland <ehankland@google.com>
[jmattson:
  - Split the code to increment "branch instructions retired" into a
    separate commit.
  - Moved/consolidated the calls to kvm_pmu_trigger_event() in the
    emulation of VMLAUNCH/VMRESUME to accommodate the evolution of
    that code.
]
Fixes: 766ce42c8a26 ("KVM: Expose a version 2 architectural PMU to a guests")
Signed-off-by: Jim Mattson <jmattson@google.com>
Message-Id: <20211130074221.93635-7-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c
arch/x86/kvm/kvm_emulate.h
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/x86.c