From 09938485689f3482ec845e52d5bf5e78c1093e27 Mon Sep 17 00:00:00 2001 From: Pierre-Marc Fournier Date: Wed, 18 Feb 2009 18:10:32 -0500 Subject: [PATCH] ust: add userspace rcu support --- hello/Makefile | 4 +--- libmarkers/Makefile | 2 +- libmarkers/marker.c | 1 + libtracectl/Makefile | 2 +- libtracing/Makefile | 2 +- share/kernelcompat.h | 20 ++++++++++---------- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/hello/Makefile b/hello/Makefile index 4168e6e..62f4c65 100644 --- a/hello/Makefile +++ b/hello/Makefile @@ -2,10 +2,8 @@ all: hello hello: hello.c #dynamic version - gcc -g -I../libmarkers -I../share -I../libtracing -L../libmarkers -lmarkers -L../libtracectl -ltracectl -L../libtracing -ltracing -o hello hello.c marker-control.c serialize.c + gcc -g -I../libmarkers -I../share -I../libtracing -L../libmarkers -lmarkers -L../libtracectl -ltracectl -L../libtracing -ltracing -I../../../../urcu -Wl,-rpath ../../../../urcu -o hello hello.c marker-control.c serialize.c # -Wl,--print-map -#static version -# gcc -g -I../libmarkers -I../share -I../libtracing -L../libmarkers -o hello hello.c marker-control.c serialize.c ../libtracing/*.c ../libmarkers/*.c ../libtracectl/*.c ../share/*.c clean: rm -rf hello *.o diff --git a/libmarkers/Makefile b/libmarkers/Makefile index d3729f8..bf5539a 100644 --- a/libmarkers/Makefile +++ b/libmarkers/Makefile @@ -1,6 +1,6 @@ all: libmarkers.so libmarkers.so: marker.c *.c *.h - gcc -g -fPIC -I../share -I../libtracing -I. -shared -o libmarkers.so marker.c ../share/kref.c ../libtracing/channels.c + gcc -g -fPIC -I../share -I../libtracing -I. -shared -o libmarkers.so -L../../../../urcu -I../../../../urcu $(CFLAGS) -lurcu marker.c ../share/kref.c ../libtracing/channels.c .PHONY: libmarkers.so all diff --git a/libmarkers/marker.c b/libmarkers/marker.c index 198650b..e1b62c7 100644 --- a/libmarkers/marker.c +++ b/libmarkers/marker.c @@ -817,6 +817,7 @@ int marker_probe_register(const char *channel, const char *name, /* write rcu_pending before calling the RCU callback */ smp_wmb(); call_rcu_sched(&entry->rcu, free_old_closure); + /*synchronize_rcu(); free_old_closure();*/ goto end; error_unregister_channel: diff --git a/libtracectl/Makefile b/libtracectl/Makefile index 6aa41e4..27803da 100644 --- a/libtracectl/Makefile +++ b/libtracectl/Makefile @@ -1,7 +1,7 @@ all: libtracectl.so libtracectl.so: tracectl.c - gcc -g -shared -fPIC -I../libmarkers -I../share -o libtracectl.so tracectl.c + gcc -g -shared -fPIC -I../libmarkers -I../share $(CFLAGS) -o libtracectl.so tracectl.c clean: rm -rf *.so *.o diff --git a/libtracing/Makefile b/libtracing/Makefile index b2904e8..d8abbbb 100644 --- a/libtracing/Makefile +++ b/libtracing/Makefile @@ -1,6 +1,6 @@ all: libtracing.so libtracing.so: *.c *.h - gcc -g -fPIC -I../share -I../libtracing -I../libmarkers -shared -o libtracing.so *.c + gcc -g -fPIC -I../share -I../libtracing -I../libmarkers $(CFLAGS) -shared -o libtracing.so *.c .PHONY: libtracing.so all diff --git a/share/kernelcompat.h b/share/kernelcompat.h index 9139e75..f95d0d7 100644 --- a/share/kernelcompat.h +++ b/share/kernelcompat.h @@ -98,21 +98,21 @@ typedef int spinlock_t; /* MEMORY BARRIERS */ -#define smp_rmb() do {} while(0) -#define smp_wmb() do {} while(0) -#define smp_mb() do {} while(0) +//#define smp_rmb() do {} while(0) +//#define smp_wmb() do {} while(0) +//#define smp_mb() do {} while(0) #define smp_mb__after_atomic_inc() do {} while(0) #define read_barrier_depends() do {} while(0) -#define smp_read_barrier_depends() do {} while(0) +//#define smp_read_barrier_depends() do {} while(0) /* RCU */ -#define rcu_assign_pointer(a, b) do {} while(0) -#define call_rcu_sched(a,b) do {} while(0) -#define rcu_barrier_sched() do {} while(0) -#define rcu_read_lock_sched_notrace() do{} while (0) -#define rcu_read_unlock_sched_notrace() do{} while (0) +#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 */ @@ -147,7 +147,7 @@ static int atomic_read(atomic_t *p) #include "asm.h" -#define __xg(x) ((volatile long *)(x)) +//#define __xg(x) ((volatile long *)(x)) #define cmpxchg(ptr, o, n) \ ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \ -- 2.34.1