From nobody Sat Apr 27 05:21:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1590097506; cv=none; d=zohomail.com; s=zohoarc; b=HcZlDoGFfEiB1so4F+3XrVIaBTPi3Ug00Hp/lS7BRhAeW+9HprrcAO81qpFhQc3lovNpZNn1LGYzrugihHKYSaPQ1mv0iHRcr111YHSCrqikyV9FNWmZsAGbnhb+RtPLqvx3ZqrV+cbhhqZB41AmQP7dN5PGvGKkOZE/LjI/wTs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590097506; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=g1MJ8Lc25eidVt5ie9M2v3Q6zunrYD/srJMHA3XSEnY=; b=AyHMn25+5QS+6SQKOHMBpgFrJkgJCR67wapoY61553RzzhSkQfzyypEHktBEDjxvtMrF+NezLLKqX9ObvkAPE/rtnWGpaYJOPelJ2ksGutPzNMX2tN9Gy0OCI/SaT+jf0P4BxPmHW6t/Zpn59yWL8tCfKPpfHjr+IY1XooHqSs0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 15900975069153.0939270906479805; Thu, 21 May 2020 14:45:06 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jbszO-00066j-GA; Thu, 21 May 2020 21:44:30 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jbszN-00066e-6P for xen-devel@lists.xenproject.org; Thu, 21 May 2020 21:44:29 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3e7f85a6-9bac-11ea-b07b-bc764e2007e4; Thu, 21 May 2020 21:44:28 +0000 (UTC) X-Inumbo-ID: 3e7f85a6-9bac-11ea-b07b-bc764e2007e4 Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 08GFkIz6P4d/Td+27tImWBk/VaI65rsGnGEyI50VD17NIZbQKRIEoVJxmmvzUS3xVi87M7fYZH i67gKdKdsMK1t3ehwV4f4WSG09mW8II54YUmuLtKgJMVTVqRgdJshHYgyDwlJ0LcJNk7DRVF9y QvZaPbD+W7SUUoE7YIZ/r2dz/eNxzOVX444vsbDshAHYz31PaNUVEdIt7GSg1Fv/oMBZt9a3ke pLdfW6MUXzOjF+M4qsehEBTFS0/vx7+astlQHtt9YKUFN5R3bHiv8FsGioLSNFo8fQ2W6MPTfT HTg= X-SBRS: 2.7 X-MesageID: 18159679 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,419,1583211600"; d="scan'208";a="18159679" From: Igor Druzhinin To: Subject: [PATCH] x86/svm: retry after unhandled NPT fault if gfn was marked for recalculation Date: Thu, 21 May 2020 22:43:58 +0100 Message-ID: <1590097438-28829-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: andrew.cooper3@citrix.com, Igor Druzhinin , wl@xen.org, jbeulich@suse.com, roger.pau@citrix.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If a recalculation NPT fault hasn't been handled explicitly in hvm_hap_nested_page_fault() then it's potentially safe to retry - US bit has been re-instated in PTE and any real fault would be correctly re-raised next time. This covers a specific case of migration with vGPU assigned on AMD: global log-dirty is enabled and causes immediate recalculation NPT fault in MMIO area upon access. This type of fault isn't described explicitly in hvm_hap_nested_page_fault (this isn't called on EPT misconfig exit on Intel) which results in domain crash. Signed-off-by: Igor Druzhinin --- xen/arch/x86/hvm/svm/svm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 46a1aac..f0d0bd3 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1726,6 +1726,10 @@ static void svm_do_nested_pgfault(struct vcpu *v, /* inject #VMEXIT(NPF) into guest. */ nestedsvm_vmexit_defer(v, VMEXIT_NPF, pfec, gpa); return; + case 0: + /* If a recalculation page fault hasn't been handled - just retry.= */ + if ( pfec & PFEC_user_mode ) + return; } =20 /* Everything else is an error. */ --=20 2.7.4