[lttng-dev] Can anybody help check if such urcu usage is correct?

Yang, Yi Y yi.y.yang at intel.com
Thu Oct 12 08:29:34 UTC 2017


Hi, all

We're investigating if DPDK can use userspace RCU in case lock is unavoidable, DPDK is released under BSD license, urcu is released under LGPL license, so DPDK can use liburcu without any license issue. Here is my pseudo code which uses liburcu to protect a shared global struct.

Global struct

struct vhost_mem_info * mem;

Reader thread:

#define URCU_INLINE_SMALL_FUNCTIONS
#include <urcu.h>

rcu_register_thread();

while (1) {
rcu_read_lock();

/* Read info in mem */

rcu_read_unlock();
               }

               rcu_unregister_thread();

There are multiple reader threads.


Writer thread:

               #define URCU_INLINE_SMALL_FUNCTIONS
               #include <urcu.h>

               void main(int argc, char *argv[])
               {
                              while (has_mem_hotplug) {
                                             synchronize_rcu();
                                             /* update info in mem */
                              }
                              rcu_barrier();
               }

My question is `can such urcu usage protect "struct vhost_mem_info * mem" correctly`, it seems urcu hasn't an explicit way to identify what it will protect, I'll appreciate you if you can show me how to protect "struct vhost_mem_info * mem" for my use case, thank you all in advance for your kind help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20171012/27efa6d1/attachment.html>


More information about the lttng-dev mailing list