• Sean Christopherson's avatar
    perf/x86/core: Zero @lbr instead of returning -1 in x86_perf_get_lbr() stub · 0b9ca98b
    Sean Christopherson authored
    Drop the return value from x86_perf_get_lbr() and have the stub zero out
    the @lbr structure instead of returning -1 to indicate "no LBR support".
    KVM doesn't actually check the return value, and instead subtly relies on
    zeroing the number of LBRs in intel_pmu_init().
    
    Formalize "nr=0 means unsupported" so that KVM doesn't need to add a
    pointless check on the return value to fix KVM's benign bug.
    
    Note, the stub is necessary even though KVM x86 selects PERF_EVENTS and
    the caller exists only when CONFIG_KVM_INTEL=y.  Despite the name,
    KVM_INTEL doesn't strictly require CPU_SUP_INTEL, it can be built with
    any of INTEL || CENTAUR || ZHAOXIN CPUs.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20221006000314.73240-2-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    0b9ca98b
perf_event.h 17.1 KB