X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=libust%2Fmarker.c;h=39e12bb2307423c0e97164fbdcd0ae59d98798d4;hb=0222e1213f196b66cbc08cd29093aca4a28e9ffb;hp=cb8ffc16704636dbebc1ca3d1eb0a5b887d46a31;hpb=fc214788832b93d238449c2b7736a8425b7e5330;p=ust.git diff --git a/libust/marker.c b/libust/marker.c index cb8ffc1..39e12bb 100644 --- a/libust/marker.c +++ b/libust/marker.c @@ -45,7 +45,7 @@ static const int marker_debug; */ static DEFINE_MUTEX(markers_mutex); -static LIST_HEAD(libs); +static CDS_LIST_HEAD(libs); void lock_markers(void) @@ -127,7 +127,7 @@ notrace void __mark_empty_function(const struct marker *mdata, * @...: Variable argument list. * * Since we do not use "typical" pointer based RCU in the 1 argument case, we - * need to put a full smp_rmb() in this branch. This is why we do not use + * need to put a full cmm_smp_rmb() in this branch. This is why we do not use * rcu_dereference() for the pointer read. */ notrace void marker_probe_cb(const struct marker *mdata, @@ -146,12 +146,12 @@ notrace void marker_probe_cb(const struct marker *mdata, if (likely(!ptype)) { marker_probe_func *func; /* Must read the ptype before ptr. They are not data dependant, - * so we put an explicit smp_rmb() here. */ - smp_rmb(); + * so we put an explicit cmm_smp_rmb() here. */ + cmm_smp_rmb(); func = mdata->single.func; /* Must read the ptr before private data. They are not data - * dependant, so we put an explicit smp_rmb() here. */ - smp_rmb(); + * dependant, so we put an explicit cmm_smp_rmb() here. */ + cmm_smp_rmb(); va_start(args, regs); func(mdata, mdata->single.probe_private, regs, call_private, mdata->format, &args); @@ -162,16 +162,16 @@ notrace void marker_probe_cb(const struct marker *mdata, /* * Read mdata->ptype before mdata->multi. */ - smp_rmb(); + cmm_smp_rmb(); multi = mdata->multi; /* * multi points to an array, therefore accessing the array * depends on reading multi. However, even in this case, * we must insure that the pointer is read _before_ the array - * data. Same as rcu_dereference, but we need a full smp_rmb() - * in the fast path, so put the explicit barrier here. + * data. Same as rcu_dereference, but we need a full cmm_smp_rmb() + * in the fast path, so put the explicit cmm_barrier here. */ - smp_read_barrier_depends(); + cmm_smp_read_barrier_depends(); for (i = 0; multi[i].func; i++) { va_start(args, regs); multi[i].func(mdata, multi[i].probe_private, @@ -202,12 +202,12 @@ static notrace void marker_probe_cb_noarg(const struct marker *mdata, if (likely(!ptype)) { marker_probe_func *func; /* Must read the ptype before ptr. They are not data dependant, - * so we put an explicit smp_rmb() here. */ - smp_rmb(); + * so we put an explicit cmm_smp_rmb() here. */ + cmm_smp_rmb(); func = mdata->single.func; /* Must read the ptr before private data. They are not data - * dependant, so we put an explicit smp_rmb() here. */ - smp_rmb(); + * dependant, so we put an explicit cmm_smp_rmb() here. */ + cmm_smp_rmb(); func(mdata, mdata->single.probe_private, regs, call_private, mdata->format, &args); } else { @@ -216,16 +216,16 @@ static notrace void marker_probe_cb_noarg(const struct marker *mdata, /* * Read mdata->ptype before mdata->multi. */ - smp_rmb(); + cmm_smp_rmb(); multi = mdata->multi; /* * multi points to an array, therefore accessing the array * depends on reading multi. However, even in this case, * we must insure that the pointer is read _before_ the array - * data. Same as rcu_dereference, but we need a full smp_rmb() - * in the fast path, so put the explicit barrier here. + * data. Same as rcu_dereference, but we need a full cmm_smp_rmb() + * in the fast path, so put the explicit cmm_barrier here. */ - smp_read_barrier_depends(); + cmm_smp_read_barrier_depends(); for (i = 0; multi[i].func; i++) multi[i].func(mdata, multi[i].probe_private, regs, call_private, mdata->format, &args); @@ -239,7 +239,7 @@ static void free_old_closure(struct rcu_head *head) struct marker_entry, rcu); free(entry->oldptr); /* Make sure we free the data before setting the pending flag to 0 */ - smp_wmb(); + cmm_smp_wmb(); entry->rcu_pending = 0; } @@ -497,7 +497,7 @@ static int remove_marker(const char *channel, const char *name) WARN_ON(ret); /* Make sure the call_rcu has been executed */ //ust// if (e->rcu_pending) -//ust// rcu_barrier_sched(); +//ust// rcu_cmm_barrier_sched(); free(e); return 0; } @@ -563,7 +563,7 @@ static int set_marker(struct marker_entry *entry, struct marker *elem, * Make sure the private data is valid when we update the * single probe ptr. */ - smp_wmb(); + cmm_smp_wmb(); elem->single.func = entry->single.func; /* * We also make sure that the new probe callbacks array is consistent @@ -574,7 +574,7 @@ static int set_marker(struct marker_entry *entry, struct marker *elem, * Update the function or multi probe array pointer before setting the * ptype. */ - smp_wmb(); + cmm_smp_wmb(); elem->ptype = entry->ptype; if (elem->tp_name && (active ^ _imv_read(elem->state))) { @@ -641,7 +641,7 @@ static void disable_marker(struct marker *elem) elem->state__imv = 0; elem->single.func = __mark_empty_function; /* Update the function before setting the ptype */ - smp_wmb(); + cmm_smp_wmb(); elem->ptype = 0; /* single probe */ /* * Leave the private data and channel_id/event_id there, because removal @@ -716,7 +716,7 @@ static void lib_update_markers(void) /* FIXME: we should probably take a mutex here on libs */ //ust// pthread_mutex_lock(&module_mutex); - list_for_each_entry(lib, &libs, list) + cds_list_for_each_entry(lib, &libs, list) marker_update_probe_range(lib->markers_start, lib->markers_start + lib->markers_count); //ust// pthread_mutex_unlock(&module_mutex); @@ -816,7 +816,7 @@ int marker_probe_register(const char *channel, const char *name, * make sure it's executed now. */ //ust// if (entry->rcu_pending) -//ust// rcu_barrier_sched(); +//ust// rcu_cmm_barrier_sched(); old = marker_entry_add_probe(entry, probe, probe_private); if (IS_ERR(old)) { ret = PTR_ERR(old); @@ -835,11 +835,11 @@ int marker_probe_register(const char *channel, const char *name, if (!entry) goto end; //ust// if (entry->rcu_pending) -//ust// rcu_barrier_sched(); +//ust// rcu_cmm_barrier_sched(); entry->oldptr = old; entry->rcu_pending = 1; /* write rcu_pending before calling the RCU callback */ - smp_wmb(); + cmm_smp_wmb(); //ust// call_rcu_sched(&entry->rcu, free_old_closure); synchronize_rcu(); free_old_closure(&entry->rcu); goto end; @@ -881,7 +881,7 @@ int marker_probe_unregister(const char *channel, const char *name, if (!entry) goto end; //ust// if (entry->rcu_pending) -//ust// rcu_barrier_sched(); +//ust// rcu_cmm_barrier_sched(); old = marker_entry_remove_probe(entry, probe, probe_private); pthread_mutex_unlock(&markers_mutex); @@ -892,11 +892,11 @@ int marker_probe_unregister(const char *channel, const char *name, if (!entry) goto end; //ust// if (entry->rcu_pending) -//ust// rcu_barrier_sched(); +//ust// rcu_cmm_barrier_sched(); entry->oldptr = old; entry->rcu_pending = 1; /* write rcu_pending before calling the RCU callback */ - smp_wmb(); + cmm_smp_wmb(); //ust// call_rcu_sched(&entry->rcu, free_old_closure); synchronize_rcu(); free_old_closure(&entry->rcu); remove_marker(channel, name); /* Ignore busy error message */ @@ -966,7 +966,7 @@ int marker_probe_unregister_private_data(marker_probe_func *probe, goto end; } //ust// if (entry->rcu_pending) -//ust// rcu_barrier_sched(); +//ust// rcu_cmm_barrier_sched(); old = marker_entry_remove_probe(entry, NULL, probe_private); channel = strdup(entry->channel); name = strdup(entry->name); @@ -979,11 +979,11 @@ int marker_probe_unregister_private_data(marker_probe_func *probe, if (!entry) goto end; //ust// if (entry->rcu_pending) -//ust// rcu_barrier_sched(); +//ust// rcu_cmm_barrier_sched(); entry->oldptr = old; entry->rcu_pending = 1; /* write rcu_pending before calling the RCU callback */ - smp_wmb(); + cmm_smp_wmb(); //ust// call_rcu_sched(&entry->rcu, free_old_closure); synchronize_rcu(); free_old_closure(&entry->rcu); /* Ignore busy error message */ @@ -1086,7 +1086,7 @@ int lib_get_iter_markers(struct marker_iter *iter) int found = 0; //ust// pthread_mutex_lock(&module_mutex); - list_for_each_entry(iter_lib, &libs, list) { + cds_list_for_each_entry(iter_lib, &libs, list) { if (iter_lib < iter->lib) continue; else if (iter_lib > iter->lib) @@ -1370,7 +1370,7 @@ int marker_register_lib(struct marker *markers_start, int markers_count) /* FIXME: maybe protect this with its own mutex? */ lock_markers(); - list_add(&pl->list, &libs); + cds_list_add(&pl->list, &libs); unlock_markers(); new_markers(markers_start, markers_start + markers_count); @@ -1394,10 +1394,10 @@ int marker_unregister_lib(struct marker *markers_start) /* FIXME: we should probably take a mutex here on libs */ //ust// pthread_mutex_lock(&module_mutex); - list_for_each_entry(lib, &libs, list) { + cds_list_for_each_entry(lib, &libs, list) { if(lib->markers_start == markers_start) { struct lib *lib2free = lib; - list_del(&lib->list); + cds_list_del(&lib->list); free(lib2free); break; }