From: Sebastian Ott <sebott@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>,
Sean Christopherson <seanjc@google.com>,
Marc Zyngier <maz@kernel.org>,
Oliver Upton <oliver.upton@linux.dev>
Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Sebastian Ott <sebott@redhat.com>
Subject: [PATCH] KVM: selftests: fix irqfd_test on arm64
Date: Mon, 25 Aug 2025 17:52:03 +0200 [thread overview]
Message-ID: <20250825155203.71989-1-sebott@redhat.com> (raw)
irqfd_test on arm triggers the following assertion:
==== Test Assertion Failure ====
include/kvm_util.h:527: !ret
pid=3643 tid=3643 errno=11 - Resource temporarily unavailable
1 0x00000000004026d7: kvm_irqfd at kvm_util.h:527
2 0x0000000000402083: main at irqfd_test.c:100
3 0x0000ffffa5aab587: ?? ??:0
4 0x0000ffffa5aab65f: ?? ??:0
5 0x000000000040236f: _start at ??:?
KVM_IRQFD failed, rc: -1 errno: 11 (Resource temporarily unavailable)
Fix this by setting up a vgic for the vm.
Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
tools/testing/selftests/kvm/irqfd_test.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kvm/irqfd_test.c b/tools/testing/selftests/kvm/irqfd_test.c
index 7c301b4c7005..f7b8766e9d42 100644
--- a/tools/testing/selftests/kvm/irqfd_test.c
+++ b/tools/testing/selftests/kvm/irqfd_test.c
@@ -8,7 +8,11 @@
#include <stdint.h>
#include <sys/sysinfo.h>
+#include "processor.h"
#include "kvm_util.h"
+#ifdef __aarch64__
+#include "vgic.h"
+#endif
static struct kvm_vm *vm1;
static struct kvm_vm *vm2;
@@ -86,14 +90,30 @@ static void juggle_eventfd_primary(struct kvm_vm *vm, int eventfd)
kvm_irqfd(vm, GSI_BASE_PRIMARY + 1, eventfd, KVM_IRQFD_FLAG_DEASSIGN);
}
+static struct kvm_vm *test_vm_create(void)
+{
+#ifdef __aarch64__
+ struct kvm_vm *vm;
+ struct kvm_vcpu *vcpu;
+ int gic_fd;
+
+ vm = vm_create_with_one_vcpu(&vcpu, NULL);
+ gic_fd = vgic_v3_setup(vm, 1, 64);
+ __TEST_REQUIRE(gic_fd >= 0, "Failed to create vgic-v3");
+
+ return vm;
+#endif
+ return vm_create(1);
+}
+
int main(int argc, char *argv[])
{
pthread_t racing_thread;
int r, i;
/* Create "full" VMs, as KVM_IRQFD requires an in-kernel IRQ chip. */
- vm1 = vm_create(1);
- vm2 = vm_create(1);
+ vm1 = test_vm_create();
+ vm2 = test_vm_create();
WRITE_ONCE(__eventfd, kvm_new_eventfd());
--
2.51.0
next reply other threads:[~2025-08-25 15:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 15:52 Sebastian Ott [this message]
2025-08-25 19:52 ` [PATCH] KVM: selftests: fix irqfd_test on arm64 Sean Christopherson
2025-08-25 20:51 ` Marc Zyngier
2025-08-25 21:11 ` Sean Christopherson
2025-08-25 21:38 ` Oliver Upton
2025-08-26 18:51 ` Sean Christopherson
2025-08-26 19:24 ` Oliver Upton
2025-08-26 20:41 ` Sean Christopherson
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=20250825155203.71989-1-sebott@redhat.com \
--to=sebott@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
/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).