From: Paolo Bonzini <pbonzini@redhat.com>
To: Oliver Upton <oupton@google.com>,
kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu
Cc: Marc Zyngier <maz@kernel.org>, Peter Shier <pshier@google.com>
Subject: Re: [PATCH] selftests: KVM: Gracefully handle missing vCPU features
Date: Tue, 21 Sep 2021 20:00:02 +0200 [thread overview]
Message-ID: <bd8abbac-925b-ff1e-f494-8f1c21fe7bd1@redhat.com> (raw)
In-Reply-To: <20210818212940.1382549-1-oupton@google.com>
On 18/08/21 23:29, Oliver Upton wrote:
> An error of ENOENT for the KVM_ARM_VCPU_INIT ioctl indicates that one of
> the requested feature flags is not supported by the kernel/hardware.
> Detect the case when KVM doesn't support the requested features and skip
> the test rather than failing it.
>
> Cc: Andrew Jones <drjones@redhat.com>
> Signed-off-by: Oliver Upton <oupton@google.com>
> ---
> Applies to 5.14-rc6. Tested by running all selftests on an Ampere Mt.
> Jade system.
>
> .../testing/selftests/kvm/lib/aarch64/processor.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/lib/aarch64/processor.c b/tools/testing/selftests/kvm/lib/aarch64/processor.c
> index 632b74d6b3ca..b1064a0c5e62 100644
> --- a/tools/testing/selftests/kvm/lib/aarch64/processor.c
> +++ b/tools/testing/selftests/kvm/lib/aarch64/processor.c
> @@ -216,6 +216,7 @@ void aarch64_vcpu_setup(struct kvm_vm *vm, int vcpuid, struct kvm_vcpu_init *ini
> {
> struct kvm_vcpu_init default_init = { .target = -1, };
> uint64_t sctlr_el1, tcr_el1;
> + int ret;
>
> if (!init)
> init = &default_init;
> @@ -226,7 +227,19 @@ void aarch64_vcpu_setup(struct kvm_vm *vm, int vcpuid, struct kvm_vcpu_init *ini
> init->target = preferred.target;
> }
>
> - vcpu_ioctl(vm, vcpuid, KVM_ARM_VCPU_INIT, init);
> + ret = _vcpu_ioctl(vm, vcpuid, KVM_ARM_VCPU_INIT, init);
> +
> + /*
> + * Missing kernel feature support should result in skipping the test,
> + * not failing it.
> + */
> + if (ret && errno == ENOENT) {
> + print_skip("requested vCPU features not supported; skipping test.");
> + exit(KSFT_SKIP);
> + }
> +
> + TEST_ASSERT(!ret, "KVM_ARM_VCPU_INIT failed, rc: %i errno: %i (%s)",
> + ret, errno, strerror(errno));
>
> /*
> * Enable FP/ASIMD to avoid trapping when accessing Q0-Q15
>
Queued, thanks.
Paolo
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2021-09-21 18:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 21:29 [PATCH] selftests: KVM: Gracefully handle missing vCPU features Oliver Upton
2021-08-19 10:32 ` Andrew Jones
2021-09-21 18:00 ` Paolo Bonzini [this message]
2021-09-21 18:15 ` Andrew Jones
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=bd8abbac-925b-ff1e-f494-8f1c21fe7bd1@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
--cc=oupton@google.com \
--cc=pshier@google.com \
/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;
as well as URLs for NNTP newsgroup(s).