On Mon, Mar 28, 2011 at 07:21:16PM -0400, Mathieu Desnoyers wrote:
> * Paul E. McKenney ([email protected]) wrote:
> > Hello!
> >
> > The following pair of patches permits a single executable to use
> > multiple flavors of URCU without resorting to linker tricks. The
> > approach is to map each flavor to a different namespace. The patches
> > are as follows:
> >
> > 1. Provide pthread_atfork-friendly interfaces.
> > 2. Map symbols to allow multiple flavors of URCU to be mixed.
> >
> > This does not yet centralize pthread_atfork() handling, nor does it
> > yet map defer_rcu() and friends.
> >
> > Thoughts?
>
> Hi Paul,
>
> >
> > Thanx, Paul
> >
> > a/urcu-call-rcu.c | 620
> > -------------------------------------------------
> > b/Makefile.am | 3
> > b/README | 4
> > b/tests/Makefile.am | 33 +-
> > b/tests/rcutorture.h | 1
> > b/tests/urcutorture.c | 13 -
> > b/urcu-bp.c | 4
> > b/urcu-bp.h | 8
> > b/urcu-call-rcu-impl.h | 618
> > ++++++++++++++++++++++++++++++++++++++++++++++++
>
> I rather thought we could do something e.g. (for the rcu read lock):
>
> * urcu header
> - header
> #ifdef RCU_MEMBARRIER
> #define rcu_read_lock() rcu_read_lock_memb()
> #endif
>
> #ifdef LGPL_SOURCE
> static inline rcu_read_lock_memb(void) {...}
> #else
> #define rcu_read_lock_mb() _rcu_read_lock_memb()
> #endif
> - implementation (c file)
> #define RCU_MEMBARRIER
> implements _rcu_read_lock_memb(void) and friends.
> #include urcu-call-rcu-impl.h
I get a similar effect with the *map.h files, see attached.
(Yes, I forgot to do "git add"... Sigh!)
> * urcu-mb
> (similar to the above, with _mb, RCU_MB)
>
> * urcu-signal
> (similar to the above, with _sig, RCU_SIGNAL)
>
> * urcu-bp
> (similarly, with _bp, RCU_BP)
>
> * call_rcu
>
> Looking into why we need to move urcu-call-rcu.c into
> urcu-call-rcu-impl.h, I notice that it's because we need each RCU flavor
> synchronize_rcu() to be used by each call_rcu.
Yep!
> I think all the -map files are missing from the patchset, which I think
> is very important to understand how you plan to do the identifier
> definitions. So maybe that my comment above is (or not) in line with
> what you propose. We'll see with the -map header files.
They are currently a bunch of #defines, see attached.
Thanx, Paul
#ifndef _URCU_MAP_H
#define _URCU_MAP_H
/*
* urcu-map.h
*
* Userspace RCU header -- name mapping to allow multiple flavors to be
* used in the same executable.
*
* Copyright (c) 2009 Mathieu Desnoyers <[email protected]>
* Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
*
* LGPL-compatible code should include this header with :
*
* #define _LGPL_SOURCE
* #include <urcu.h>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* IBM's contributions to this file may be relicensed under LGPLv2 or later.
*/
/* Mapping macros to allow multiple flavors in a single binary. */
#ifdef RCU_MEMBARRIER
#define rcu_read_lock rcu_read_lock_memb
#define _rcu_read_lock _rcu_read_lock_memb
#define rcu_read_unlock rcu_read_unlock_memb
#define _rcu_read_unlock _rcu_read_unlock_memb
#define rcu_register_thread rcu_register_thread_memb
#define rcu_unregister_thread rcu_unregister_thread_memb
#define rcu_init rcu_init_memb
#define rcu_exit rcu_exit_memb
#define synchronize_rcu synchronize_rcu_memb
#define rcu_reader rcu_reader_memb
#define rcu_gp_ctr rcu_gp_ctr_memb
#define get_cpu_call_rcu_data get_cpu_call_rcu_data_memb
#define get_call_rcu_thread get_call_rcu_thread_memb
#define create_call_rcu_data create_call_rcu_data_memb
#define set_cpu_call_rcu_data set_cpu_call_rcu_data_memb
#define get_default_call_rcu_data get_default_call_rcu_data_memb
#define get_call_rcu_data get_call_rcu_data_memb
#define get_thread_call_rcu_data get_thread_call_rcu_data_memb
#define set_thread_call_rcu_data set_thread_call_rcu_data_memb
#define create_all_cpu_call_rcu_data create_all_cpu_call_rcu_data_memb
#define free_all_cpu_call_rcu_data free_all_cpu_call_rcu_data_memb
#define call_rcu call_rcu_memb
#elif defined(RCU_SIGNAL)
#define rcu_read_lock rcu_read_lock_sig
#define _rcu_read_lock _rcu_read_lock_sig
#define rcu_read_unlock rcu_read_unlock_sig
#define _rcu_read_unlock _rcu_read_unlock_sig
#define rcu_register_thread rcu_register_thread_sig
#define rcu_unregister_thread rcu_unregister_thread_sig
#define rcu_init rcu_init_sig
#define rcu_exit rcu_exit_sig
#define synchronize_rcu synchronize_rcu_sig
#define rcu_reader rcu_reader_sig
#define rcu_gp_ctr rcu_gp_ctr_sig
#define get_cpu_call_rcu_data get_cpu_call_rcu_data_sig
#define get_call_rcu_thread get_call_rcu_thread_sig
#define create_call_rcu_data create_call_rcu_data_sig
#define set_cpu_call_rcu_data set_cpu_call_rcu_data_sig
#define get_default_call_rcu_data get_default_call_rcu_data_sig
#define get_call_rcu_data get_call_rcu_data_sig
#define get_thread_call_rcu_data get_thread_call_rcu_data_sig
#define set_thread_call_rcu_data set_thread_call_rcu_data_sig
#define create_all_cpu_call_rcu_data create_all_cpu_call_rcu_data_sig
#define free_all_cpu_call_rcu_data free_all_cpu_call_rcu_data_sig
#define call_rcu call_rcu_sig
#elif defined(RCU_MB)
#define rcu_read_lock rcu_read_lock_mb
#define _rcu_read_lock _rcu_read_lock_mb
#define rcu_read_unlock rcu_read_unlock_mb
#define _rcu_read_unlock _rcu_read_unlock_mb
#define rcu_register_thread rcu_register_thread_mb
#define rcu_unregister_thread rcu_unregister_thread_mb
#define rcu_init rcu_init_mb
#define rcu_exit rcu_exit_mb
#define synchronize_rcu synchronize_rcu_mb
#define rcu_reader rcu_reader_mb
#define rcu_gp_ctr rcu_gp_ctr_mb
#define get_cpu_call_rcu_data get_cpu_call_rcu_data_mb
#define get_call_rcu_thread get_call_rcu_thread_mb
#define create_call_rcu_data create_call_rcu_data_mb
#define set_cpu_call_rcu_data set_cpu_call_rcu_data_mb
#define get_default_call_rcu_data get_default_call_rcu_data_mb
#define get_call_rcu_data get_call_rcu_data_mb
#define get_thread_call_rcu_data get_thread_call_rcu_data_mb
#define set_thread_call_rcu_data set_thread_call_rcu_data_mb
#define create_all_cpu_call_rcu_data create_all_cpu_call_rcu_data_mb
#define free_all_cpu_call_rcu_data free_all_cpu_call_rcu_data_mb
#define call_rcu call_rcu_mb
#endif
#endif /* _URCU_MAP_H */
#ifndef _URCU_BP_MAP_H
#define _URCU_BP_MAP_H
/*
* urcu-map.h
*
* Userspace RCU header -- name mapping to allow multiple flavors to be
* used in the same executable.
*
* Copyright (c) 2009 Mathieu Desnoyers <[email protected]>
* Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
*
* LGPL-compatible code should include this header with :
*
* #define _LGPL_SOURCE
* #include <urcu.h>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* IBM's contributions to this file may be relicensed under LGPLv2 or later.
*/
/* Mapping macros to allow multiple flavors in a single binary. */
#define rcu_read_lock rcu_read_lock_bp
#define _rcu_read_lock _rcu_read_lock_bp
#define rcu_read_unlock rcu_read_unlock_bp
#define _rcu_read_unlock _rcu_read_unlock_bp
#define rcu_register_thread rcu_register_thread_bp
#define rcu_unregister_thread rcu_unregister_thread_bp
#define rcu_init rcu_init_bp
#define rcu_exit rcu_exit_bp
#define synchronize_rcu synchronize_rcu_bp
#define rcu_reader rcu_reader_bp
#define rcu_gp_ctr rcu_gp_ctr_bp
#define get_cpu_call_rcu_data get_cpu_call_rcu_data_bp
#define get_call_rcu_thread get_call_rcu_thread_bp
#define create_call_rcu_data create_call_rcu_data_bp
#define set_cpu_call_rcu_data set_cpu_call_rcu_data_bp
#define get_default_call_rcu_data get_default_call_rcu_data_bp
#define get_call_rcu_data get_call_rcu_data_bp
#define get_thread_call_rcu_data get_thread_call_rcu_data_bp
#define set_thread_call_rcu_data set_thread_call_rcu_data_bp
#define create_all_cpu_call_rcu_data create_all_cpu_call_rcu_data_bp
#define free_all_cpu_call_rcu_data free_all_cpu_call_rcu_data_bp
#define call_rcu call_rcu_bp
#endif /* _URCU_BP_MAP_H */
#ifndef _URCU_QSBR_MAP_H
#define _URCU_QSBR_MAP_H
/*
* urcu-map.h
*
* Userspace RCU header -- name mapping to allow multiple flavors to be
* used in the same executable.
*
* Copyright (c) 2009 Mathieu Desnoyers <[email protected]>
* Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
*
* LGPL-compatible code should include this header with :
*
* #define _LGPL_SOURCE
* #include <urcu.h>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* IBM's contributions to this file may be relicensed under LGPLv2 or later.
*/
/* Mapping macros to allow multiple flavors in a single binary. */
#define rcu_read_lock rcu_read_lock_qsbr
#define _rcu_read_lock _rcu_read_lock_qsbr
#define rcu_read_unlock rcu_read_unlock_qsbr
#define _rcu_read_unlock _rcu_read_unlock_qsbr
#define rcu_quiescent_state rcu_quiescent_state_qsbr
#define _rcu_quiescent_state _rcu_quiescent_state_qsbr
#define rcu_thread_offline rcu_thread_offline_qsbr
#define rcu_thread_online rcu_thread_online_qsbr
#define rcu_register_thread rcu_register_thread_qsbr
#define rcu_unregister_thread rcu_unregister_thread_qsbr
#define rcu_exit rcu_exit_qsbr
#define synchronize_rcu synchronize_rcu_qsbr
#define rcu_reader rcu_reader_qsbr
#define rcu_gp_ctr rcu_gp_ctr_qsbr
#define get_cpu_call_rcu_data get_cpu_call_rcu_data_qsbr
#define get_call_rcu_thread get_call_rcu_thread_qsbr
#define create_call_rcu_data create_call_rcu_data_qsbr
#define set_cpu_call_rcu_data set_cpu_call_rcu_data_qsbr
#define get_default_call_rcu_data get_default_call_rcu_data_qsbr
#define get_call_rcu_data get_call_rcu_data_qsbr
#define get_thread_call_rcu_data get_thread_call_rcu_data_qsbr
#define set_thread_call_rcu_data set_thread_call_rcu_data_qsbr
#define create_all_cpu_call_rcu_data create_all_cpu_call_rcu_data_qsbr
#define call_rcu call_rcu_qsbr
#endif /* _URCU_QSBR_MAP_H */
_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev