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

[Xen-devel] [PATCH] xen: make tracebuffer configurable



Default: enabled.
Can be disabled for smaller code footprint.

Signed-off-by: Baodong Chen <chenbaodong@xxxxxxxxxx>
---
 xen/common/Kconfig      |  6 ++++++
 xen/common/Makefile     |  2 +-
 xen/include/xen/trace.h | 18 +++++++++++++++++-
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index c838506..3a6eec8 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -368,4 +368,10 @@ config DOM0_MEM
 
          Leave empty if you are not sure what to specify.
 
+config HAS_TRACEBUFFER
+       bool "Enable/Disable tracebuffer"
+       default y
+       ---help---
+         Enable or disable tracebuffer function.
+
 endmenu
diff --git a/xen/common/Makefile b/xen/common/Makefile
index bca48e6..86c5bf9 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -56,7 +56,7 @@ obj-y += sysctl.o
 obj-y += tasklet.o
 obj-y += time.o
 obj-y += timer.o
-obj-y += trace.o
+obj-$(CONFIG_HAS_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 12966ea..fb1a2bc 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -21,12 +21,14 @@
 #ifndef __XEN_TRACE_H__
 #define __XEN_TRACE_H__
 
-extern int tb_init_done;
 
 #include <public/sysctl.h>
 #include <public/trace.h>
 #include <asm/trace.h>
 
+#ifdef CONFIG_HAS_TRACEBUFFER
+
+extern int tb_init_done;
 /* Used to initialise trace buffer functionality */
 void init_trace_bufs(void);
 
@@ -47,6 +49,20 @@ 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
+#define tb_init_done (0)
+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(u32 event) { return 0; }
+static inline void trace_var(u32 event, int cycles, int extra,
+                             const void *extra_data) {}
+static inline void __trace_var(u32 event, bool_t 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 {                                        \
-- 
2.7.4


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