Re: [PATCH v10 15/29] KVM: selftests: Add pmu.h and lib/pmu.c for common PMU assets

From: Sean Christopherson
Date: Wed Jan 10 2024 - 08:58:57 EST


On Wed, Jan 10, 2024, Andrew Jones wrote:
> On Tue, Jan 09, 2024 at 03:02:35PM -0800, Sean Christopherson wrote:
> > From: Jinrong Liang <cloudliang@xxxxxxxxxxx>
> >
> > Add a PMU library for x86 selftests to help eliminate open-coded event
> > encodings, and to reduce the amount of copy+paste between PMU selftests.
> >
> > Use the new common macro definitions in the existing PMU event filter test.
> >
> > Cc: Aaron Lewis <aaronlewis@xxxxxxxxxx>
> > Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> > Signed-off-by: Jinrong Liang <cloudliang@xxxxxxxxxxx>
> > Co-developed-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> > Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> > ---
> > tools/testing/selftests/kvm/Makefile | 1 +
> > tools/testing/selftests/kvm/include/pmu.h | 97 ++++++++++++
> > tools/testing/selftests/kvm/lib/pmu.c | 31 ++++
>
> Shouldn't these new files be
>
> tools/testing/selftests/kvm/include/x86_64/pmu.h
> tools/testing/selftests/kvm/lib/x86_64/pmu.c

/facepalm

I'm glad at least one of us is paying attention. If no one objects to not sending
yet another version, I'll squash the below when applying.

--
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index ab96fc80bfbd..ce58098d80fd 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -23,7 +23,6 @@ LIBKVM += lib/guest_modes.c
LIBKVM += lib/io.c
LIBKVM += lib/kvm_util.c
LIBKVM += lib/memstress.c
-LIBKVM += lib/pmu.c
LIBKVM += lib/guest_sprintf.c
LIBKVM += lib/rbtree.c
LIBKVM += lib/sparsebit.c
@@ -37,6 +36,7 @@ LIBKVM_x86_64 += lib/x86_64/apic.c
LIBKVM_x86_64 += lib/x86_64/handlers.S
LIBKVM_x86_64 += lib/x86_64/hyperv.c
LIBKVM_x86_64 += lib/x86_64/memstress.c
+LIBKVM_x86_64 += lib/x86_64/pmu.c
LIBKVM_x86_64 += lib/x86_64/processor.c
LIBKVM_x86_64 += lib/x86_64/svm.c
LIBKVM_x86_64 += lib/x86_64/ucall.c
diff --git a/tools/testing/selftests/kvm/include/pmu.h b/tools/testing/selftests/kvm/include/x86_64/pmu.h
similarity index 100%
rename from tools/testing/selftests/kvm/include/pmu.h
rename to tools/testing/selftests/kvm/include/x86_64/pmu.h
diff --git a/tools/testing/selftests/kvm/lib/pmu.c b/tools/testing/selftests/kvm/lib/x86_64/pmu.c
similarity index 100%
rename from tools/testing/selftests/kvm/lib/pmu.c
rename to tools/testing/selftests/kvm/lib/x86_64/pmu.c