xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/svm: retry after unhandled NPT fault if gfn was marked for recalculation
@ 2020-05-21 21:43 Igor Druzhinin
  2020-05-22  0:26 ` Igor Druzhinin
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Igor Druzhinin @ 2020-05-21 21:43 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, Igor Druzhinin, wl, jbeulich, roger.pau

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@citrix.com>
---
 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;
     }
 
     /* Everything else is an error. */
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-05-22 15:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 21:43 [PATCH] x86/svm: retry after unhandled NPT fault if gfn was marked for recalculation Igor Druzhinin
2020-05-22  0:26 ` Igor Druzhinin
2020-05-22  9:45 ` Andrew Cooper
2020-05-22 10:05   ` Igor Druzhinin
2020-05-22 10:19     ` Andrew Cooper
2020-05-22 10:25       ` Igor Druzhinin
2020-05-22 13:34       ` Jan Beulich
2020-05-22 10:08 ` Roger Pau Monné
2020-05-22 10:14   ` Igor Druzhinin
2020-05-22 10:23     ` Roger Pau Monné
2020-05-22 10:27       ` Igor Druzhinin
2020-05-22 11:11         ` Roger Pau Monné
2020-05-22 13:04           ` Jan Beulich
2020-05-22 13:11             ` Andrew Cooper
2020-05-22 13:32               ` Roger Pau Monné
2020-05-22 15:53                 ` Andrew Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).