Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751255AbdINEB7 (ORCPT ); Thu, 14 Sep 2017 00:01:59 -0400 Received: from mga03.intel.com ([134.134.136.65]:46779 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750740AbdINEB5 (ORCPT ); Thu, 14 Sep 2017 00:01:57 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,390,1500966000"; d="asc'?scan'208";a="1194901934" Date: Thu, 14 Sep 2017 11:55:43 +0800 From: "Du, Changbin" To: Radim =?utf-8?B?S3LEjW3DocWZ?= Cc: changbin.du@intel.com, pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RESEND][PATCH] kvm: x86: Do not handle MMIO request in fast_page_fault Message-ID: <20170914035543.GA32034@intel.com> References: <1504607862-8497-1-git-send-email-changbin.du@intel.com> <20170913143955.GB2673@flask> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="r5Pyd7+fXNt84Ff3" Content-Disposition: inline In-Reply-To: <20170913143955.GB2673@flask> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2821 Lines: 87 --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 13, 2017 at 04:39:56PM +0200, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > 2017-09-05 18:37+0800, changbin.du@intel.com: > > From: Changbin Du > >=20 > > If it is a MMIO request, it should be handled by slow path. This patch > > actually fixed below warning when mmu debug is enabled. > >=20 > > WARNING: CPU: 5 PID: 2282 at arch/x86/kvm/mmu.c:226 fast_page_fault+0x4= 1b/0x520 > > CPU: 5 PID: 2282 Comm: qemu-system-x86 Not tainted 4.13.0-rc6+ #34 > > task: ffff9b47f5286000 task.stack: ffffb18d03b28000 > > RIP: 0010:fast_page_fault+0x41b/0x520 > > Call Trace: > > tdp_page_fault+0xfb/0x290 > > kvm_mmu_page_fault+0x61/0x120 > > handle_ept_misconfig+0x1ba/0x1c0 > > vmx_handle_exit+0xb8/0xd70 > > ? kvm_arch_vcpu_ioctl_run+0x9b6/0x18e0 > > kvm_arch_vcpu_ioctl_run+0xa5a/0x18e0 > > ? kvm_arch_vcpu_load+0x62/0x230 > > kvm_vcpu_ioctl+0x340/0x6c0 > > ? kvm_vcpu_ioctl+0x340/0x6c0 > > ? lock_acquire+0xf5/0x1f0 > > do_vfs_ioctl+0xa2/0x670 > > ? __fget+0x107/0x200 > > SyS_ioctl+0x79/0x90 > > entry_SYSCALL_64_fastpath+0x23/0xc2 > >=20 > > Signed-off-by: Changbin Du > > --- > > arch/x86/kvm/mmu.c | 3 +++ > > 1 file changed, 3 insertions(+) > >=20 > > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > > index 9d3f275..63c3360 100644 > > --- a/arch/x86/kvm/mmu.c > > +++ b/arch/x86/kvm/mmu.c > > @@ -3180,6 +3180,9 @@ static bool fast_page_fault(struct kvm_vcpu *vcpu= , gva_t gva, int level, > > iterator.level < level) > > break; > > =20 > > + if (is_mmio_spte(spte)) > > + break; >=20 > Hm, handle_ept_misconfig() calls kvm_mmu_page_fault with error_code =3D > PFERR_RSVD_MASK. This error_code gets propagated and checked at the > beginning of page_fault_can_be_fast(), where it should break the > function execution. >=20 > How did the execution get all the way to the loop? >=20 hmm, a recent Paolo's cleanup patch already fixed it. e08d26f ("KVM: x86: simplify ept_misconfig") In the past, PFERR_RSVD_MASK is not set. So this patch doesnt need any more. thanks. > Thanks. --=20 Thanks, Changbin Du --r5Pyd7+fXNt84Ff3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJZuf2/AAoJEAanuZwLnPNUwU4H/ibDJEgvp4Kzd38GuQypdYYG e36cPFzlVvd/S3KGEeIcBp6MkbXO9RyqAIL+v0Jo1n7HqdNN1zWqPuUcTgqWTdiw 55qSiIavTPrMB9/XAsLqYpcJ0hkciT/XU8plwAXR3OKJjBzzcQStDmqUGKchI+Be l5RnJDiq5XvKJdSzfpJeeRwRJ2QLqKXTmsjwC4G3ucILf+3d5SgY2kVQvwZFDYJ3 jl57P2k0SMAgrvIkMqdV7ea5rdTvLmXaaIgp6FjIhhEQWiVYdgXLMmYQZ3nER+Li Pb0dL5J1cUbpGxdPJxUAn+OQR25XPDznQWD2bdgiruC5lgHQpQg50RYi1zPv+s0= =qKlh -----END PGP SIGNATURE----- --r5Pyd7+fXNt84Ff3--