From 6cb88bc04f67ebc3264d3832f4ce5cca2c642ab4 Mon Sep 17 00:00:00 2001 From: Pierre-Marc Fournier Date: Mon, 30 Mar 2009 19:16:25 -0400 Subject: [PATCH] continue working on build system --- Makefile.am | 2 +- configure.ac | 2 +- hello/Makefile.am | 2 +- libust/marker.c | 39 +++++++++++++++++++++------------------ libust/serialize.c | 5 +++-- libust/tracepoint.c | 1 + libust/tracepoint.h | 5 +++-- libustcomm/ustcomm.c | 2 +- share/kernelcompat.h | 14 +++++++------- ustd/Makefile | 17 ----------------- ustd/Makefile.am | 9 +++++++++ ustd/ustd.c | 1 + 12 files changed, 49 insertions(+), 50 deletions(-) delete mode 100644 ustd/Makefile create mode 100644 ustd/Makefile.am diff --git a/Makefile.am b/Makefile.am index 996aedd..11e1843 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1 @@ -SUBDIRS = libust hello libmallocwrap +SUBDIRS = libust hello libmallocwrap ustd diff --git a/configure.ac b/configure.ac index 38d6b8b..075fe52 100644 --- a/configure.ac +++ b/configure.ac @@ -63,5 +63,5 @@ AC_SUBST(KCOMPAT_PATH) # ust/Makefile # ustd/Makefile]) -AC_CONFIG_FILES([Makefile libust/Makefile hello/Makefile libmallocwrap/Makefile]) +AC_CONFIG_FILES([Makefile libust/Makefile hello/Makefile libmallocwrap/Makefile ustd/Makefile]) AC_OUTPUT diff --git a/hello/Makefile.am b/hello/Makefile.am index 2a4e6b7..f682130 100644 --- a/hello/Makefile.am +++ b/hello/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = hello +noinst_PROGRAMS = hello hello_SOURCES = hello.c tp.c tp.h hello_LDADD = $(top_builddir)/libust/libust.la @URCU_PATH@/liburcu.so diff --git a/libust/marker.c b/libust/marker.c index e417b62..ade2d9c 100644 --- a/libust/marker.c +++ b/libust/marker.c @@ -36,6 +36,7 @@ #include "channels.h" #include "tracercore.h" #include "tracer.h" +#include "urcu.h" extern struct marker __start___markers[] __attribute__((visibility("hidden"))); extern struct marker __stop___markers[] __attribute__((visibility("hidden"))); @@ -501,8 +502,8 @@ static int remove_marker(const char *channel, const char *name) ret = ltt_channels_unregister(e->channel); WARN_ON(ret); /* Make sure the call_rcu has been executed */ - if (e->rcu_pending) - rcu_barrier_sched(); +//ust// if (e->rcu_pending) +//ust// rcu_barrier_sched(); kfree(e); return 0; } @@ -792,8 +793,8 @@ int marker_probe_register(const char *channel, const char *name, * If we detect that a call_rcu is pending for this marker, * make sure it's executed now. */ - if (entry->rcu_pending) - rcu_barrier_sched(); +//ust// if (entry->rcu_pending) +//ust// rcu_barrier_sched(); old = marker_entry_add_probe(entry, probe, probe_private); if (IS_ERR(old)) { ret = PTR_ERR(old); @@ -810,14 +811,14 @@ int marker_probe_register(const char *channel, const char *name, entry = get_marker(channel, name); if (!entry) goto end; - if (entry->rcu_pending) - rcu_barrier_sched(); +//ust// if (entry->rcu_pending) +//ust// rcu_barrier_sched(); entry->oldptr = old; entry->rcu_pending = 1; /* write rcu_pending before calling the RCU callback */ smp_wmb(); - call_rcu_sched(&entry->rcu, free_old_closure); - /*synchronize_rcu(); free_old_closure();*/ +//ust// call_rcu_sched(&entry->rcu, free_old_closure); + synchronize_rcu(); free_old_closure(&entry->rcu); goto end; error_unregister_channel: @@ -856,8 +857,8 @@ int marker_probe_unregister(const char *channel, const char *name, entry = get_marker(channel, name); if (!entry) goto end; - if (entry->rcu_pending) - rcu_barrier_sched(); +//ust// if (entry->rcu_pending) +//ust// rcu_barrier_sched(); old = marker_entry_remove_probe(entry, probe, probe_private); mutex_unlock(&markers_mutex); @@ -867,13 +868,14 @@ int marker_probe_unregister(const char *channel, const char *name, entry = get_marker(channel, name); if (!entry) goto end; - if (entry->rcu_pending) - rcu_barrier_sched(); +//ust// if (entry->rcu_pending) +//ust// rcu_barrier_sched(); entry->oldptr = old; entry->rcu_pending = 1; /* write rcu_pending before calling the RCU callback */ smp_wmb(); - call_rcu_sched(&entry->rcu, free_old_closure); +//ust// call_rcu_sched(&entry->rcu, free_old_closure); + synchronize_rcu(); free_old_closure(&entry->rcu); remove_marker(channel, name); /* Ignore busy error message */ ret = 0; end: @@ -940,8 +942,8 @@ int marker_probe_unregister_private_data(marker_probe_func *probe, ret = -ENOENT; goto end; } - if (entry->rcu_pending) - rcu_barrier_sched(); +//ust// if (entry->rcu_pending) +//ust// rcu_barrier_sched(); old = marker_entry_remove_probe(entry, NULL, probe_private); channel = kstrdup(entry->channel, GFP_KERNEL); name = kstrdup(entry->name, GFP_KERNEL); @@ -953,13 +955,14 @@ int marker_probe_unregister_private_data(marker_probe_func *probe, entry = get_marker(channel, name); if (!entry) goto end; - if (entry->rcu_pending) - rcu_barrier_sched(); +//ust// if (entry->rcu_pending) +//ust// rcu_barrier_sched(); entry->oldptr = old; entry->rcu_pending = 1; /* write rcu_pending before calling the RCU callback */ smp_wmb(); - call_rcu_sched(&entry->rcu, free_old_closure); +//ust// call_rcu_sched(&entry->rcu, free_old_closure); + synchronize_rcu(); free_old_closure(&entry->rcu); /* Ignore busy error message */ remove_marker(channel, name); end: diff --git a/libust/serialize.c b/libust/serialize.c index bef0178..0056d00 100644 --- a/libust/serialize.c +++ b/libust/serialize.c @@ -23,6 +23,7 @@ #include "tracer.h" #include "list.h" #include "usterr.h" +#include "urcu.h" enum ltt_type { LTT_TYPE_SIGNED_INT, @@ -593,7 +594,7 @@ notrace void ltt_vtrace(const struct marker *mdata, void *probe_data, if (unlikely(ltt_traces.num_active_traces == 0)) return; - rcu_read_lock_sched_notrace(); + rcu_read_lock(); //ust// rcu_read_lock_sched_notrace(); cpu = smp_processor_id(); //ust// __get_cpu_var(ltt_nesting)++; ltt_nesting++; @@ -676,7 +677,7 @@ notrace void ltt_vtrace(const struct marker *mdata, void *probe_data, } //ust// __get_cpu_var(ltt_nesting)--; ltt_nesting--; - rcu_read_unlock_sched_notrace(); + rcu_read_unlock(); //ust// rcu_read_unlock_sched_notrace(); } EXPORT_SYMBOL_GPL(ltt_vtrace); diff --git a/libust/tracepoint.c b/libust/tracepoint.c index ba4509b..8a9ed01 100644 --- a/libust/tracepoint.c +++ b/libust/tracepoint.c @@ -36,6 +36,7 @@ #include "tracepoint.h" #include "usterr.h" #include "list.h" +#include "urcu.h" //extern struct tracepoint __start___tracepoints[] __attribute__((visibility("hidden"))); //extern struct tracepoint __stop___tracepoints[] __attribute__((visibility("hidden"))); diff --git a/libust/tracepoint.h b/libust/tracepoint.h index 6f14ea0..3b24701 100644 --- a/libust/tracepoint.h +++ b/libust/tracepoint.h @@ -28,6 +28,7 @@ //#include //#include +#include "urcu.h" #include "immediate.h" #include "kernelcompat.h" @@ -58,14 +59,14 @@ struct tracepoint { do { \ void **it_func; \ \ - rcu_read_lock_sched_notrace(); \ + rcu_read_lock(); /*ust rcu_read_lock_sched_notrace(); */ \ it_func = rcu_dereference((tp)->funcs); \ if (it_func) { \ do { \ ((void(*)(proto))(*it_func))(args); \ } while (*(++it_func)); \ } \ - rcu_read_unlock_sched_notrace(); \ + rcu_read_unlock(); /*ust rcu_read_unlock_sched_notrace(); */ \ } while (0) #define __CHECK_TRACE(name, generic, proto, args) \ diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index d6e5346..e191183 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -518,7 +518,7 @@ int ustcomm_init_ustd(struct ustcomm_ustd *handle) handle->server.listen_fd = init_named_socket(name, &handle->server.socketpath); if(handle->server.listen_fd < 0) { - ERR("error initializing named socket"); + ERR("error initializing named socket at %s", name); goto free_name; } free(name); diff --git a/share/kernelcompat.h b/share/kernelcompat.h index c0f4c99..f141bc5 100644 --- a/share/kernelcompat.h +++ b/share/kernelcompat.h @@ -95,13 +95,13 @@ static inline long IS_ERR(const void *ptr) #define smp_mb__after_atomic_inc() do {} while(0) -/* RCU */ - -#include "urcu.h" -#define call_rcu_sched(a,b) b(a); synchronize_rcu() -#define rcu_barrier_sched() do {} while(0) /* this nop is ok if call_rcu_sched does a synchronize_rcu() */ -#define rcu_read_lock_sched_notrace() rcu_read_lock() -#define rcu_read_unlock_sched_notrace() rcu_read_unlock() +///* RCU */ +// +//#include "urcu.h" +//#define call_rcu_sched(a,b) b(a); synchronize_rcu() +//#define rcu_barrier_sched() do {} while(0) /* this nop is ok if call_rcu_sched does a synchronize_rcu() */ +//#define rcu_read_lock_sched_notrace() rcu_read_lock() +//#define rcu_read_unlock_sched_notrace() rcu_read_unlock() /* ATOMICITY */ diff --git a/ustd/Makefile b/ustd/Makefile deleted file mode 100644 index fb5c0e3..0000000 --- a/ustd/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CFLAGS="-g -Wall" - -all: ustd - -lowlevel.o: lowlevel.c - gcc -g -Wall -I ../libustcomm -I. -I ../../../../libkcompat -I ../libtracing -I ../share -I ../../../../urcu -I ../libmarkers -lpthread -c lowlevel.c - -ustd.o: ustd.c - gcc -g -Wall -I ../libustcomm -I. -I ../../../../libkcompat -lpthread -c ustd.c - -ustcomm.o: ../libustcomm/ustcomm.c - gcc -g -Wall -I ../share ../libustcomm/ustcomm.c - -ustd: ustd.o lowlevel.o ustcomm.o - gcc -g -Wall -lpthread -o ustd ustd.o lowlevel.o ustcomm.o - -.PHONY: ustd diff --git a/ustd/Makefile.am b/ustd/Makefile.am new file mode 100644 index 0000000..f2cb959 --- /dev/null +++ b/ustd/Makefile.am @@ -0,0 +1,9 @@ +bin_PROGRAMS = ustd +ustd_SOURCES = lowlevel.c localerr.h ustd.c ustd.h $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/libustcomm/ustcomm.h $(top_builddir)/share/kref.c +ustd_LDFLAGS = -lpthread + +INCLUDES = -I$(top_builddir)/share +#INCLUDES += -I@URCU_PATH@ +INCLUDES += -I@KCOMPAT_PATH@ +INCLUDES += -I$(top_builddir)/libust +INCLUDES += -I$(top_builddir)/libustcomm diff --git a/ustd/ustd.c b/ustd/ustd.c index ab4ec7a..c5a3d8b 100644 --- a/ustd/ustd.c +++ b/ustd/ustd.c @@ -273,6 +273,7 @@ int add_buffer(pid_t pid, char *bufname) result = fd = open(tmp, O_WRONLY | O_CREAT | O_TRUNC, 00600); if(result == -1) { PERROR("open"); + ERR("failed opening trace file %s", tmp); return -1; } buf->file_fd = fd; -- 2.34.1