Skip to contentSkip to conversation

Allow building with perfc and perfc_arrays

PATCH In review Ben Thomas 2 participants 4 messages Feb 16, 2006

lore
Share & tools
lore

Ben Thomas

author
#0 lore raw

PATCH 1/1 Allow building with perfc and perfc_arrays

Attempts to build with either perfc or perfc_arrays fails. Some of this is specific to the platform (eg, __x86_64__). Add simple-minded fixes to allow building with these options.

This patch resolves these issues and now builds on i386 and x86_64

# HG changeset patch
# Node ID 3a3b034fde8c6644465b1a9d4135142a75740a34 # Parent 1ca3d63e70082c57dd918b0875d28ad679f842a2

building with perfc fails -> simple fix
building with perfc and perfc_arrays on x86_64 fails -> do the
simple-minded thing and just add the missing elements

xen/common/perfc.c +1 -1
diff -r 1ca3d63e7008 -r 3a3b034fde8c xen/common/perfc.c
@@ -144,7 +144,7 @@ static int perfc_copy_info(dom0_perfc_de
     {
         for ( i = 0; i < NR_PERFCTRS; i++ )
         {
-            strncpy(perfc_d[i].name, perfc_info[i].name,
+            strncpy((char *)perfc_d[i].name, perfc_info[i].name,
                     sizeof(perfc_d[i].name));
             perfc_d[i].name[sizeof(perfc_d[i].name)-1] = '\0';
 
xen/include/xen/perfc_defn.h +22 -0
diff -r 1ca3d63e7008 -r 3a3b034fde8c xen/include/xen/perfc_defn.h
@@ -125,4 +125,26 @@ PERFCOUNTER_CPU(remove_write_bad_predict
 PERFCOUNTER_CPU(remove_write_bad_prediction, "remove_write bad prediction")
 PERFCOUNTER_CPU(update_hl2e_invlpg,     "update_hl2e calls invlpg")
 
+/* perfc */
+
+#ifdef __x86_64__
+PERFCOUNTER_CPU(validate_entry_changes,  "validate_entry_changes")
+PERFCOUNTER_CPU(shadow_l3_pages,         "shadow_l3_pages")
+PERFCOUNTER_CPU(shadow_l4_pages,         "shadow_l4_pages")
+PERFCOUNTER_CPU(shadow_set_l2e_force_map,"shadow_set_l3e_force_map")
+PERFCOUNTER_CPU(shadow_set_l3e_force_map,"shadow_set_l3e_force_map")
+PERFCOUNTER_CPU(resync_l3,		 "resync_l3")
+PERFCOUNTER_CPU(resync_l4,		 "resync_l4")
+PERFCOUNTER_CPU(shadow_l3_table_count,	 "shadow_l3_table_count")
+PERFCOUNTER_CPU(shadow_l4_table_count,	 "shadow_l4_table_count")
+PERFCOUNTER_CPU(apshot_pages,            "apshot_pages")
+
+/* perfc_arrays */
+
+PERFCOUNTER_ARRAY(shm_l3_updates,          "shm_l3_updates",
+                  PERFC_MAX_PT_UPDATES)
+PERFCOUNTER_ARRAY(shm_l4_updates,          "shm_l4_updates",
+                  PERFC_MAX_PT_UPDATES)
+#endif /* x86_64 */
+
 /*#endif*/ /* __XEN_PERFC_DEFN_H__ */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 5 lines · * Ben Thomas ([email protected]) wrote:

Attempts to build with either perfc or perfc_arrays fails. Some of this is specific to the platform (eg, __x86_64__). Add simple-minded fixes to allow building with these options.

This patch resolves these issues and now builds on i386 and x86_64

I was just doing similar. Only real difference I had was just using char in the dom0_perfc_desc instead of the char* cast.

typedef struct dom0_perfc_desc {

-    uint8_t      name[80];             /* name of perf counter */
+    char         name[80];             /* name of perf counter */

And a typo fix, which you accidentally propagate.

+PERFCOUNTER_CPU(apshot_pages, "apshot_pages")

I had simply done:

- perfc_decr(apshot_pages);
+ perfc_decr(snapshot_pages);

Accidental conversion to percpu counter of a couple of these. And, finally, this isn't quite enough for PAE.

Here's my patch, mind taking a double check?

thanks,
-chris
--

Fix Xen builds with perfc=y and perfc_arrays=y.

---

xen/arch/x86/shadow_public.c +1 -1
diff -r 2b0078f771cc xen/arch/x86/shadow_public.c
@@ -672,7 +672,7 @@ void free_shadow_page(unsigned long smfn
         break;
 #endif
     case PGT_snapshot:
-        perfc_decr(apshot_pages);
+        perfc_decr(snapshot_pages);
         break;
 
     default:
xen/include/public/dom0_ops.h +1 -1
diff -r 2b0078f771cc xen/include/public/dom0_ops.h
@@ -311,7 +311,7 @@ typedef struct dom0_read_memtype {
 #define DOM0_PERFCCONTROL_OP_RESET 1   /* Reset all counters to zero. */
 #define DOM0_PERFCCONTROL_OP_QUERY 2   /* Get perfctr information. */
 typedef struct dom0_perfc_desc {
-    uint8_t      name[80];             /* name of perf counter */
+    char         name[80];             /* name of perf counter */
     uint32_t     nr_vals;              /* number of values for this counter */
     uint32_t     vals[64];             /* array of values */
 } dom0_perfc_desc_t;
xen/include/xen/perfc_defn.h +25 -0
diff -r 2b0078f771cc xen/include/xen/perfc_defn.h
@@ -14,6 +14,12 @@ PERFCOUNTER_ARRAY(shm_l2_updates,       
                   PERFC_MAX_PT_UPDATES)
 PERFCOUNTER_ARRAY(shm_hl2_updates,      "shadow mode HL2 pt updates",
                   PERFC_MAX_PT_UPDATES)
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
+PERFCOUNTER_ARRAY(shm_l3_updates,       "shadow mode L3 pt updates",
+                  PERFC_MAX_PT_UPDATES)
+PERFCOUNTER_ARRAY(shm_l4_updates,       "shadow mode L4 pt updates",
+                  PERFC_MAX_PT_UPDATES)
+#endif
 PERFCOUNTER_ARRAY(snapshot_copies,      "entries copied per snapshot",
                   PERFC_MAX_PT_UPDATES)
 
@@ -60,6 +66,10 @@ PERFCOUNTER_CPU(map_domain_page_count,  
 PERFCOUNTER_CPU(map_domain_page_count,  "map_domain_page count")
 PERFCOUNTER_CPU(ptwr_emulations,        "writable pt emulations")
 
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
+PERFCOUNTER_CPU(shadow_l4_table_count,  "shadow_l4_table count")
+PERFCOUNTER_CPU(shadow_l3_table_count,  "shadow_l3_table count")
+#endif
 PERFCOUNTER_CPU(shadow_l2_table_count,  "shadow_l2_table count")
 PERFCOUNTER_CPU(shadow_l1_table_count,  "shadow_l1_table count")
 PERFCOUNTER_CPU(unshadow_table_count,   "unshadow_table count")
@@ -68,6 +78,10 @@ PERFCOUNTER_CPU(shadow_update_va_fail2, 
 PERFCOUNTER_CPU(shadow_update_va_fail2, "shadow_update_va_fail2")
 
 /* STATUS counters do not reset when 'P' is hit */
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
+PERFSTATUS(shadow_l4_pages,             "current # shadow L4 pages")
+PERFSTATUS(shadow_l3_pages,             "current # shadow L3 pages")
+#endif
 PERFSTATUS(shadow_l2_pages,             "current # shadow L2 pages")
 PERFSTATUS(shadow_l1_pages,             "current # shadow L1 pages")
 PERFSTATUS(hl2_table_pages,             "current # hl2 pages")
@@ -82,6 +96,10 @@ PERFCOUNTER_CPU(shadow_set_l1e_force_map
 PERFCOUNTER_CPU(shadow_set_l1e_force_map, "shadow_set_l1e forced to map l1")
 PERFCOUNTER_CPU(shadow_set_l1e_unlinked, "shadow_set_l1e found unlinked l1")
 PERFCOUNTER_CPU(shadow_set_l1e_fail,    "shadow_set_l1e failed (no sl1)")
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
+PERFCOUNTER_CPU(shadow_set_l2e_force_map, "shadow_set_l2e forced to map l2")
+PERFCOUNTER_CPU(shadow_set_l3e_force_map, "shadow_set_l3e forced to map l3")
+#endif
 PERFCOUNTER_CPU(shadow_invlpg_faults,   "shadow_invlpg's get_user faulted")
 PERFCOUNTER_CPU(unshadow_l2_count,      "unpinned L2 count")
 
@@ -95,6 +113,10 @@ PERFCOUNTER_CPU(shadow_sync_va,         
 PERFCOUNTER_CPU(shadow_sync_va,         "calls to shadow_sync_va")
 PERFCOUNTER_CPU(resync_l1,              "resync L1 page")
 PERFCOUNTER_CPU(resync_l2,              "resync L2 page")
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
+PERFCOUNTER_CPU(resync_l3,              "resync L3 page")
+PERFCOUNTER_CPU(resync_l4,              "resync L4 page")
+#endif
 PERFCOUNTER_CPU(resync_hl2,             "resync HL2 page")
 PERFCOUNTER_CPU(shadow_make_snapshot,   "snapshots created")
 PERFCOUNTER_CPU(shadow_mark_mfn_out_of_sync_calls,
@@ -113,6 +135,9 @@ PERFCOUNTER_CPU(shadow_get_page_fail,   
 PERFCOUNTER_CPU(shadow_get_page_fail,   "shadow_get_page_from_l1e fails")
 PERFCOUNTER_CPU(validate_hl2e_calls,    "calls to validate_hl2e_change")
 PERFCOUNTER_CPU(validate_hl2e_changes,  "validate_hl2e makes changes")
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
+PERFCOUNTER_CPU(validate_entry_changes,  "validate_entry changes")
+#endif
 PERFCOUNTER_CPU(exception_fixed,        "pre-exception fixed")
 PERFCOUNTER_CPU(get_mfn_from_gpfn_foreign, "calls to get_mfn_from_gpfn_foreign")
 PERFCOUNTER_CPU(remove_all_access,      "calls to remove_all_access")
author
#2 lore raw

Hi,

Well, I did use the phrase "simple-minded". It seemed like adequate warning. ;-)

My goal was to get it compiling and out of my way so that I could work on something else. This was purely annoying and I spent very little time on it. Then, once I got it compiling, the guilt-gene kicked in and I thought I should submit the changes.

Your changes are more complete, and I like them better.

(Now, if I could manage to spend the time to package up other
changes that I've made ...)

Thanks,
-b

Quoted 32 lines · Chris Wright
Quoted 5 lines · * Ben Thomas ([email protected]) wrote:

Attempts to build with either perfc or perfc_arrays fails. Some of this is specific to the platform (eg, __x86_64__). Add simple-minded fixes to allow building with these options.

This patch resolves these issues and now builds on i386 and x86_64

I was just doing similar. Only real difference I had was just using char in the dom0_perfc_desc instead of the char* cast.

typedef struct dom0_perfc_desc {

xen/include/public/dom0_ops.h +1 -1
-    uint8_t      name[80];             /* name of perf counter */
+    char         name[80];             /* name of perf counter */

And a typo fix, which you accidentally propagate.

+PERFCOUNTER_CPU(apshot_pages, "apshot_pages")

I had simply done:

xen/arch/x86/shadow_public.c +1 -1
-        perfc_decr(apshot_pages);
+        perfc_decr(snapshot_pages);

Accidental conversion to percpu counter of a couple of these. And, finally, this isn't quite enough for PAE.

Here's my patch, mind taking a double check?

thanks,
-chris

#3 lore raw
Quoted 2 lines · * Ben Thomas ([email protected]) wrote:

Well, I did use the phrase "simple-minded". It seemed like adequate warning. ;-)

Heh ;-)