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

[Xen-devel] [PATCH 2/3] xen/trace: Implement TRACE_?D() in a more efficient fashon



These can easily be expressed with a variadic macro. No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Interestingly, this results in fractionally different (but equally correct)
code generation in vlapic_update_timer().  Everywhere else is identical.
---
 xen/include/xen/trace.h | 99 +++++++++++++------------------------------------
 1 file changed, 26 insertions(+), 73 deletions(-)

diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h
index e6a4ef93cc..7f5a904103 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -81,80 +81,33 @@ static inline void __trace_hypercall(uint32_t event, 
unsigned long op,
     do {                                        \
         trace_var(_e, 1, 0, NULL);              \
     } while ( 0 )
-  
-#define TRACE_1D(_e,d1)                                         \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[1];                                          \
-            _d[0] = d1;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
- 
-#define TRACE_2D(_e,d1,d2)                                      \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[2];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
- 
-#define TRACE_3D(_e,d1,d2,d3)                                   \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[3];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            _d[2] = d3;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
- 
-#define TRACE_4D(_e,d1,d2,d3,d4)                                \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[4];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            _d[2] = d3;                                         \
-            _d[3] = d4;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
- 
-#define TRACE_5D(_e,d1,d2,d3,d4,d5)                             \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[5];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            _d[2] = d3;                                         \
-            _d[3] = d4;                                         \
-            _d[4] = d5;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
-    } while ( 0 )
 
-#define TRACE_6D(_e,d1,d2,d3,d4,d5,d6)                             \
-    do {                                                        \
-        if ( unlikely(tb_init_done) )                           \
-        {                                                       \
-            u32 _d[6];                                          \
-            _d[0] = d1;                                         \
-            _d[1] = d2;                                         \
-            _d[2] = d3;                                         \
-            _d[3] = d4;                                         \
-            _d[4] = d5;                                         \
-            _d[5] = d6;                                         \
-            __trace_var(_e, 1, sizeof(_d), _d);                 \
-        }                                                       \
+/* Common helper for TRACE_{1..6}D() below. */
+#define TRACE_varD(_e, ...)                             \
+    do {                                                \
+        if ( unlikely(tb_init_done) )                   \
+        {                                               \
+            uint32_t _d[] = { __VA_ARGS__ };            \
+            __trace_var(_e, true, sizeof(_d), _d);      \
+        }                                               \
     } while ( 0 )
 
+#define TRACE_1D(_e, d1) \
+    TRACE_varD(_e, d1)
+
+#define TRACE_2D(_e, d1, d2) \
+    TRACE_varD(_e, d1, d2)
+
+#define TRACE_3D(_e, d1, d2, d3) \
+    TRACE_varD(_e, d1, d2, d3)
+
+#define TRACE_4D(_e, d1, d2, d3, d4) \
+    TRACE_varD(_e, d1, d2, d3, d4)
+
+#define TRACE_5D(_e, d1, d2, d3, d4, d5) \
+    TRACE_varD(_e, d1, d2, d3, d4, d5)
+
+#define TRACE_6D(_e, d1, d2, d3, d4, d5, d6) \
+    TRACE_varD(_e, d1, d2, d3, d4, d5, d6)
+
 #endif /* __XEN_TRACE_H__ */
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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