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

[Xen-changelog] [xen staging] SVM: make nested page-fault tracing and logging consistent



commit 65a510fe5157817f3f8fb6acbb1d7786e7a8a701
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Mar 12 14:36:56 2019 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Mar 12 14:36:56 2019 +0100

    SVM: make nested page-fault tracing and logging consistent
    
    Don't call __get_gfn_type_access() more than once, to make sure data
    recorded for xentrace matches up with what gets logged in case of the
    domain getting crashed.
    
    As a side effect this also eliminates a type mismatch reported by
    Norbert Manthey, as the first call now also needs to update the local
    variable "p2mt".
    
    Do a few cosmetics at the same time: Move a comment up a little, drop
    the pointless "case 0" (seeing in particular the comment's wording),
    and correct formatting.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 23d72e81e3..fec9be3ae0 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1797,17 +1797,18 @@ static void svm_do_nested_pgfault(struct vcpu *v,
         } _d;
 
         p2m = p2m_get_p2m(v);
+        mfn = __get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, 0, NULL, 0);
+
         _d.gpa = gpa;
         _d.qualification = 0;
-        mfn = __get_gfn_type_access(p2m, gfn, &_d.p2mt, &p2ma, 0, NULL, 0);
         _d.mfn = mfn_x(mfn);
+        _d.p2mt = p2mt;
         
         __trace_var(TRC_HVM_NPF, 0, sizeof(_d), &_d);
     }
 
-    switch (ret) {
-    case 0:
-        break;
+    switch ( ret )
+    {
     case 1:
         return;
     case -1:
@@ -1817,10 +1818,12 @@ static void svm_do_nested_pgfault(struct vcpu *v,
         return;
     }
 
+    /* Everything else is an error. */
     if ( p2m == NULL )
+    {
         p2m = p2m_get_p2m(v);
-    /* Everything else is an error. */
-    mfn = __get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, 0, NULL, 0);
+        mfn = __get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, 0, NULL, 0);
+    }
     gdprintk(XENLOG_ERR,
          "SVM violation gpa %#"PRIpaddr", mfn %#lx, type %i\n",
          gpa, mfn_x(mfn), p2mt);
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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