X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=src%2Furcu-call-rcu-impl.h;h=9f2ed7dd709263f3eaa8418d7562a7ec91c993b6;hp=56fe943ac8d1ab8b9b5d260efca4d9e1ed8d7728;hb=a142df4e35dcf835439bf6714e49e95a2a68f7a6;hpb=6fd172f599e8d798e68974a786dd930d876f182e diff --git a/src/urcu-call-rcu-impl.h b/src/urcu-call-rcu-impl.h index 56fe943..9f2ed7d 100644 --- a/src/urcu-call-rcu-impl.h +++ b/src/urcu-call-rcu-impl.h @@ -35,14 +35,15 @@ #include #include "compat-getcpu.h" -#include "urcu/wfcqueue.h" -#include "urcu-call-rcu.h" -#include "urcu-pointer.h" -#include "urcu/list.h" -#include "urcu/futex.h" -#include "urcu/tls-compat.h" -#include "urcu/ref.h" +#include +#include +#include +#include +#include +#include +#include #include "urcu-die.h" +#include "urcu-utils.h" #define SET_AFFINITY_CHECK_PERIOD (1U << 8) /* 256 */ #define SET_AFFINITY_CHECK_PERIOD_MASK (SET_AFFINITY_CHECK_PERIOD - 1) @@ -88,7 +89,7 @@ static CDS_LIST_HEAD(call_rcu_data_list); /* Link a thread using call_rcu() to its call_rcu thread. */ -static DEFINE_URCU_TLS_IE(struct call_rcu_data *, thread_call_rcu_data); +static DEFINE_URCU_TLS(struct call_rcu_data *, thread_call_rcu_data); /* * Guard call_rcu thread creation and atfork handlers. @@ -198,7 +199,7 @@ static void call_rcu_unlock(pthread_mutex_t *pmp) * Losing affinity can be caused by CPU hotunplug/hotplug, or by * cpuset(7). */ -#if HAVE_SCHED_SETAFFINITY +#ifdef HAVE_SCHED_SETAFFINITY static int set_thread_cpu_affinity(struct call_rcu_data *crdp) { @@ -214,11 +215,8 @@ int set_thread_cpu_affinity(struct call_rcu_data *crdp) CPU_ZERO(&mask); CPU_SET(crdp->cpu_affinity, &mask); -#if SCHED_SETAFFINITY_ARGS == 2 - ret = sched_setaffinity(0, &mask); -#else ret = sched_setaffinity(0, sizeof(mask), &mask); -#endif + /* * EINVAL is fine: can be caused by hotunplugged CPUs, or by * cpuset(7). This is why we should always retry if we detect @@ -232,7 +230,7 @@ int set_thread_cpu_affinity(struct call_rcu_data *crdp) } #else static -int set_thread_cpu_affinity(struct call_rcu_data *crdp) +int set_thread_cpu_affinity(struct call_rcu_data *crdp __attribute__((unused))) { return 0; } @@ -464,6 +462,8 @@ struct call_rcu_data *get_cpu_call_rcu_data(int cpu) return NULL; return rcu_dereference(pcpu_crdp[cpu]); } +URCU_ATTR_ALIAS(urcu_stringify(get_cpu_call_rcu_data)) +struct call_rcu_data *alias_get_cpu_call_rcu_data(); /* * Return the tid corresponding to the call_rcu thread whose @@ -474,6 +474,8 @@ pthread_t get_call_rcu_thread(struct call_rcu_data *crdp) { return crdp->tid; } +URCU_ATTR_ALIAS(urcu_stringify(get_call_rcu_thread)) +pthread_t alias_get_call_rcu_thread(); /* * Create a call_rcu_data structure (with thread) and return a pointer. @@ -488,6 +490,8 @@ static struct call_rcu_data *__create_call_rcu_data(unsigned long flags, return crdp; } +URCU_ATTR_ALIAS(urcu_stringify(create_call_rcu_data)) +struct call_rcu_data *alias_create_call_rcu_data(); struct call_rcu_data *create_call_rcu_data(unsigned long flags, int cpu_affinity) { @@ -544,6 +548,8 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp) call_rcu_unlock(&call_rcu_mutex); return 0; } +URCU_ATTR_ALIAS(urcu_stringify(set_cpu_call_rcu_data)) +int alias_set_cpu_call_rcu_data(); /* * Return a pointer to the default call_rcu_data structure, creating @@ -564,6 +570,8 @@ struct call_rcu_data *get_default_call_rcu_data(void) call_rcu_unlock(&call_rcu_mutex); return default_call_rcu_data; } +URCU_ATTR_ALIAS(urcu_stringify(get_default_call_rcu_data)) +struct call_rcu_data *alias_get_default_call_rcu_data(); /* * Return the call_rcu_data structure that applies to the currently @@ -591,6 +599,8 @@ struct call_rcu_data *get_call_rcu_data(void) return get_default_call_rcu_data(); } +URCU_ATTR_ALIAS(urcu_stringify(get_call_rcu_data)) +struct call_rcu_data *alias_get_call_rcu_data(); /* * Return a pointer to this task's call_rcu_data if there is one. @@ -600,6 +610,8 @@ struct call_rcu_data *get_thread_call_rcu_data(void) { return URCU_TLS(thread_call_rcu_data); } +URCU_ATTR_ALIAS(urcu_stringify(get_thread_call_rcu_data)) +struct call_rcu_data *alias_get_thread_call_rcu_data(); /* * Set this task's call_rcu_data structure as specified, regardless @@ -616,6 +628,8 @@ void set_thread_call_rcu_data(struct call_rcu_data *crdp) { URCU_TLS(thread_call_rcu_data) = crdp; } +URCU_ATTR_ALIAS(urcu_stringify(set_thread_call_rcu_data)) +void alias_set_thread_call_rcu_data(); /* * Create a separate call_rcu thread for each CPU. This does not @@ -667,6 +681,8 @@ int create_all_cpu_call_rcu_data(unsigned long flags) } return 0; } +URCU_ATTR_ALIAS(urcu_stringify(create_all_cpu_call_rcu_data)) +int alias_create_all_cpu_call_rcu_data(); /* * Wake up the call_rcu thread corresponding to the specified @@ -714,6 +730,7 @@ void call_rcu(struct rcu_head *head, _call_rcu(head, func, crdp); _rcu_read_unlock(); } +URCU_ATTR_ALIAS(urcu_stringify(call_rcu)) void alias_call_rcu(); /* * Free up the specified call_rcu_data structure, terminating the @@ -752,9 +769,13 @@ void call_rcu_data_free(struct call_rcu_data *crdp) while ((uatomic_read(&crdp->flags) & URCU_CALL_RCU_STOPPED) == 0) (void) poll(NULL, 0, 1); } + call_rcu_lock(&call_rcu_mutex); if (!cds_wfcq_empty(&crdp->cbs_head, &crdp->cbs_tail)) { - /* Create default call rcu data if need be */ + call_rcu_unlock(&call_rcu_mutex); + /* Create default call rcu data if need be. */ + /* CBs queued here will be handed to the default list. */ (void) get_default_call_rcu_data(); + call_rcu_lock(&call_rcu_mutex); __cds_wfcq_splice_blocking(&default_call_rcu_data->cbs_head, &default_call_rcu_data->cbs_tail, &crdp->cbs_head, &crdp->cbs_tail); @@ -763,12 +784,13 @@ void call_rcu_data_free(struct call_rcu_data *crdp) wake_call_rcu_thread(default_call_rcu_data); } - call_rcu_lock(&call_rcu_mutex); cds_list_del(&crdp->list); call_rcu_unlock(&call_rcu_mutex); free(crdp); } +URCU_ATTR_ALIAS(urcu_stringify(call_rcu_data_free)) +void alias_call_rcu_data_free(); /* * Clean up all the per-CPU call_rcu threads. @@ -809,6 +831,16 @@ void free_all_cpu_call_rcu_data(void) } free(crdp); } +#ifdef RCU_QSBR +/* ABI6 has a non-namespaced free_all_cpu_call_rcu_data for qsbr */ +#undef free_all_cpu_call_rcu_data +URCU_ATTR_ALIAS("urcu_qsbr_free_all_cpu_call_rcu_data") +void free_all_cpu_call_rcu_data(); +#define free_all_cpu_call_rcu_data urcu_qsbr_free_all_cpu_call_rcu_data +#else +URCU_ATTR_ALIAS(urcu_stringify(free_all_cpu_call_rcu_data)) +void alias_free_all_cpu_call_rcu_data(); +#endif static void free_completion(struct urcu_ref *ref) @@ -900,6 +932,8 @@ online: if (was_online) rcu_thread_online(); } +URCU_ATTR_ALIAS(urcu_stringify(rcu_barrier)) +void alias_rcu_barrier(); /* * Acquire the call_rcu_mutex in order to ensure that the child sees @@ -928,6 +962,8 @@ void call_rcu_before_fork(void) (void) poll(NULL, 0, 1); } } +URCU_ATTR_ALIAS(urcu_stringify(call_rcu_before_fork)) +void alias_call_rcu_before_fork(); /* * Clean up call_rcu data structures in the parent of a successful fork() @@ -950,6 +986,8 @@ void call_rcu_after_fork_parent(void) atfork->after_fork_parent(atfork->priv); call_rcu_unlock(&call_rcu_mutex); } +URCU_ATTR_ALIAS(urcu_stringify(call_rcu_after_fork_parent)) +void alias_call_rcu_after_fork_parent(); /* * Clean up call_rcu data structures in the child of a successful fork() @@ -997,6 +1035,8 @@ void call_rcu_after_fork_child(void) call_rcu_data_free(crdp); } } +URCU_ATTR_ALIAS(urcu_stringify(call_rcu_after_fork_child)) +void alias_call_rcu_after_fork_child(); void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork) { @@ -1007,8 +1047,10 @@ void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork) end: call_rcu_unlock(&call_rcu_mutex); } +URCU_ATTR_ALIAS(urcu_stringify(urcu_register_rculfhash_atfork)) +void alias_urcu_register_rculfhash_atfork(); -void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork) +void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork __attribute__((unused))) { call_rcu_lock(&call_rcu_mutex); if (--registered_rculfhash_atfork_refcount) @@ -1017,3 +1059,5 @@ void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork) end: call_rcu_unlock(&call_rcu_mutex); } +URCU_ATTR_ALIAS(urcu_stringify(urcu_unregister_rculfhash_atfork)) +void alias_urcu_unregister_rculfhash_atfork();