From: Gokul K <gokul02k@gmail.com>
To: Tianrui Zhao <zhaotianrui@loongson.cn>,
Bibo Mao <maobibo@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>,
kvm@vger.kernel.org, loongarch@lists.linux.dev,
linux-kselftest@vger.kernel.org
Cc: Sean Christopherson <seanjc@google.com>,
Song Gao <gaosong@loongson.cn>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] KVM: LoongArch: selftests: Free the VM when the PMU test skips
Date: Mon, 23 Nov 2026 15:37:01 +0530 [thread overview]
Message-ID: <20261123100701.1679376-3-gokul02k@gmail.com> (raw)
In-Reply-To: <20261123100701.1679376-1-gokul02k@gmail.com>
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")
Signed-off-by: Gokul K <gokul02k@gmail.com>
---
tools/testing/selftests/kvm/loongarch/pmu_test.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/loongarch/pmu_test.c b/tools/testing/selftests/kvm/loongarch/pmu_test.c
index ec3fefb9ea97..c9dd3cf5de06 100644
--- a/tools/testing/selftests/kvm/loongarch/pmu_test.c
+++ b/tools/testing/selftests/kvm/loongarch/pmu_test.c
@@ -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) {
--
2.54.0
prev parent reply other threads:[~2026-11-23 10:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 10:06 [PATCH 0/2] KVM: LoongArch: selftests: MAINTAINERS coverage and a VM leak Gokul K
2026-11-23 10:07 ` [PATCH 1/2] MAINTAINERS: Add the LoongArch KVM selftests directory Gokul K
2026-11-23 10:07 ` Gokul K [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123100701.1679376-3-gokul02k@gmail.com \
--to=gokul02k@gmail.com \
--cc=chenhuacai@kernel.org \
--cc=gaosong@loongson.cn \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=maobibo@loongson.cn \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=zhaotianrui@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®