From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752874AbdK2XKv (ORCPT ); Wed, 29 Nov 2017 18:10:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57334 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752687AbdK2XKu (ORCPT ); Wed, 29 Nov 2017 18:10:50 -0500 Date: Wed, 29 Nov 2017 21:10:47 -0200 From: Eduardo Habkost To: Paolo Bonzini Cc: Wanpeng Li , "linux-kernel@vger.kernel.org" , kvm , yfu@redhat.com Subject: Re: [PATCH] KVM: x86: inject exceptions produced by x86_decode_insn Message-ID: <20171129231047.GD3037@localhost.localdomain> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Fnord: you can see the fnord User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 29 Nov 2017 23:10:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 29, 2017 at 11:47:14PM +0100, Paolo Bonzini wrote: > 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?!? I was so convinced that it was impossible for the patch to fix the problem, that I forgot to test it. :) I will test it tomorrow and let you know. > > 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=?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? > -- Eduardo