I want to call hlist_nulls_add_head_rcu
to manage my list, however gcc gives lots of error messages as following:
|| ./include/linux/rculist_nulls.h: In function ‘hlist_nulls_add_head_rcu’:
/home/river/Desktop/kernel/linux-4.9.82/./include/linux/compiler.h|518 col 38| error: call to ‘__compiletime_assert_97’ declared with attribute error: Need native word sized stores/loads for atomicity.
|| _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
|| ^
/home/river/Desktop/kernel/linux-4.9.82/./include/linux/compiler.h|501 col 4| note: in definition of macro ‘__compiletime_assert’
|| prefix ## suffix(); \
|| ^~~~~~
/home/river/Desktop/kernel/linux-4.9.82/./include/linux/compiler.h|518 col 2| note: in expansion of macro ‘_compiletime_assert’
|| _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
|| ^~~~~~~~~~~~~~~~~~~
/home/river/Desktop/kernel/linux-4.9.82/./include/linux/compiler.h|521 col 2| note: in expansion of macro ‘compiletime_assert’
|| compiletime_assert(__native_word(t), \
|| ^~~~~~~~~~~~~~~~~~
/home/river/Desktop/kernel/linux-4.9.82/./arch/x86/include/asm/barrier.h|92 col 2| note: in expansion of macro ‘compiletime_assert_atomic_type’
|| compiletime_assert_atomic_type(*p); \
|| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/river/Desktop/kernel/linux-4.9.82/./include/asm-generic/barrier.h|157 col 33| note: in expansion of macro ‘__smp_store_release’
|| #define smp_store_release(p, v) __smp_store_release(p, v)
|| ^~~~~~~~~~~~~~~~~~~
/home/river/Desktop/kernel/linux-4.9.82/./include/linux/rcupdate.h|672 col 3| note: in expansion of macro ‘smp_store_release’
|| smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
|| ^~~~~~~~~~~~~~~~~
/home/river/Desktop/kernel/linux-4.9.82/./include/linux/rculist_nulls.h|97 col 2| note: in expansion of macro ‘rcu_assign_pointer’
|| rcu_assign_pointer(hlist_nulls_first_rcu(h), n);
|| ^~~~~~~~~~~~~~~~~~
I think the most useful message is the first:
/include/linux/compiler.h|518 col 38| error: call to ‘__compiletime_assert_97’ declared with attribute error: Need native word sized stores/loads for atomicity.
Then sentence calling hlist_nulls_add_head_rcu
in my module is :
hlist_nulls_add_head_rcu( &kcnew->hnnode,
&kp_sock_lists[kp_hash(kcnew->sock)] );
The parameter type is correct, so maybe the calling manner is error. Do anyone know how to use hlist_nulls_add_head_rcu
?
Delete -O0
from ccflags-y
.
The compiling of RCU needs compile optimization.