• Eric Hankland's avatar
    KVM: x86: Update vPMCs when retiring branch instructions · 018d70ff
    Eric Hankland authored
    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: default avatarEric 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: f5132b01 ("KVM: Expose a version 2 architectural PMU to a guests")
    Signed-off-by: default avatarJim Mattson <jmattson@google.com>
    Message-Id: <20211130074221.93635-7-likexu@tencent.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    018d70ff
nested.c 207 KB