From: Jan Kiszka Subject: Re: [kvm-unit-tests]: nVMX, gcc labels as values, FEATURE_CONTROL lock bit Date: Mon, 24 Feb 2014 07:44:12 +0100 Message-ID: <530AEA3C.9070707@siemens.com> References: <20140223090431.GA14924@lea.sec.uni-passau.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Marius Vlad , Paolo Bonzini Return-path: Received: from thoth.sbs.de ([192.35.17.2]:56549 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286AbaBXGoV (ORCPT ); Mon, 24 Feb 2014 01:44:21 -0500 In-Reply-To: <20140223090431.GA14924@lea.sec.uni-passau.de> Sender: kvm-owner@vger.kernel.org List-ID: On 2014-02-23 10:04, Marius Vlad wrote: > Hello, > > $ qemu --version QEMU emulator version 1.7.0 (Debian 1.7.0+dfsg-3), > Copyright (c) 2003-2008 Fabrice Bellard > > $ gcc --version gcc (Debian 4.8.2-15) 4.8.2 > > $ git rev-list HEAD | head -n1 > c0a4e715eb30944f984a92fbd4bb2cff6ee298a5 > > $ git branch master > > $ qemu-system-x86_64 -enable-kvm -device pc-testdev -device > isa-debug-exit,iobase=0xf4,iosize=0x4 \ -display none -serial stdio > -device pci-testdev -kernel x86/vmx.flat -cpu host,+vmx,+x2apic > -smp 1 enabling apic paging enabled cr0 = 80010011 cr3 = 7fff000 > cr4 = 20 PASS: test vmxon with FEATURE_CONTROL cleared PASS: test > vmxon without FEATURE_CONTROL lock PASS: test enable VMX in > FEATURE_CONTROL unhandled excecption 6 + ret=15 + echo Return value > from qemu: 15 Return value from qemu: 15 + exit 15 > > I need to add a nop statement for GCC to generate the proper jump > address. > > w/o: > > 0000000000400493 : 400493: 48 c7 05 > 02 f4 00 00 b0 04 40 00 movq $0x4004b0,0xf402(%rip) > # 40f8a0 40049e: b9 3a 00 00 00 > mov $0x3a,%ecx 4004a3: ba 00 00 00 00 mov > $0x0,%edx 4004a8: b8 00 00 00 00 mov $0x0,%eax > 4004ad: 0f 30 wrmsr 4004af: c3 > retq > > 00000000004004b0 : 4004b0: 53 > push %rbx # <- jumps here, in case of GP > > with: > > 0000000000400493 : 400493: 48 c7 05 > 02 f4 00 00 af 04 40 00 movq $0x4004af,0xf402(%rip) > # 40f8a0 40049e: b9 3a 00 00 00 > mov $0x3a,%ecx 4004a3: ba 00 00 00 00 mov > $0x0,%edx 4004a8: b8 00 00 00 00 mov $0x0,%eax > 4004ad: 0f 30 wrmsr 4004af: 90 > nop # <- lands here 4004b0: c3 > retq > > $ qemu-system-x86_64 -enable-kvm -device pc-testdev -device > isa-debug-exit,iobase=0xf4,iosize=0x4 \ -display none -serial stdio > -device pci-testdev -kernel x86/vmx.flat -cpu host,+vmx,+x2apic > -smp 1 enabling apic paging enabled cr0 = 80010011 cr3 = 7fff000 > cr4 = 20 PASS: test vmxon with FEATURE_CONTROL cleared PASS: test > vmxon without FEATURE_CONTROL lock PASS: test enable VMX in > FEATURE_CONTROL PASS: test FEATURE_CONTROL lock bit PASS: test > vmxon PASS: test vmptrld PASS: test vmclear PASS: test vmptrst > PASS: test vmxoff .... SUMMARY: 57 tests, 0 failures + ret=1 + echo > Return value from qemu: 1 Return value from qemu: 1 + exit 1 > Paolo, did you report these effects to gcc? Marius, could you provide a corresponding patch with a description of the affected gcc version (or a link to this thread)? Thanks, Jan -- Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux