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

[Xen-changelog] [xen master] xen: make tracebuffer configurable



commit 2c884d21cd72cc52a72cbfe071edb6a20d5c3d20
Author:     Baodong Chen <chenbaodong@xxxxxxxxxx>
AuthorDate: Wed Jul 17 15:35:22 2019 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jul 17 15:35:22 2019 +0200

    xen: make tracebuffer configurable
    
    Xen internal running status(trace event at pre-defined trace point)
    will be saved to trace memory when enabled.
    Trace event data and config params can be read/changed
    by system control hypercall at run time.
    
    Can be disabled for smaller code footprint.
    
    Signed-off-by: Baodong Chen <chenbaodong@xxxxxxxxxx>
    Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx> [tracing]
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/common/Kconfig      |  9 +++++++++
 xen/common/Makefile     |  2 +-
 xen/include/xen/trace.h | 26 ++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 4497224add..912630a4fb 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -357,4 +357,13 @@ config DOM0_MEM
 
          Leave empty if you are not sure what to specify.
 
+config TRACEBUFFER
+       bool "Enable tracing infrastructure" if EXPERT = "y"
+       default y
+       ---help---
+         Enable tracing infrastructure and pre-defined tracepoints within Xen.
+         This will allow live information about Xen?s execution and performance
+         to be collected at run time for debugging or performance analysis.
+         Memory and execution overhead when not active is minimal.
+
 endmenu
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 33d03b862f..eddda5daa6 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -55,7 +55,7 @@ obj-y += sysctl.o
 obj-y += tasklet.o
 obj-y += time.o
 obj-y += timer.o
-obj-y += trace.o
+obj-$(CONFIG_TRACEBUFFER) += trace.o
 obj-y += version.o
 obj-y += virtual_region.o
 obj-y += vm_event.o
diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h
index 12966eaa1d..fad92c784a 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -21,12 +21,18 @@
 #ifndef __XEN_TRACE_H__
 #define __XEN_TRACE_H__
 
+/* Put 'tb_init_done' here because 'asm/trace.h' may use it */
+#ifdef CONFIG_TRACEBUFFER
 extern int tb_init_done;
+#else
+#define tb_init_done false
+#endif
 
 #include <public/sysctl.h>
 #include <public/trace.h>
 #include <asm/trace.h>
 
+#ifdef CONFIG_TRACEBUFFER
 /* Used to initialise trace buffer functionality */
 void init_trace_bufs(void);
 
@@ -47,6 +53,26 @@ static inline void trace_var(u32 event, int cycles, int 
extra,
 void __trace_hypercall(uint32_t event, unsigned long op,
                        const xen_ulong_t *args);
 
+#else
+static inline void init_trace_bufs(void) {}
+static inline int tb_control(struct xen_sysctl_tbuf_op *tbc)
+{
+    return -ENOSYS;
+}
+
+static inline int trace_will_trace_event(uint32_t event)
+{
+    return 0;
+}
+
+static inline void trace_var(uint32_t event, int cycles, int extra,
+                             const void *extra_data) {}
+static inline void __trace_var(uint32_t event, bool cycles, unsigned int extra,
+                               const void *extra_data) {}
+static inline void __trace_hypercall(uint32_t event, unsigned long op,
+                                     const xen_ulong_t *args) {}
+#endif
+
 /* Convenience macros for calling the trace function. */
 #define TRACE_0D(_e)                            \
     do {                                        \
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
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®.