Re: [PATCH 3/6] KVM: x86: selftests: Set up AMD VM in pmu_counters_test

2024-09-02 Thread Colton Lewis
Sean Christopherson writes: On Wed, Aug 28, 2024, Mingwei Zhang wrote: > >> +static void test_core_counters(void) > >> +{ > >> +uint8_t nr_counters = nr_core_counters(); > >> +bool core_ext = kvm_cpu_has(X86_FEATURE_PERF_CTR_EXT_CORE); > >> +bool perf_mon_v2 = kvm_cpu_has(X86_FEATU

Re: [PATCH 3/6] KVM: x86: selftests: Set up AMD VM in pmu_counters_test

2024-08-28 Thread Colton Lewis
Hi Mingwei Mingwei Zhang writes: On Tue, Aug 13, 2024, Colton Lewis wrote: Branch in main() depending on if the CPU is Intel or AMD. They are subject to vastly different requirements because the AMD PMU lacks many properties defined by the Intel PMU including the entire CPUID 0xa function

Re: [PATCH 2/6] KVM: x86: selftests: Define AMD PMU CPUID leaves

2024-08-28 Thread Colton Lewis
Hi Mingwei, thanks for reviewing! Mingwei Zhang writes: On Tue, Aug 13, 2024, Colton Lewis wrote: This defined the CPUID calls to determine what extensions and properties are available. AMD reference manual names listed below. * PerfCtrExtCore (six core counters instead of four

Re: [PATCH 1/6] KVM: x86: selftests: Fix typos in macro variable use

2024-08-28 Thread Colton Lewis
Mingwei Zhang writes: On Tue, Aug 13, 2024, Colton Lewis wrote: Without the leading underscore, these variables are referencing a variable in the calling scope. It only worked before by accident because all calling scopes had a variable with the right name. Signed-off-by: Colton Lewis

Re: [PATCH 0/6] Extend pmu_counters_test to AMD CPUs

2024-08-14 Thread Colton Lewis
Sean Christopherson writes: On Tue, Aug 13, 2024, Colton Lewis wrote: Sean Christopherson writes: > On Tue, Aug 13, 2024, Colton Lewis wrote: > > (I was positive I had sent this already, but I couldn't find it on the > > mailing list to reply to and ask for re

Re: [PATCH 0/6] Extend pmu_counters_test to AMD CPUs

2024-08-13 Thread Colton Lewis
Sean Christopherson writes: On Tue, Aug 13, 2024, Colton Lewis wrote: (I was positive I had sent this already, but I couldn't find it on the mailing list to reply to and ask for reviews.) You did[*], it's sitting in my todo folder. Two things. 1. Err on the side of ca

[PATCH 6/6] KVM: x86: selftests: Test PerfMonV2

2024-08-13 Thread Colton Lewis
flags an overflow by the associated counter. Signed-off-by: Colton Lewis --- .../selftests/kvm/x86_64/pmu_counters_test.c | 53 +++ 1 file changed, 53 insertions(+) diff --git a/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c b/tools/testing/selftests/kvm/x86_64

[PATCH 5/6] KVM: x86: selftests: Test core events

2024-08-13 Thread Colton Lewis
loop instruction being counted differently. Presumably, when the counter reaches 0 and execution continues to the next instruction, AMD counts this as a branch and Intel doesn't. Signed-off-by: Colton Lewis --- .../selftests/kvm/x86_64/pmu_counters_test.c | 87 --- 1 file c

[PATCH 4/6] KVM: x86: selftests: Test read/write core counters

2024-08-13 Thread Colton Lewis
Run a basic test to ensure we can write an arbitrary value to the core counters and read it back. Signed-off-by: Colton Lewis --- .../selftests/kvm/x86_64/pmu_counters_test.c | 41 +++ 1 file changed, 41 insertions(+) diff --git a/tools/testing/selftests/kvm/x86_64

[PATCH 3/6] KVM: x86: selftests: Set up AMD VM in pmu_counters_test

2024-08-13 Thread Colton Lewis
notion of PMU versions as Intel does. Every feature is a separate flag and they aren't the same features as Intel. Set up a VM for testing core AMD counters and ensure proper CPUID features are set. Signed-off-by: Colton Lewis --- .../selftests/kvm/x86_64/pmu_counters_test.c

[PATCH 2/6] KVM: x86: selftests: Define AMD PMU CPUID leaves

2024-08-13 Thread Colton Lewis
: Colton Lewis --- tools/testing/selftests/kvm/include/x86_64/processor.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h index a0c1440017bb..9d87b5f8974f 100644 --- a/tools

[PATCH 1/6] KVM: x86: selftests: Fix typos in macro variable use

2024-08-13 Thread Colton Lewis
Without the leading underscore, these variables are referencing a variable in the calling scope. It only worked before by accident because all calling scopes had a variable with the right name. Signed-off-by: Colton Lewis --- tools/testing/selftests/kvm/x86_64/pmu_counters_test.c | 6 +++--- 1

[PATCH 0/6] Extend pmu_counters_test to AMD CPUs

2024-08-13 Thread Colton Lewis
ently and I am not intruding by making my own submission. [1] https://lore.kernel.org/kvm/20231121115457.76269-1-cloudli...@tencent.com/ Colton Lewis (6): KVM: x86: selftests: Fix typos in macro variable use KVM: x86: selftests: Define AMD PMU CPUID leaves KVM: x86: selftests: Set up AMD

[PATCH 6/6] KVM: x86: selftests: Test PerfMonV2

2024-08-02 Thread Colton Lewis
flags an overflow by the associated counter. Signed-off-by: Colton Lewis --- .../selftests/kvm/x86_64/pmu_counters_test.c | 53 +++ 1 file changed, 53 insertions(+) diff --git a/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c b/tools/testing/selftests/kvm/x86_64

[PATCH 5/6] KVM: x86: selftests: Test core events

2024-08-02 Thread Colton Lewis
loop instruction being counted differently. Presumably, when the counter reaches 0 and execution continues to the next instruction, AMD counts this as a branch and Intel doesn't. Signed-off-by: Colton Lewis --- .../selftests/kvm/x86_64/pmu_counters_test.c | 87 --- 1 file c

[PATCH 4/6] KVM: x86: selftests: Test read/write core counters

2024-08-02 Thread Colton Lewis
Run a basic test to ensure we can write an arbitrary value to the core counters and read it back. Signed-off-by: Colton Lewis --- .../selftests/kvm/x86_64/pmu_counters_test.c | 41 +++ 1 file changed, 41 insertions(+) diff --git a/tools/testing/selftests/kvm/x86_64

[PATCH 3/6] KVM: x86: selftests: Set up AMD VM in pmu_counters_test

2024-08-02 Thread Colton Lewis
notion of PMU versions as Intel does. Every feature is a separate flag and they aren't the same features as Intel. Set up a VM for testing core AMD counters and ensure proper CPUID features are set. Signed-off-by: Colton Lewis --- .../selftests/kvm/x86_64/pmu_counters_test.c

[PATCH 2/6] KVM: x86: selftests: Define AMD PMU CPUID leaves

2024-08-02 Thread Colton Lewis
: Colton Lewis --- tools/testing/selftests/kvm/include/x86_64/processor.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h index a0c1440017bb..9d87b5f8974f 100644 --- a/tools

[PATCH 1/6] KVM: x86: selftests: Fix typos in macro variable use

2024-08-02 Thread Colton Lewis
Without the leading underscore, these variables are referencing a variable in the calling scope. It only worked before by accident because all calling scopes had a variable with the right name. Signed-off-by: Colton Lewis --- tools/testing/selftests/kvm/x86_64/pmu_counters_test.c | 6 +++--- 1

[PATCH 0/7] Extend pmu_counters_test to AMD CPUs

2024-08-02 Thread Colton Lewis
...@tencent.com/ Colton Lewis (6): KVM: x86: selftests: Fix typos in macro variable use KVM: x86: selftests: Define AMD PMU CPUID leaves KVM: x86: selftests: Set up AMD VM in pmu_counters_test KVM: x86: selftests: Test read/write core counters KVM: x86: selftests: Test core events KVM: x86