From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752908AbdK2WrT (ORCPT ); Wed, 29 Nov 2017 17:47:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48016 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751977AbdK2WrR (ORCPT ); Wed, 29 Nov 2017 17:47:17 -0500 Subject: Re: [PATCH] KVM: x86: inject exceptions produced by x86_decode_insn To: Eduardo Habkost Cc: Wanpeng Li , "linux-kernel@vger.kernel.org" , kvm , yfu@redhat.com References: <1510307378-97452-1-git-send-email-pbonzini@redhat.com> <4ff4d2f3-439b-2a8f-ef89-b2a1984e809d@redhat.com> <20171129114411.GA16634@localhost.localdomain> <4a61fa0a-a4ca-4c06-63c9-2b940eac2601@redhat.com> <20171129184216.GC3037@localhost.localdomain> From: Paolo Bonzini Message-ID: Date: Wed, 29 Nov 2017 23:47:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171129184216.GC3037@localhost.localdomain> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 29 Nov 2017 22:47:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/11/2017 19:42, Eduardo Habkost wrote: > The reproducer (not a full test case) is quite simple, see patch below. Great, thanks. I assume that the patch doesn't fix it?!? Paolo > Now, I've noticed something interesting when running the > reproducer: > > If the test_fetch_failure() call happens before we touch > pci-testdev through *mem (like in the patch below), we get an > emulation failure like the one Yanan saw: > > $ /usr/bin/qemu-system-x86_64 -nodefaults -device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4 -vnc none -serial stdio -device pci-testdev -machine accel=kvm -kernel ./x86/emulator.flat # -initrd /tmp/tmp.RCPjppRp8i > enabling apic > paging enabled > cr0 = 80010011 > cr3 = 45e000 > cr4 = 20 > KVM internal error. Suberror: 1 > emulation failure > RAX=0000000000000000 RBX=0000000000000000 RCX=0000000000000000 RDX=0000000000000000 > RSI=0000000000000000 RDI=0000000000000000 RBP=0000000000000000 RSP=0000000000000000 > R8 =0000000000000000 R9 =0000000000000000 R10=0000000000000000 R11=0000000000000000 > R12=0000000000000000 R13=0000000000000000 R14=0000000000000000 R15=0000000000000000 > RIP=ffffffffffffc08a RFL=00010002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0 > ES =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA] > CS =0008 0000000000000000 ffffffff 00a09b00 DPL=0 CS64 [-RA] > SS =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA] > DS =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA] > FS =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA] > GS =0010 0000000000454d60 ffffffff 00c09300 DPL=0 DS [-WA] > LDT=0000 0000000000000000 0000ffff 00008200 DPL=0 LDT > TR =0080 000000000041148a 0000ffff 00008b00 DPL=0 TSS64-busy > GDT= 000000000041100a 0000047f > IDT= 0000000000000000 00000fff > CR0=80010011 CR2=ffffffffffffc08a CR3=000000000045e000 CR4=00000020 > DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 > DR6=00000000ffff0ff0 DR7=0000000000000400 > EFER=0000000000000500 > Code=?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??