Patchwork runqemu: Use correct kvm CPU options for qemux86* with kvm

login
register
mail settings
Submitter Richard Purdie
Date Sept. 25, 2013, 8:59 p.m.
Message ID <1380142751.18603.344.camel@ted>
Download mbox | patch
Permalink /patch/58991/
State Accepted
Commit b8819b02dc4ff29d678cc55887dfe6c2d109a67d
Headers show

Comments

Richard Purdie - Sept. 25, 2013, 8:59 p.m.
The existing -cpu host option caused kernel panics when people attempted to use
the kvm option. After research and discussion, the best options appear to
be the kvm32/kvm64 cpu types so lets use these instead. These resolve
the kernel issues for me.

[YOCTO #3908]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
Darren Hart - Sept. 25, 2013, 9:05 p.m.
On Wed, 2013-09-25 at 21:59 +0100, Richard Purdie wrote:
> The existing -cpu host option caused kernel panics when people attempted to use
> the kvm option. After research and discussion, the best options appear to
> be the kvm32/kvm64 cpu types so lets use these instead. These resolve
> the kernel issues for me.
> 
> [YOCTO #3908]
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Makes a lot of sense to me:

Acked-by: Darren Hart <dvhart@linux.intel.com>

> ---
> diff --git a/scripts/runqemu b/scripts/runqemu
> index efab1a2..12c58d9 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -265,7 +265,11 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
>          exit 1;
>      fi
>      if [ -w /dev/kvm -a -r /dev/kvm ]; then
> -        SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host"
> +        if [ "x$MACHINE" = "xqemux86" ]; then
> +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm32"
> +        elif [ "x$MACHINE" = "xqemux86-64" ]; then
> +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm64"
> +        fi

The above is fine, but it does raise the question of dealing with non
oe-core BSPs with runqemu. For instance, there would be value in testing
genericx86 and genericx86_64 in the same way. We can deal with that
separately though I think as this solves an immediate problem and
doesn't make it any worse for the case I mention.
Richard Purdie - Sept. 25, 2013, 9:09 p.m.
On Wed, 2013-09-25 at 14:05 -0700, Darren Hart wrote:
> On Wed, 2013-09-25 at 21:59 +0100, Richard Purdie wrote:
> > The existing -cpu host option caused kernel panics when people attempted to use
> > the kvm option. After research and discussion, the best options appear to
> > be the kvm32/kvm64 cpu types so lets use these instead. These resolve
> > the kernel issues for me.
> > 
> > [YOCTO #3908]
> > 
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> 
> Makes a lot of sense to me:
> 
> Acked-by: Darren Hart <dvhart@linux.intel.com>
> 
> > ---
> > diff --git a/scripts/runqemu b/scripts/runqemu
> > index efab1a2..12c58d9 100755
> > --- a/scripts/runqemu
> > +++ b/scripts/runqemu
> > @@ -265,7 +265,11 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
> >          exit 1;
> >      fi
> >      if [ -w /dev/kvm -a -r /dev/kvm ]; then
> > -        SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host"
> > +        if [ "x$MACHINE" = "xqemux86" ]; then
> > +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm32"
> > +        elif [ "x$MACHINE" = "xqemux86-64" ]; then
> > +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm64"
> > +        fi
> 
> The above is fine, but it does raise the question of dealing with non
> oe-core BSPs with runqemu. For instance, there would be value in testing
> genericx86 and genericx86_64 in the same way. We can deal with that
> separately though I think as this solves an immediate problem and
> doesn't make it any worse for the case I mention.

There is an explicit check for qemux86* just above this block so whilst
I like the idea, its something for another patch and likely 1.6
material. Could be worth an enhancement bug though.

Cheers,

Richard
Darren Hart - Sept. 25, 2013, 9:32 p.m.
On Wed, 2013-09-25 at 22:09 +0100, Richard Purdie wrote:
> On Wed, 2013-09-25 at 14:05 -0700, Darren Hart wrote:
> > On Wed, 2013-09-25 at 21:59 +0100, Richard Purdie wrote:
> > > The existing -cpu host option caused kernel panics when people attempted to use
> > > the kvm option. After research and discussion, the best options appear to
> > > be the kvm32/kvm64 cpu types so lets use these instead. These resolve
> > > the kernel issues for me.
> > > 
> > > [YOCTO #3908]
> > > 
> > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > 
> > Makes a lot of sense to me:
> > 
> > Acked-by: Darren Hart <dvhart@linux.intel.com>
> > 
> > > ---
> > > diff --git a/scripts/runqemu b/scripts/runqemu
> > > index efab1a2..12c58d9 100755
> > > --- a/scripts/runqemu
> > > +++ b/scripts/runqemu
> > > @@ -265,7 +265,11 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
> > >          exit 1;
> > >      fi
> > >      if [ -w /dev/kvm -a -r /dev/kvm ]; then
> > > -        SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host"
> > > +        if [ "x$MACHINE" = "xqemux86" ]; then
> > > +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm32"
> > > +        elif [ "x$MACHINE" = "xqemux86-64" ]; then
> > > +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm64"
> > > +        fi
> > 
> > The above is fine, but it does raise the question of dealing with non
> > oe-core BSPs with runqemu. For instance, there would be value in testing
> > genericx86 and genericx86_64 in the same way. We can deal with that
> > separately though I think as this solves an immediate problem and
> > doesn't make it any worse for the case I mention.
> 
> There is an explicit check for qemux86* just above this block so whilst
> I like the idea, its something for another patch and likely 1.6
> material. Could be worth an enhancement bug though.

Agreed, i think that is basically covered by:

Bug 2025 - runqemu scripts should attempt sane defaults for unkown machines

> 
> Cheers,
> 
> Richard
> 
>
Khem Raj - Sept. 25, 2013, 9:34 p.m.
On Wed, Sep 25, 2013 at 1:59 PM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> The existing -cpu host option caused kernel panics when people attempted to use
> the kvm option. After research and discussion, the best options appear to
> be the kvm32/kvm64 cpu types so lets use these instead. These resolve
> the kernel issues for me.
>
> [YOCTO #3908]
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> diff --git a/scripts/runqemu b/scripts/runqemu
> index efab1a2..12c58d9 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -265,7 +265,11 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
>          exit 1;
>      fi
>      if [ -w /dev/kvm -a -r /dev/kvm ]; then
> -        SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host"
> +        if [ "x$MACHINE" = "xqemux86" ]; then
> +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm32"
> +        elif [ "x$MACHINE" = "xqemux86-64" ]; then
> +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm64"
> +        fi

may be leave the original in the else clause at the end so it covers
the non x86 cases too

>          KVM_ACTIVE="yes"
>      else
>          echo "You have no rights on /dev/kvm."
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Richard Purdie - Sept. 25, 2013, 10 p.m.
On Wed, 2013-09-25 at 14:34 -0700, Khem Raj wrote:
> On Wed, Sep 25, 2013 at 1:59 PM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > The existing -cpu host option caused kernel panics when people attempted to use
> > the kvm option. After research and discussion, the best options appear to
> > be the kvm32/kvm64 cpu types so lets use these instead. These resolve
> > the kernel issues for me.
> >
> > [YOCTO #3908]
> >
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > ---
> > diff --git a/scripts/runqemu b/scripts/runqemu
> > index efab1a2..12c58d9 100755
> > --- a/scripts/runqemu
> > +++ b/scripts/runqemu
> > @@ -265,7 +265,11 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
> >          exit 1;
> >      fi
> >      if [ -w /dev/kvm -a -r /dev/kvm ]; then
> > -        SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host"
> > +        if [ "x$MACHINE" = "xqemux86" ]; then
> > +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm32"
> > +        elif [ "x$MACHINE" = "xqemux86-64" ]; then
> > +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm64"
> > +        fi
> 
> may be leave the original in the else clause at the end so it covers
> the non x86 cases too

There is no non x86 case for kvm. Its already guarded against by code
above here which errors if its not one of these two machines...

Cheers,

Richard
Khem Raj - Sept. 25, 2013, 10:05 p.m.
On Wed, Sep 25, 2013 at 3:00 PM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Wed, 2013-09-25 at 14:34 -0700, Khem Raj wrote:
>> On Wed, Sep 25, 2013 at 1:59 PM, Richard Purdie
>> <richard.purdie@linuxfoundation.org> wrote:
>> > The existing -cpu host option caused kernel panics when people attempted to use
>> > the kvm option. After research and discussion, the best options appear to
>> > be the kvm32/kvm64 cpu types so lets use these instead. These resolve
>> > the kernel issues for me.
>> >
>> > [YOCTO #3908]
>> >
>> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>> > ---
>> > diff --git a/scripts/runqemu b/scripts/runqemu
>> > index efab1a2..12c58d9 100755
>> > --- a/scripts/runqemu
>> > +++ b/scripts/runqemu
>> > @@ -265,7 +265,11 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
>> >          exit 1;
>> >      fi
>> >      if [ -w /dev/kvm -a -r /dev/kvm ]; then
>> > -        SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host"
>> > +        if [ "x$MACHINE" = "xqemux86" ]; then
>> > +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm32"
>> > +        elif [ "x$MACHINE" = "xqemux86-64" ]; then
>> > +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm64"
>> > +        fi
>>
>> may be leave the original in the else clause at the end so it covers
>> the non x86 cases too
>
> There is no non x86 case for kvm. Its already guarded against by code
> above here which errors if its not one of these two machines...
>

thats fine then
> Cheers,
>
> Richard
>
Bruce Ashfield - Sept. 26, 2013, 4:26 a.m.
On 13-09-25 4:59 PM, Richard Purdie wrote:
> The existing -cpu host option caused kernel panics when people attempted to use
> the kvm option. After research and discussion, the best options appear to
> be the kvm32/kvm64 cpu types so lets use these instead. These resolve
> the kernel issues for me.

Late to the party, and discussion, but agreed. This change looks good
for this point in 1.5.

Cheers,

Bruce

>
> [YOCTO #3908]
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> diff --git a/scripts/runqemu b/scripts/runqemu
> index efab1a2..12c58d9 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -265,7 +265,11 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
>           exit 1;
>       fi
>       if [ -w /dev/kvm -a -r /dev/kvm ]; then
> -        SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host"
> +        if [ "x$MACHINE" = "xqemux86" ]; then
> +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm32"
> +        elif [ "x$MACHINE" = "xqemux86-64" ]; then
> +            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm64"
> +        fi
>           KVM_ACTIVE="yes"
>       else
>           echo "You have no rights on /dev/kvm."
>
>

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index efab1a2..12c58d9 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -265,7 +265,11 @@  if [ "x$KVM_ENABLED" = "xyes" ]; then
         exit 1;
     fi
     if [ -w /dev/kvm -a -r /dev/kvm ]; then
-        SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host"
+        if [ "x$MACHINE" = "xqemux86" ]; then
+            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm32"
+        elif [ "x$MACHINE" = "xqemux86-64" ]; then
+            SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu kvm64"
+        fi
         KVM_ACTIVE="yes"
     else
         echo "You have no rights on /dev/kvm."