[Top][All Lists]

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

[Qemu-discuss] Disable, not hide cpu instructions/flags to the guest OS?

From: tukozaki
Subject: [Qemu-discuss] Disable, not hide cpu instructions/flags to the guest OS?
Date: Sun, 9 Jul 2017 22:33:39 +0200

Hi. Can we *disable* cpu instructions (aka CPU fags) from the guest OS
using Qemu/KVM?

I'm trying to help a local fablab pre-qualify software for refurbished
machines, many of which have a limited set of instructions (e.g. Athlon XP
and Pentium 3/4). It's a long term project; thought I coud save a great
deal of time on the long run using Qemu/KVM and libvirt. But the way I
presently run Qemu/KVM does only *hide* CPU intructions from the guest OS
but won't disable them as we wish it'll do. For example:

1) Testing software for a SSE-only machine:


    $ qemu-system-i386 -cpu pentium3,check (...) -enable-kvm


    $ inxi -f
    CPU:       Single core Pentium III (Katmai) (-UP-) cache: 16384 KB
speed: 3292 MHz (max)
        CPU Flags: apic cmov cx8 de fpu fxsr hypervisor mca mce mmx
msr mtrr pae pge pse pse36 sep sse tsc ⟫

    $ firefox   # v.54 which requires sse2;
    runs fine. Means sse2 is available in the guest OS.

    $ chromium-browser    # requires sse2 + check the CPUID

    # (...)
    # Fatal error in ../../v8/src/ia32/assembler-ia32.cc, line 109
    # Check failed: cpu.has_sse2().
    #0 0x0000b40b9f0a base::debug::StackTrace::StackTrace()

Same thing happens with '-cpu athlon,sse2=off'

2) then I tried to stay on the safe side.


    $ qemu-system-i386 -cpu pentium,check (...)


    $ inxi -f
    CPU:       Single core Pentium MMX (-UP-) cache: 0 KB speed: 3292
MHz (max)
              CPU Flags: apic cx8 de fpu hypervisor mce mmx msr pse
tsc vme x2apic

    $ palemoon    # or any application that requires sse
    Illegal instruction

>From  https://lists.nongnu.org/archive/html/qemu-discuss/2014-07/msg00053.html

> So mathematical SSE2 operations should run at full hardware speed.
> Cache preload SSE/MMX operations may have different performance than on the 
> host.

> Exact relationships depend on the specific CPU chip design and how the chip
> designers implemented the VM chip extensions inside each CPU core.

Also, though I can't remember the source:

> with "-cpu pentium3" (which claims to not support SSE2 in cpuid). (The KVM
> test with the fake cpuid tests that the non-SSE2 code paths don't crash, but
> it does not guarantee that there are really no SSE2 instructions encountered.

Does it means one should disabe KVM to do the testing? But AFAIK that
would impede any attempt to emulate a VM with about the same
performances as the physical oldie.

I'm now stuck doing the 'pre-testing' in a VM: I dunno how to
*disable* sse2. I thought about doing the pre-test only for the
Pentium 4 class machines, but what's true for the sse2 cpu
instructions (hidden not disabed) is probaby true for sse3 and so on.

Any ideas may help us down here.


reply via email to

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