Skip to contentSkip to conversation

KVM: LoongArch: selftests: MAINTAINERS coverage and a VM leak

PATCH In review Gokul K 2 participants 4 messages Nov 23 – Nov 24

Subsystems (3)
lore
Share & tools
lore

Gokul K

author
#0 lore raw

cover KVM: LoongArch: selftests: MAINTAINERS coverage and a VM leak

Two small fixes to the LoongArch KVM selftests. Patch 2 frees the VM on the PMU test's skip path. Patch 1 came out of routing it:
get_maintainer.pl did not name the LoongArch KVM maintainers for tools/testing/selftests/kvm/loongarch/, because the MAINTAINERS entry does not cover that directory, so this series would otherwise have gone to Paolo, Sean and Shuah only.

Based on loongarch-kvm in linux-loongson.git.

Patch 2's hunk sits next to the one in "KVM: selftests: Convert comma to semicolon" [1], which is not applied yet. They do not overlap and apply in either order.

Compile-tested only. Patch 2 builds: tools/testing/selftests/kvm/loongarch/ pmu_test links for loongarch64 with a GCC 15.2.1 cross compiler, using glibc from Debian's loong64 port as the sysroot. The binary was not run. Patch 2 changes the PMU-not-enabled skip path, which only runs on a LoongArch host whose VM config leaves the PMU off.

[1] https://lore.kernel.org/all/[email protected]/

Gokul K (2):
MAINTAINERS: Add the LoongArch KVM selftests directory
KVM: LoongArch: selftests: Free the VM when the PMU test skips

 MAINTAINERS                                      | 1 +
 tools/testing/selftests/kvm/loongarch/pmu_test.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.54.0
author
#1 lore raw

PATCH 1/2 MAINTAINERS: Add the LoongArch KVM selftests directory

The KVM/LoongArch entry covers tools/testing/selftests/kvm/*/loongarch/ and lib/loongarch/, but not tools/testing/selftests/kvm/loongarch/, where the tests themselves live. The */loongarch/ pattern needs a directory between kvm/ and loongarch/, so it does not match it.

As a result get_maintainer.pl omits the LoongArch KVM maintainers and [email protected] for patches to those tests. arm64, riscv, s390 and x86 each list both forms.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index f53047aa8d3c..fed2245b979f 100644
@@ -14327,6 +14327,7 @@ F:	arch/loongarch/include/uapi/asm/kvm*
 F:	arch/loongarch/kvm/
 F:	tools/testing/selftests/kvm/*/loongarch/
 F:	tools/testing/selftests/kvm/lib/loongarch/
+F:	tools/testing/selftests/kvm/loongarch/
 
 KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
 M:	Huacai Chen <[email protected]>
Signature · 1 line
2.54.0
#2 lore raw

Re: [PATCH 1/2] MAINTAINERS: Add the LoongArch KVM selftests directory

Quoted 19 lines · Gokul K

The KVM/LoongArch entry covers tools/testing/selftests/kvm/*/loongarch/ and lib/loongarch/, but not tools/testing/selftests/kvm/loongarch/, where the tests themselves live. The */loongarch/ pattern needs a directory between kvm/ and loongarch/, so it does not match it.

As a result get_maintainer.pl omits the LoongArch KVM maintainers and [email protected] for patches to those tests. arm64, riscv, s390 and x86 each list both forms.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index f53047aa8d3c..fed2245b979f 100644

MAINTAINERS F: arch/loongarch/include/uapi/asm/kvm* · line 14329

Quoted 3 lines
MAINTAINERS +0 -0
@@ -14327,6 +14327,7 @@ F:	arch/loongarch/include/uapi/asm/kvm*
 F:	arch/loongarch/kvm/
 F:	tools/testing/selftests/kvm/*/loongarch/
 F:	tools/testing/selftests/kvm/lib/loongarch/

This line is redundant and can be removed.

Quoted 4 lines
MAINTAINERS +1 -0
+F:	tools/testing/selftests/kvm/loongarch/
 
 KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
 M:	Huacai Chen <[email protected]>
author
#3 lore raw

PATCH 2/2 KVM: LoongArch: selftests: Free the VM when the PMU test skips

In reply to Gokul K

main() creates the VM before asking whether it has the PMU feature, and when it does not, returns KSFT_SKIP directly. That skips the done: label through which every other exit frees the VM. Set ret and jump there instead.

Fixes 11c840192768 ("KVM: LoongArch: selftests: Add basic PMU event counting test")
---
 tools/testing/selftests/kvm/loongarch/pmu_test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/kvm/loongarch/pmu_test.c +2 -1
index ec3fefb9ea97..c9dd3cf5de06 100644
@@ -176,7 +176,8 @@ int main(int argc, char *argv[])
 		pr_info("PMU is enabled in VM\n");
 	} else {
 		print_skip("PMU not enabled by VM config\n");
-		return KSFT_SKIP;
+		ret = KSFT_SKIP;
+		goto done;
 	}
 
 	while (1) {
Signature · 1 line
2.54.0