summaryrefslogtreecommitdiffstats
path: root/runtime/print.c
diff options
context:
space:
mode:
authorhiramatu <hiramatu>2007-11-09 18:12:06 +0000
committerhiramatu <hiramatu>2007-11-09 18:12:06 +0000
commit185457afd0b9b00f835e2bedcd6801aae432b699 (patch)
tree667dc956901aa44b59cd87adc4ad688a71b3cdfb /runtime/print.c
parentbba416fe7a5eb25ed7c517d076185ce4cfaf6fbd (diff)
downloadsystemtap-steved-185457afd0b9b00f835e2bedcd6801aae432b699.tar.gz
systemtap-steved-185457afd0b9b00f835e2bedcd6801aae432b699.tar.xz
systemtap-steved-185457afd0b9b00f835e2bedcd6801aae432b699.zip
2007-11-09 Masami Hiramatsu <mhiramat@redhat.com>
PR3858 * print.c: Add -DRELAY_HOST=<hostname> and -DRELAY_GUEST=<hostname> options support. (_stp_print_flush): Disable irqs if -DRELAY_* option is specified. * print_old.c: Export stp_print_flush to other modules if the -DRELAY_HOST option is specified. * print_new.c: Ditto. * transport.c (_stp_transport_init): Reduce relay buffer size to 64KB*2 if -DRELAY_GUEST is specified. * systemtap.printf/sharedbuf.exp: New test for buffer sharing option. * systemtap.printf/sharedbuf.stp: Ditto. * systemtap.printf/hello.stp: Ditto. * systemtap.printf/hello2.stp: Ditto.
Diffstat (limited to 'runtime/print.c')
-rw-r--r--runtime/print.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/runtime/print.c b/runtime/print.c
index c100bbfe..326d67d5 100644
--- a/runtime/print.c
+++ b/runtime/print.c
@@ -72,6 +72,21 @@ void _stp_print_cleanup (void)
free_percpu(Stp_lbuf);
}
+#define __DEF_EXPORT_FN(fn, postfix) fn ## _ ## postfix
+#define DEF_EXPORT_FN(fn, postfix) __DEF_EXPORT_FN(fn, postfix)
+
+#if defined(RELAY_GUEST)
+#if defined(RELAY_HOST)
+ #error "Cannot specify both RELAY_HOST and RELAY_GUEST"
+#endif
+#define EXPORT_FN(fn) DEF_EXPORT_FN(fn, RELAY_GUEST)
+#elif defined(RELAY_HOST)
+#define EXPORT_FN(fn) DEF_EXPORT_FN(fn, RELAY_HOST)
+#else /* defined(RELAY_GUEST) || defined(RELAY_HOST) */
+#define EXPORT_FN(fn) fn
+#endif
+
+#if !defined(RELAY_GUEST)
/* The relayfs API changed between 2.6.15 and 2.6.16. */
/* Use the appropriate print flush function. */
@@ -80,6 +95,26 @@ void _stp_print_cleanup (void)
#else
#include "print_new.c"
#endif
+#if defined(RELAY_HOST)
+EXPORT_SYMBOL_GPL(EXPORT_FN(stp_print_flush));
+#endif
+
+#endif /*!RELAY_GUEST*/
+
+#if defined(RELAY_GUEST) || defined(RELAY_HOST)
+/* Prohibit irqs to avoid racing on a relayfs */
+extern void EXPORT_FN(stp_print_flush) (_stp_pbuf *);
+static inline void _stp_print_flush(void)
+{
+ unsigned long flags;
+ local_irq_save(flags);
+ EXPORT_FN(stp_print_flush) (per_cpu_ptr(Stp_pbuf, smp_processor_id()));
+ local_irq_restore(flags);
+}
+#else
+#define _stp_print_flush() \
+ EXPORT_FN(stp_print_flush)(per_cpu_ptr(Stp_pbuf, smp_processor_id()))
+#endif
#ifndef STP_MAXBINARYARGS
#define STP_MAXBINARYARGS 127