[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/svm: retry after unhandled NPT fault if gfn was marked for recalculation

  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
  • Date: Thu, 21 May 2020 22:43:58 +0100
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: andrew.cooper3@xxxxxxxxxx, Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>, wl@xxxxxxx, jbeulich@xxxxxxxx, roger.pau@xxxxxxxxxx
  • Delivery-date: Thu, 21 May 2020 21:44:50 +0000
  • Ironport-sdr: 08GFkIz6P4d/Td+27tImWBk/VaI65rsGnGEyI50VD17NIZbQKRIEoVJxmmvzUS3xVi87M7fYZH i67gKdKdsMK1t3ehwV4f4WSG09mW8II54YUmuLtKgJMVTVqRgdJshHYgyDwlJ0LcJNk7DRVF9y QvZaPbD+W7SUUoE7YIZ/r2dz/eNxzOVX444vsbDshAHYz31PaNUVEdIt7GSg1Fv/oMBZt9a3ke pLdfW6MUXzOjF+M4qsehEBTFS0/vx7+astlQHtt9YKUFN5R3bHiv8FsGioLSNFo8fQ2W6MPTfT HTg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 <igor.druzhinin@xxxxxxxxxx>
 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);
+    case 0:
+        /* If a recalculation page fault hasn't been handled - just retry. */
+        if ( pfec & PFEC_user_mode )
+            return;
     /* Everything else is an error. */



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.