Re: [PATCH v2 6/6] selftests: kvm/x86: Add test for KVM_SET_PMU_EVENT_FILTER

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim,

The patch set looks good to me.  A couple comments and questions
related just to this test are inline.

On Thu, Jan 13, 2022 at 5:21 PM Jim Mattson <jmattson@xxxxxxxxxx> wrote:

> + * Determining AMD support for a PMU event requires consulting the AMD
> + * PPR for the CPU or reference material derived therefrom.
> + */
> +static bool vcpu_supports_amd_zen_br_retired(void)
> +{
> +       struct kvm_cpuid_entry2 *entry;
> +       struct kvm_cpuid2 *cpuid;
> +
> +       cpuid = kvm_get_supported_cpuid();
> +       entry = kvm_get_supported_cpuid_index(1, 0);
> +       return entry &&
> +               ((x86_family(entry->eax) == 0x17 &&
> +                 (x86_model(entry->eax) == 1 ||
> +                  x86_model(entry->eax) == 0x31)) ||
> +                (x86_family(entry->eax) == 0x19 &&
> +                 x86_model(entry->eax) == 1));
> +}

The above function does not verify that the AMD host you are running
on supports PMU.  In particular, you might be running the KVM test
suite within a guest.  Is there a way to do that check here without
direct access to MSRs?  If not, maybe we need a KVM capability to
query this information.

> +       r = kvm_check_cap(KVM_CAP_PMU_EVENT_FILTER);
> +       if (!r) {
> +               print_skip("KVM_CAP_PMU_EVENT_FILTER not supported");
> +               exit(KSFT_SKIP);
> +       }

This capability is still supported even when PMU has been disabled by
Like Xu's new module parameter.  Should all the PMU related
capabilities be gated behind that module parameter?

Dave Dunn



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux