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

[Xen-devel] [PATCH 02 of 12] xenalyze: Reorganize cr trace handling



Reorganize the CR trace handling to take advantage of the
new summary handling. In particular, SVM has an exit per
CR register, while VMX has one exit for all CR accesses.
This allows them to coexist.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

diff -r 2e85d4c4042e -r 6650e492be5d xenalyze.c
--- a/xenalyze.c        Mon Nov 28 16:16:23 2011 +0000
+++ b/xenalyze.c        Mon Nov 28 16:16:23 2011 +0000
@@ -4104,7 +4104,7 @@ void cr3_dump_list(struct cr3_value_stru
     free(qsort_array);
 }
 
-void hvm_cr3_write_summary(struct hvm_data *h, void *data) {
+void hvm_cr3_write_summary(struct hvm_data *h) {
     int j;
 
     for(j=0; j<RESYNCS_MAX; j++)
@@ -4116,18 +4116,12 @@ void hvm_cr3_write_summary(struct hvm_da
 
 void hvm_cr_write_summary(struct hvm_data *h, void *data)
 {
-    int i;
-
-    for(i=0; i<CR_MAX; i++)
-    {
-        PRINT_SUMMARY(h->summary.cr_write[i],
-                      "   cr%d ", i);
-        switch(i) {
-        case 3:
-            hvm_cr3_write_summary(h, NULL);
-            break;
-        }
-    }
+    int cr=(int)data;
+
+    PRINT_SUMMARY(h->summary.cr_write[cr],
+                  "   cr%d ", cr);
+    if ( cr==3 )
+        hvm_cr3_write_summary(h);
 }
 
 void hvm_cr_write_postprocess(struct hvm_data *h)
@@ -4208,20 +4202,39 @@ void hvm_cr_write_postprocess(struct hvm
     /* FIXME - deal with cr_read_summary */
     if(h->exit_reason < h->exit_reason_max)
     {
-        if ( opt.svm_mode ) {
-            /* For svm, only need a summary for cr3 */
-            if ( h->exit_reason == VMEXIT_CR3_WRITE )
-                hvm_set_summary_handler(h, hvm_cr3_write_summary, NULL);
-        } else {
-            /* For vmx, real mode may cause EXNMI exits on cr accesses */
-            if ( h->exit_reason !=  EXIT_REASON_EXCEPTION_NMI )
-                hvm_set_summary_handler(h, hvm_cr_write_summary, NULL);
+        /* Want a different "set" for each cr */
+        switch(h->inflight.cr_write.cr)
+        {
+#define case_cr(_x)                                                     \
+            case (_x):                                                  \
+                hvm_set_summary_handler(h, hvm_cr_write_summary, (void 
*)(_x)); \
+                break                              
+            case_cr(0);
+            case_cr(1);
+            case_cr(2);
+            case_cr(3);
+            case_cr(4);
+            case_cr(5);
+            case_cr(6);
+            case_cr(7);
+            case_cr(8);
+            case_cr(9);
+            case_cr(10);
+            case_cr(11);
+            case_cr(12);
+            case_cr(13);
+            case_cr(14);
+            case_cr(15);
+#undef case_cr
+        default:
+            fprintf(stderr, "Unexpected cr: %d\n", h->inflight.cr_write.cr);
+            error(ERR_SANITY, NULL);
+            break;
         }
     }
 }
 
 void hvm_exception_nmi_generic_postprocess(struct hvm_data *h);
-
 void hvm_cr_write_process(struct record_info *ri, struct hvm_data *h)
 {
     union {

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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