From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F35F1632C8; Mon, 25 Aug 2025 20:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756155065; cv=none; b=BWenwtR8Wa6PHwU8OgjNz5P3VsK1jNkO1oHVYHdFxnZcCbANSi6srv37X4Vef+JIdH/AhiV7H+/BKN7PREpYJwclpVMMTeO+YX906m/J9QC/olr+kRo41tg7BM5jW4FVwgioH+BQLqvlqxEplVnj1CMkhZAqKqOi8OIum17A4pU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756155065; c=relaxed/simple; bh=3v8ZwzMQp6vVVbwvD/f/q5xRWGh2QXldSzFtAYwk/QA=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=gnJYvHd44W4voiHBTNVW3ctJpEmihmvgAgUdmW3wVe4pPn9I/p+4q/M5aElvxQecE2gG0YMQnPM7PJ5yqx9eecdrCHKSinjYB/8Q8AK4nlP3ZxlvanC3KLmwrHTNh6iAT9D1FB0Zr7hefwGI2zg8E4bN8iCbhBZpy3QuW5xx7ss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DTvl8hQx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DTvl8hQx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C168C4CEED; Mon, 25 Aug 2025 20:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756155065; bh=3v8ZwzMQp6vVVbwvD/f/q5xRWGh2QXldSzFtAYwk/QA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DTvl8hQx/dzgJ0SeP4gMEgDeFDVLJSwWfDa3Wc/B1+vFtw4ARQZXlJB4DWUnnoc2s n2b9hl+FxHEoaZHjkTQF7y0az/5PoQy7wuD9d5RoBzWuujbjMtTo7pCKI0Gy4hCDoV WvB4f+Laip7+5YYbALMqrG3W1A9rMeJOSW2d7y8CsLv+ErU+ft7ijSBJaMIxJMAURj 2uQIvhOS2V8qgrUh5huIgKkzxLaPl5pnTA7IAsR6IXO9MTycR0KHaNyLk3kuKKpkbM 8zjXPBdCP79lSILbrO9r6aZNGaNuxcUiqVtdLz196fhnTmOj4UbyjR+jc0CuyHhQ5H 1v+TpYyCEb4Aw== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1uqe9e-00000000Od9-43HS; Mon, 25 Aug 2025 20:51:03 +0000 Date: Mon, 25 Aug 2025 21:51:02 +0100 Message-ID: <87zfbnyvk9.wl-maz@kernel.org> From: Marc Zyngier To: Sean Christopherson Cc: Sebastian Ott , Paolo Bonzini , Shuah Khan , Oliver Upton , kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: selftests: fix irqfd_test on arm64 In-Reply-To: References: <20250825155203.71989-1-sebott@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: seanjc@google.com, sebott@redhat.com, pbonzini@redhat.com, shuah@kernel.org, oliver.upton@linux.dev, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 25 Aug 2025 20:52:21 +0100, Sean Christopherson wrote: > > On Mon, Aug 25, 2025, Sebastian Ott wrote: > > 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 > > --- > > @@ -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"); > > I don't think this test requires v3+, any GIC will do. There is no such thing as "any GIC". You need to know what is available, and ask for something that actually exists. So while the above is wrong on the ground that this doesn't work on v2 or v5, the selection has to be explicit. > Is there a sane way to handle vGIC creation in kvm_arch_vm_post_create()? E.g. > could we create a v3 GIC when possible, and fall back to v2? And then provide a > way for tests to express a hard v3 GIC dependency? You can ask KVM what's available. Like an actual VMM does. There is no shortage of examples in the current code base. And ideally, this should be made an integral part of creating a viable VM, which the current VM creation hack makes a point in not providing. M. -- Jazz isn't dead. It just smells funny.