All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: Martin Kelly <mkelly@xevo.com>
Cc: Joshua G Lock <joshua.g.lock@intel.com>,
	OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH resend] qemuboot.conf: make cpus match built artifacts
Date: Thu, 26 Apr 2018 01:11:27 +0200	[thread overview]
Message-ID: <CA+chaQfHaSAPXrU5pk_=M8hEjScxdVrAcUudekjFbzCUpQxSYA@mail.gmail.com> (raw)
In-Reply-To: <b640e9cc-0bce-0b7b-9639-0a37bf459695@xevo.com>

[-- Attachment #1: Type: text/plain, Size: 4585 bytes --]

There are actually 3 we need to consider for lowest common denominator.

The one we build for, the one we build on and the one where we will run the
qemu in the end.

I mean the core2duo is probably best match for core2-64 DEFAULT used by
qemux86-64 MACHINE. But it's not good match to emulate with QEmu and KVM
enabled on the host like my.

It's easy to work around this, we probably don't need to change the default
values, but it would be good to document this case and how to override
QB_CPU_KVM
if your host doesn't match the features of core2duo.

On Thu, Apr 26, 2018 at 1:02 AM, Martin Kelly <mkelly@xevo.com> wrote:

> On 04/25/2018 12:54 PM, Martin Jansa wrote:
>
>> On Thu, Jun 15, 2017 at 05:37:50PM +0100, Burton, Ross wrote:
>>
>>> On 15 June 2017 at 17:17, Martin Kelly <mkelly@xevo.com> wrote:
>>>
>>> I am no expert, but running qemu -cpu help just says:
>>>>
>>>> kvm32 - "Common 32-bit KVM processor"
>>>> kvm64 - "Common 64-bit KVM processor"
>>>>
>>>> My best guess is that, running on qemu without kvm, both cases will be
>>>> slow (since it's all software emulation). But, using qemu -kvm, it
>>>> should
>>>> be fast as long as you run on a native CPU that is core2duo or better,
>>>> as
>>>> the native instructions can just be exposed and passed through to the
>>>> host.
>>>> Since core2duo is very old by now, it should be fast for virtually
>>>> everyone
>>>> building on x86.
>>>>
>>>>
>>> Right, I did some digging.  Assuming you have KVM enabled then in the
>>> general case the -cpu option is irrelevant as the instructions are
>>> handled
>>> natively.  -cpu just changes what CPUID flags the userspace sees, and so
>>> this is the Right Thing To Do.
>>>
>>
>> Sorry for replying to such old thread, but today I've noticed interesting
>> side-effect of this change.
>>
>> Today I was checking why starting qtbase examples in qemu fails with
>> message about missing ssse3 support which which qtbase as compiled.
>>
>> The DEFAULT_TUNE in qemux86-64 is indeed set to core2-64 which supports
>> ssse3, so qtbase is right to expect it in runtime.
>>
>> But then I was starting qemu manually (not with runqemu) with:
>> qemu-system-x86_64 -M q35 -smp 4 -m 4G -net nic,model=virtio -net
>> user,hostfwd=tcp::2222-:22 -vga virtio -display sdl,gl=on -hda
>> luneui-example-image-qemux86-64-20180425152329-jama.rootfs.wic.vmdk
>> -enable-kvm
>>
>> which defaults to using this kvm64 generic CPU which doesn't support ssse3
>>
>> Changing it to
>> qemu-system-x86_64 -M q35 -cpu core2duo -smp 4 -m 4G -net
>> nic,model=virtio -net user,hostfwd=tcp::2222-:22 -vga virtio -display
>> sdl,gl=on -hda luneui-example-image-qemux86-6
>> 4-20180425152329-jama.rootfs.wic.vmdk -enable-kvm
>>
>> gets rid of the message from qtbase, because core2duo supports ssse3 and
>> matches with qemux86-64,
>> but my host CPU (AMD Bulldozer FX(tm)-8120), doesn't support the same cpu
>> flags like core2due and qemu shows following
>> message when starting:
>> qemu-system-x86_64: warning: host doesn't support requested feature:
>> CPUID.01H:EDX.ss [bit 27]
>>
>> EDX.ss is Self Snoop feature which is enabled in core2duo and few other
>> QEmu emulated CPUs, so I was looking
>> on some other cpu I can emulate which has ssse3 while having the same
>> flags as my host's AMD cpu
>>
>> e.g. -cpu phenom is relatively close, but Bulldozer CPUs don't support
>> 3dnow, 3dnowext, so similar warning is shown.
>>
>> In the end I've switched to using -cpu Nehalem, which has ssse3, but
>> doesn't enable CPUID_SS flag, now it starts without any warnings:
>> qemu-system-x86_64 -M q35 -cpu Nehalem -smp 4 -m 4G -net nic,model=virtio
>> -net user,hostfwd=tcp::2222-:22 -vga virtio -display sdl,gl=on -hda
>> luneui-example-image-qemux86-64-20180425152329-jama.rootfs.wic.vmdk
>> -enable-kvm
>>
>> Regards,
>>
>>
> Heh, this is bringing back memories of when I wrote the patch. It's tricky
> to say what CPU we should pick here; we want whatever is the closest to a
> lowest common denominator. I don't know enough to say what the right choice
> is, though it is important that the CPU we build for and the one we run for
> are the same.
>
> Prior to this patch, we built for core2duo and then ran with kvm64,
> causing issues. Good follow-up work would be to see if core2duo is really
> the best CPU to be targeting for a lowest common denominator. If Nehalem is
> a better match, we might as well switch to that, as long as we switch in
> both build and runtime consistently.
>

[-- Attachment #2: Type: text/html, Size: 5827 bytes --]

  reply	other threads:[~2018-04-25 23:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 19:20 [PATCH resend] qemuboot.conf: make cpus match built artifacts Martin Kelly
2017-05-22 17:29 ` Martin Kelly
2017-05-22 17:53   ` Randy Witt
2017-05-22 18:09     ` Martin Kelly
2017-06-13 16:44       ` Martin Kelly
2017-06-15 11:45 ` Burton, Ross
2017-06-15 16:17   ` Martin Kelly
2017-06-15 16:37     ` Burton, Ross
2018-04-25 19:54       ` Martin Jansa
2018-04-25 23:02         ` Martin Kelly
2018-04-25 23:11           ` Martin Jansa [this message]
2018-04-27 17:47             ` Martin Kelly

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='CA+chaQfHaSAPXrU5pk_=M8hEjScxdVrAcUudekjFbzCUpQxSYA@mail.gmail.com' \
    --to=martin.jansa@gmail.com \
    --cc=joshua.g.lock@intel.com \
    --cc=mkelly@xevo.com \
    --cc=openembedded-core@lists.openembedded.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.