Hi,

On Wed, Mar 09, 2022 at 05:58:12PM +0100, Andrew Jones wrote:
> On Wed, Mar 09, 2022 at 04:21:17PM +0000, Alexandru Elisei wrote:
> > From: Andrew Jones <drjo...@redhat.com>
> > 
> > KVM on arm64 can create 32 bit and 64 bit VMs. kvm-unit-tests tries to
> > take advantage of this by setting the aarch64=off -cpu option. However,
> > get_qemu_accelerator() isn't aware that KVM on arm64 can run both types
> > of VMs and it selects qemu-system-arm instead of qemu-system-aarch64.
> > This leads to an error in premature_failure() and the test is marked as
> > skipped:
> > 
> > $ ./run_tests.sh selftest-setup
> > SKIP selftest-setup (qemu-system-arm: -accel kvm: invalid accelerator kvm)
> > 
> > Fix this by setting QEMU to the correct qemu binary before calling
> > get_qemu_accelerator().
> > 
> > Signed-off-by: Andrew Jones <drjo...@redhat.com>
> > [ Alex E: Added commit message, changed the logic to make it clearer ]
> > Signed-off-by: Alexandru Elisei <alexandru.eli...@arm.com>
> > ---
> >  arm/run | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/arm/run b/arm/run
> > index 2153bd320751..5fe0a45c4820 100755
> > --- a/arm/run
> > +++ b/arm/run
> > @@ -13,6 +13,11 @@ processor="$PROCESSOR"
> >  ACCEL=$(get_qemu_accelerator) ||
> >     exit $?
> >  
> > +# KVM for arm64 can create a VM in either aarch32 or aarch64 modes.
> > +if [ "$ACCEL" = kvm ] && [ -z "$QEMU" ] && [ "$HOST" = "aarch64" ]; then
> > +   QEMU=qemu-system-aarch64
> > +fi
> > +
> >  qemu=$(search_qemu_binary) ||
> >     exit $?
> >  
> > -- 
> > 2.35.1
> >
> 
> So there's a bug with this patch which was also present in the patch I
> proposed. By setting $QEMU before we call search_qemu_binary() we may
> force a "A QEMU binary was not found." failure even though a perfectly
> good 'qemu-kvm' binary is present.

I noticed that search_qemu_binary() tries to search for both
qemu-system-ARCH_NAME and qemu-kvm, and I first thought that qemu-kvm is a
legacy name for qemu-system-ARCH_NAME.

I just did some googling, and I think it's actually how certain distros (like
SLES) package qemu-system-ARCH_NAME, is that correct?

If that is so, one idea I toyed with (for something else) is to move the error
messages from search_qemu_binary() to the call sites, that way arm/run can first
try to find qemu-system-aarch64, then fallback to qemu-kvm, and only after both
aren't found exit with an error. Just a suggestion, in case you find it useful.

Thanks,
Alex

> 
> I'll try to come up with something better.
> 
> Thanks,
> drew
> 
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to