qemu-discuss
[Top][All Lists]
Advanced

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

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


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

On Sun, Jul 9, 2017 at 10:33 PM, tukozaki <address@hidden> wrote:

> 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:
>
> host
>
>     $ qemu-system-i386 -cpu pentium3,check (...) -enable-kvm
>
> guest:
>
>     $ 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 ⟫
>         x2apic
>
>     $ 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.
>
> host:
>
>     $ qemu-system-i386 -cpu pentium,check (...)
>
> guest:
>
>     $ 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 tried launching the Qemu vm without kvm:

    $ qemu-system-i386 -cpu pentium3,check <options, disk image>

was slow as it should, but the same applications requiring sse2 still
did run (with some patience).

So I can't find how to run a client disabling the host cpu extensions.
Maybe that simply is impossible with the current Qemu.

Cyrille "kozaki"


reply via email to

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