Duplicate headers in tools/testing/shared directory diverged - rcupdate.h
All,
I am sending this email to you all because you touched tools/testing/shared and its sub directories and show up in
get_maintainer.pl -f tools/testing/shared/ output
rbtree compile failed as it couldn't find urcu.h
cc -I../shared -I. -I../../include -I../../arch/x86/include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined -c -o rbtree_test.o rbtree_test.c
In file included from ../shared/shared.h:11,
from rbtree_test.c:9:../shared/linux/rcupdate.h:5:10: fatal error: urcu.h: No such file or directory
5 | #include <urcu.h>
| ^~~~~~~~compilation terminated.
This sent me down the path to look at the duplicate headers in tools/testing/shared especially rcupdate.h which is under tools/testing/shared/linux
It appears this file is an exact copy of include/linux/rcupdate.h and now it diverged. Why do we have these duplicate headers here in this shared directory - it appears they are out of date and lead to maintenance problems.
thanks,
-- Shuah
Quoted 17 lines · Shuah Khan
All,
I am sending this email to you all because you touched
tools/testing/sharedand its sub directories and show up inget_maintainer.pl -f
tools/testing/shared/outputrbtree compile failed as it couldn't find
urcu.hcc -I../shared -I. -I../../include -I../../arch/x86/include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined -c -o rbtree_test.o
rbtree_test.c
In file included from../shared/shared.h:11,
from rbtree_test.c:9:../shared/linux/rcupdate.h:5:10: fatal error:urcu.h: No such file or directory5 | #include <urcu.h> | ^~~~~~~~
Quoted 8 lines
compilation terminated.
This sent me down the path to look at the duplicate headers in
tools/testing/sharedespeciallyrcupdate.hwhich is undertools/testing/shared/linuxIt appears this file is an exact copy of
include/linux/rcupdate.hand now it diverged. Why do we have these duplicate headers here in this shared directory - it appears they are out of date and lead to maintenance problems.
I tripped over this recently, too - my archeology concluded that <urcu.h> comes from a user space library (which I installed to fix the breakage):
% dpkg -S /usr/include/x86_64-linux-gnu/urcu.h liburcu-dev:amd64: /usr/include/x86_64-linux-gnu/urcu.h
This version of rcupdate.h originally came out of tools/testing/radix-tree/ and was moved in 74579d8dab47 ("tools:
separate out shared radix-tree components").
Maybe the targets that depend on liburcu should be configured to build only when it's installed?
Quoted 4 lines · Shuah Khan
All,
I am sending this email to you all because you touched
tools/testing/sharedand its sub directories and show up in
We need to add these to somewhere in MAINTAINERS...
Quoted 4 lines
get_maintainer.pl -f
tools/testing/shared/outputrbtree compile failed as it couldn't find
urcu.h
Presumably liburcu is not installed.
Quoted 5 lines
cc -I../shared -I. -I../../include -I../../arch/x86/include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined -c -o rbtree_test.o
rbtree_test.c
In file included from../shared/shared.h:11,
from rbtree_test.c:9:../shared/linux/rcupdate.h:5:10: fatal error:urcu.h: No such file or directory
Quoted 8 lines
5 | #include <urcu.h> | ^~~~~~~~compilation terminated.
This sent me down the path to look at the duplicate headers in
tools/testing/sharedespeciallyrcupdate.hwhich is undertools/testing/shared/linuxIt appears this file is an exact copy of
include/linux/rcupdate.hand now it
$ wc -l tools/testing/shared/linux/rcupdate.h 12 tools/testing/shared/linux/rcupdate.h $ wc -l include/linux/rcupdate.h 1196 include/linux/rcupdate.h
Umm, no?
Quoted 2 lines
diverged. Why do we have these duplicate headers here in this shared directory - it appears they are out of date and lead to maintenance problems.
Because they're not duplicates of one another? One is a wrapper around urcu, your problem is you don't have that library installed.
Unless I'm missing something?
Quoted 3 lines
thanks,
-- Shuah
Thanks, Lorenzo
Quoted 27 lines · Lorenzo Stoakes
Quoted 4 lines · Shuah Khan
All,
I am sending this email to you all because you touched
tools/testing/sharedand its sub directories and show up inWe need to add these to somewhere in
MAINTAINERS...Quoted 4 lines
get_maintainer.pl -f
tools/testing/shared/outputrbtree compile failed as it couldn't find
urcu.hPresumably liburcu is not installed.
Quoted 12 lines
cc -I../shared -I. -I../../include -I../../arch/x86/include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined -c -o rbtree_test.o
rbtree_test.c
In file included from../shared/shared.h:11,
from rbtree_test.c:9:../shared/linux/rcupdate.h:5:10: fatal error:urcu.h: No such file or directory5 | #include <urcu.h> | ^~~~~~~~compilation terminated.
This sent me down the path to look at the duplicate headers in
tools/testing/sharedespeciallyrcupdate.hwhich is undertools/testing/shared/linux
Quoted 8 lines
Quoted 1 line
It appears this file is an exact copy of
include/linux/rcupdate.hand now it$ wc -l tools/testing/shared/linux/rcupdate.h 12 tools/testing/shared/linux/rcupdate.h $ wc -l include/linux/rcupdate.h 1196 include/linux/rcupdate.hUmm, no?
My bad - I looked at diff wrong. You can ignore the duplicate headers stuff.
Quoted 6 lines
Quoted 3 lines
diverged. Why do we have these duplicate headers here in this shared directory - it appears they are out of date and lead to maintenance problems.
Because they're not duplicates of one another? One is a wrapper around urcu, your problem is you don't have that library installed.
It would have been nice to find a different name for this header and also have some information about its purpose? It says nothing.
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _RCUPDATE_H
#define _RCUPDATE_H
#include <urcu.h>
#define rcu_dereference_raw(p) rcu_dereference(p) #define rcu_dereference_protected(p, cond) rcu_dereference(p) #define rcu_dereference_check(p, cond) rcu_dereference(p) #define RCU_INIT_POINTER(p, v) do { (p) = (v); } while (0)
#endif
That solved one problem - still seeing others:
cc -I../shared -I. -I../../include -I../../arch/x86/include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined -c -o rbtree_test.o rbtree_test.c
In file included from rbtree_test.c:11:../../../lib/rbtree_test.c: In function ‘rbtree_test_init’:../../../lib/rbtree_test.c:402:17: error: implicit declaration of function ‘kmalloc_objs’; did you mean ‘kzalloc_obj’? [-Wimplicit-function-declaration]
402 | nodes = kmalloc_objs(*nodes, nnodes);
| ^~~~~~~~~~~~
| kzalloc_obj../../../lib/rbtree_test.c:402:15: error: assignment to ‘struct test_node *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
402 | nodes = kmalloc_objs(*nodes, nnodes);
| ^
thanks,
-- Shuah