From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH v6 00/15] Nested EPT Date: Sun, 04 Aug 2013 17:14:23 +0200 Message-ID: <51FE6FCF.6000109@web.de> References: <1375366117-9014-1-git-send-email-gleb@redhat.com> <51FE1DD9.80904@web.de> <20130804093205.GJ6042@redhat.com> <20130804095355.GK6042@redhat.com> <20130804134435.GR6042@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CJhqKqTDXEjhJ32hpVnoE5CAWv0TdI5cX" Cc: kvm@vger.kernel.org, Xiao Guangrong , Jun Nakajima , Yang Zhang , pbonzini@redhat.com To: Gleb Natapov Return-path: Received: from mout.web.de ([212.227.15.14]:49214 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753246Ab3HDPOa (ORCPT ); Sun, 4 Aug 2013 11:14:30 -0400 Received: from mchn199C.mchp.siemens.de ([95.157.58.223]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MKrOS-1V600q12vo-0002gw for ; Sun, 04 Aug 2013 17:14:28 +0200 In-Reply-To: <20130804134435.GR6042@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --CJhqKqTDXEjhJ32hpVnoE5CAWv0TdI5cX Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-08-04 15:44, Gleb Natapov wrote: > On Sun, Aug 04, 2013 at 12:53:56PM +0300, Gleb Natapov wrote: >> On Sun, Aug 04, 2013 at 12:32:06PM +0300, Gleb Natapov wrote: >>> On Sun, Aug 04, 2013 at 11:24:41AM +0200, Jan Kiszka wrote: >>>> On 2013-08-01 16:08, Gleb Natapov wrote: >>>>> Another day -- another version of the nested EPT patches. In this v= ersion >>>>> included fix for need_remote_flush() with shadowed ept, set bits 6:= 8 >>>>> of exit_qualification during ept_violation, update_permission_bitma= sk() >>>>> made to work with shadowed ept pages and other small adjustment acc= ording >>>>> to review comments. >>>> >>>> Was just testing it here and ran into a bug: I've L2 accessing the H= PET >>>> MMIO region that my L1 passed through from L0 (where it is supposed = to >>>> be emulated in this setup). This used to work with an older posting = of >>> Not sure I understand your setup. L0 emulates HPET, L1 passes it thro= ugh >>> to L2 (mmaps it and creates kvm slot that points to it) and when L2 >>> accessed it it locks up? >>> >>>> Jun, but now it locks up (infinite loop over L2's MMIO access, no L2= ->L1 >>>> transition). Any ideas where to look for debugging this? >>>> >>> Can you do an ftrace -e kvm -e kvmmmu? Unit test will also be helpful= :) >>> >> I did an MMIO access from nested guest in the vmx unit test (which is >> naturally passed through to L0 since L1 is so simple) and I can see th= at >> the access hits L0. >> > But then unit test not yet uses nested EPT :) Indeed, that's what I was about to notice as well. EPT test cases are on Arthur's list, but I suggested to start easier with some MSR switches (just to let him run into KVM's PAT bugs ;) ). Anyway, here are the traces: qemu-system-x86-11521 [000] 4724.170191: kvm_entry: vcpu 0 qemu-system-x86-11521 [000] 4724.170192: kvm_exit: reason E= PT_VIOLATION rip 0xffffffff8102ab70 info 181 0 qemu-system-x86-11521 [000] 4724.170192: kvm_page_fault: address = 1901978 error_code 181 qemu-system-x86-11521 [000] 4724.170193: kvm_mmu_pagetable_walk: addr 1= 901978 pferr 0=20 qemu-system-x86-11521 [000] 4724.170193: kvm_mmu_paging_element: pte 3c= 04c007 level 4 qemu-system-x86-11521 [000] 4724.170193: kvm_mmu_paging_element: pte 3c= 04d007 level 3 qemu-system-x86-11521 [000] 4724.170193: kvm_mmu_paging_element: pte 3c= 05a007 level 2 qemu-system-x86-11521 [000] 4724.170193: kvm_mmu_paging_element: pte 19= 01037 level 1 qemu-system-x86-11521 [000] 4724.170197: kvm_entry: vcpu 0 qemu-system-x86-11521 [000] 4724.170198: kvm_exit: reason E= PT_VIOLATION rip 0xffffffff8102ab77 info 81 0 qemu-system-x86-11521 [000] 4724.170199: kvm_page_fault: address = 3a029000 error_code 81 qemu-system-x86-11521 [000] 4724.170199: kvm_mmu_pagetable_walk: addr 3= a029000 pferr 0=20 qemu-system-x86-11521 [000] 4724.170199: kvm_mmu_paging_element: pte 3c= 04c007 level 4 qemu-system-x86-11521 [000] 4724.170199: kvm_mmu_paging_element: pte 3c= 04d007 level 3 qemu-system-x86-11521 [000] 4724.170199: kvm_mmu_paging_element: pte 3c= 21e007 level 2 qemu-system-x86-11521 [000] 4724.170200: kvm_mmu_paging_element: pte 3a= 029037 level 1 qemu-system-x86-11521 [000] 4724.170203: kvm_entry: vcpu 0 qemu-system-x86-11521 [000] 4724.170204: kvm_exit: reason E= PT_VIOLATION rip 0xffffffff8102ab77 info 181 0 qemu-system-x86-11521 [000] 4724.170204: kvm_page_fault: address = fed000f0 error_code 181 qemu-system-x86-11521 [000] 4724.170205: kvm_mmu_pagetable_walk: addr f= ed000f0 pferr 0=20 qemu-system-x86-11521 [000] 4724.170205: kvm_mmu_paging_element: pte 3c= 04c007 level 4 qemu-system-x86-11521 [000] 4724.170205: kvm_mmu_paging_element: pte 3c= 42f003 level 3 qemu-system-x86-11521 [000] 4724.170205: kvm_mmu_paging_element: pte 3c= 626003 level 2 qemu-system-x86-11521 [000] 4724.170206: kvm_mmu_paging_element: pte fe= d00033 level 1 qemu-system-x86-11521 [000] 4724.170213: mark_mmio_spte: sptep:0x= ffff88014e8ad800 gfn fed00 access 6 gen b7f qemu-system-x86-11521 [000] 4724.170214: kvm_mmu_pagetable_walk: addr f= fffffff8102ab77 pferr 10 F qemu-system-x86-11521 [000] 4724.170215: kvm_mmu_pagetable_walk: addr 1= 710000 pferr 6 W|U qemu-system-x86-11521 [000] 4724.170215: kvm_mmu_paging_element: pte 3c= 04c007 level 4 qemu-system-x86-11521 [000] 4724.170215: kvm_mmu_paging_element: pte 3c= 04d007 level 3 qemu-system-x86-11521 [000] 4724.170216: kvm_mmu_paging_element: pte 3c= 059007 level 2 qemu-system-x86-11521 [000] 4724.170216: kvm_mmu_paging_element: pte 17= 10037 level 1 qemu-system-x86-11521 [000] 4724.170216: kvm_mmu_paging_element: pte 17= 11067 level 4 qemu-system-x86-11521 [000] 4724.170216: kvm_mmu_walker_error: pferr 19= P|RSVD|F qemu-system-x86-11521 [000] 4724.170217: kvm_emulate_insn: 0:ffffff= ff8102ab77:=20 qemu-system-x86-11521 [000] 4724.170217: kvm_mmu_pagetable_walk: addr f= ed000f0 pferr 2 W qemu-system-x86-11521 [000] 4724.170217: kvm_mmu_pagetable_walk: addr 1= 710000 pferr 6 W|U qemu-system-x86-11521 [000] 4724.170217: kvm_mmu_paging_element: pte 3c= 04c007 level 4 qemu-system-x86-11521 [000] 4724.170217: kvm_mmu_paging_element: pte 3c= 04d007 level 3 qemu-system-x86-11521 [000] 4724.170218: kvm_mmu_paging_element: pte 3c= 059007 level 2 qemu-system-x86-11521 [000] 4724.170218: kvm_mmu_paging_element: pte 17= 10037 level 1 qemu-system-x86-11521 [000] 4724.170218: kvm_mmu_paging_element: pte 0 = level 4 qemu-system-x86-11521 [000] 4724.170218: kvm_mmu_walker_error: pferr 2 = W qemu-system-x86-11521 [000] 4724.170219: kvm_entry: vcpu 0 qemu-system-x86-11521 [000] 4724.170220: kvm_exit: reason E= PT_MISCONFIG rip 0xffffffff8102ab77 info 0 0 qemu-system-x86-11521 [000] 4724.170221: kvm_mmu_pagetable_walk: addr f= fffffff8102ab77 pferr 10 F qemu-system-x86-11521 [000] 4724.170221: kvm_mmu_pagetable_walk: addr 1= 710000 pferr 6 W|U qemu-system-x86-11521 [000] 4724.170222: kvm_mmu_paging_element: pte 3c= 04c007 level 4 qemu-system-x86-11521 [000] 4724.170222: kvm_mmu_paging_element: pte 3c= 04d007 level 3 qemu-system-x86-11521 [000] 4724.170222: kvm_mmu_paging_element: pte 3c= 059007 level 2 qemu-system-x86-11521 [000] 4724.170222: kvm_mmu_paging_element: pte 17= 10037 level 1 qemu-system-x86-11521 [000] 4724.170223: kvm_mmu_paging_element: pte 17= 11067 level 4 qemu-system-x86-11521 [000] 4724.170223: kvm_mmu_walker_error: pferr 19= P|RSVD|F qemu-system-x86-11521 [000] 4724.170223: kvm_emulate_insn: 0:ffffff= ff8102ab77:=20 The L1 code runs fine as L0 (ie. natively) on the same hardware. Jan --CJhqKqTDXEjhJ32hpVnoE5CAWv0TdI5cX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlH+b9IACgkQitSsb3rl5xQmawCfc8CsYQZ95mF5Qx/siSJ+luJg I+EAnRtZAuddWrepu+NYeUThbSBhbii8 =kWL2 -----END PGP SIGNATURE----- --CJhqKqTDXEjhJ32hpVnoE5CAWv0TdI5cX--