qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 0/9] target/arm/kvm: enable SVE in guests


From: Andrew Jones
Subject: Re: [PATCH v7 0/9] target/arm/kvm: enable SVE in guests
Date: Mon, 28 Oct 2019 07:10:27 -0400 (EDT)

Apologies if this mail is messed up. I'm having trouble with a hotel's network 
and am forced to use a webui.

----- Original Message -----
> On Fri, 25 Oct 2019 at 14:52, Andrew Jones <address@hidden> wrote:
> >
> > On Fri, Oct 25, 2019 at 01:06:26PM +0100, Peter Maydell wrote:
> > > Fails 'make check' on my aarch32-compile-in-chroot-on-aarch64
> > > machine:
> >
> > Are there easy-to-follow instructions for setting this environment up
> > somewhere?
> 
> It's an ancient setup, so not really. But it's just an
> Ubuntu 32-bit chroot inside an Ubuntu 64-bit host. I use
> schroot to manage it.
> 
> 
> 
> > I guess the problem is how we're determining if KVM is available, which
> > is like this
> >
> > int main(int argc, char **argv)
> > {
> >     bool kvm_available = false;
> >
> >     if (!access("/dev/kvm",  R_OK | W_OK)) {
> > #if defined(HOST_AARCH64)
> >         kvm_available = g_str_equal(qtest_get_arch(), "aarch64");
> > #elif defined(HOST_ARM)
> >         kvm_available = g_str_equal(qtest_get_arch(), "arm");
> > #endif
> >     }
> 
> > So we need /dev/kvm and the QEMU binary arch type (qemu-system-arm in
> > this case) needs to match the host arch type. The problem is that
> > HOST_<type> doesn't imply anything about the actual host arch type.
> > <type> comes from the configure $ARCH variable, which for 'arm'
> > comes from the $cpu variable, which for 'arm' comes from whether or
> > not the compiler defines __arm__, and cross compilers certainly do.
> > I guess we'd have the same problem in an aarch32-compile-in-chroot-on-
> > <any-other-type> environment, if a cross compiler is used for the
> > compiling. I should change the KVM available check to something that
> > uses the actual host arch type. I assume the following works, but
> > I don't know if I'm allowed to use uname() in these tests, and, if
> > not, then I don't know what the right way to get the actual host
> > type is.
> 
> This all feels like it's trying to do the wrong thing, ie
> replicate the logic within QEMU that decides whether to use
> KVM or not. Some possible other approaches:
> 
>  * If you want to know whether you can run the qemu binary
>    with -accel kvm, then just try that and see if it succeeds.

That's what's happening here, but the failure happens in qtest_init(), so
there's no way to avoid the assert.

>  * Or use '-accel kvm:tcg' and make the test work so that it
>    will pass for both KVM and TCG

For the KVM tests, I'd prefer we specifically test the 'host' cpu type,
which requires we specifically test with KVM. That said, we can use
the fallback along with an additional query to make sure 'host' is
ok to use.

>  * Or use QMP to query what accelerators are available, assuming
>    there's a QMP command for that

Looks like we can check for kvm with query-kvm. 

I'll rework patch 2/9 using the fallback and kvm query to ensure
kvm can be used. I can even add a test or two that ensure 'host'
is ok to use.

Thanks,
drew




reply via email to

[Prev in Thread] Current Thread [Next in Thread]