Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools: separate out shared radix-tree components

The core components contained within the radix-tree tests which provide
shims for kernel headers and access to the maple tree are useful for
testing other things, so separate them out and make the radix tree tests
dependent on the shared components.

This lays the groundwork for us to add VMA tests of the newly introduced
vma.c file.

Link: https://lkml.kernel.org/r/1ee720c265808168e0d75608e687607d77c36719.1722251717.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Brendan Higgins <brendanhiggins@google.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: David Gow <davidgow@google.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Kees Cook <kees@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Rae Moar <rmoar@google.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Pengfei Xu <pengfei.xu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Lorenzo Stoakes and committed by
Andrew Morton
74579d8d 802443a4

+144 -69
+1
tools/testing/radix-tree/.gitignore
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 + generated/autoconf.h 2 3 generated/bit-length.h 3 4 generated/map-shift.h 4 5 idr.c
+12 -60
tools/testing/radix-tree/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 - CFLAGS += -I. -I../../include -I../../../lib -g -Og -Wall \ 4 - -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined 5 - LDFLAGS += -fsanitize=address -fsanitize=undefined 6 - LDLIBS+= -lpthread -lurcu 3 + .PHONY: clean 4 + 7 5 TARGETS = main idr-test multiorder xarray maple 8 - LIBS := slab.o find_bit.o bitmap.o hweight.o vsprintf.o 9 - CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o maple.o $(LIBS) 10 - OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \ 11 - regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \ 12 - iteration_check_2.o benchmark.o 13 - 14 - ifndef SHIFT 15 - SHIFT=3 16 - endif 17 - 18 - ifeq ($(BUILD), 32) 19 - CFLAGS += -m32 20 - LDFLAGS += -m32 21 - LONG_BIT := 32 22 - endif 23 - 24 - ifndef LONG_BIT 25 - LONG_BIT := $(shell getconf LONG_BIT) 26 - endif 6 + CORE_OFILES = $(SHARED_OFILES) xarray.o maple.o test.o 7 + OFILES = main.o $(CORE_OFILES) regression1.o regression2.o \ 8 + regression3.o regression4.o tag_check.o multiorder.o idr-test.o \ 9 + iteration_check.o iteration_check_2.o benchmark.o 27 10 28 11 targets: generated/map-shift.h generated/bit-length.h $(TARGETS) 12 + 13 + include ../shared/shared.mk 29 14 30 15 main: $(OFILES) 31 16 32 17 idr-test.o: ../../../lib/test_ida.c 33 18 idr-test: idr-test.o $(CORE_OFILES) 34 19 35 - xarray: $(CORE_OFILES) 20 + xarray: $(CORE_OFILES) xarray.o 36 21 37 - maple: $(CORE_OFILES) 22 + maple: $(CORE_OFILES) maple.o 38 23 39 24 multiorder: multiorder.o $(CORE_OFILES) 40 25 41 26 clean: 42 - $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h generated/bit-length.h 27 + $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/* 43 28 44 - vpath %.c ../../lib 45 - 46 - $(OFILES): Makefile *.h */*.h generated/map-shift.h generated/bit-length.h \ 47 - ../../include/linux/*.h \ 48 - ../../include/asm/*.h \ 49 - ../../../include/linux/xarray.h \ 50 - ../../../include/linux/maple_tree.h \ 51 - ../../../include/linux/radix-tree.h \ 52 - ../../../lib/radix-tree.h \ 53 - ../../../include/linux/idr.h 54 - 55 - radix-tree.c: ../../../lib/radix-tree.c 56 - sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ 57 - 58 - idr.c: ../../../lib/idr.c 59 - sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ 60 - 61 - xarray.o: ../../../lib/xarray.c ../../../lib/test_xarray.c 62 - 63 - maple.o: ../../../lib/maple_tree.c ../../../lib/test_maple_tree.c 64 - 65 - generated/map-shift.h: 66 - @if ! grep -qws $(SHIFT) generated/map-shift.h; then \ 67 - echo "#define XA_CHUNK_SHIFT $(SHIFT)" > \ 68 - generated/map-shift.h; \ 69 - fi 70 - 71 - generated/bit-length.h: FORCE 72 - @if ! grep -qws CONFIG_$(LONG_BIT)BIT generated/bit-length.h; then \ 73 - echo "Generating $@"; \ 74 - echo "#define CONFIG_$(LONG_BIT)BIT 1" > $@; \ 75 - fi 76 - 77 - FORCE: ; 29 + $(OFILES): $(SHARED_DEPS) *.h
tools/testing/radix-tree/generated/autoconf.h tools/testing/shared/autoconf.h
tools/testing/radix-tree/linux.c tools/testing/shared/linux.c
tools/testing/radix-tree/linux/bug.h tools/testing/shared/linux/bug.h
tools/testing/radix-tree/linux/cpu.h tools/testing/shared/linux/cpu.h
tools/testing/radix-tree/linux/idr.h tools/testing/shared/linux/idr.h
tools/testing/radix-tree/linux/init.h tools/testing/shared/linux/init.h
tools/testing/radix-tree/linux/kconfig.h tools/testing/shared/linux/kconfig.h
tools/testing/radix-tree/linux/kernel.h tools/testing/shared/linux/kernel.h
tools/testing/radix-tree/linux/kmemleak.h tools/testing/shared/linux/kmemleak.h
tools/testing/radix-tree/linux/local_lock.h tools/testing/shared/linux/local_lock.h
tools/testing/radix-tree/linux/lockdep.h tools/testing/shared/linux/lockdep.h
tools/testing/radix-tree/linux/maple_tree.h tools/testing/shared/linux/maple_tree.h
tools/testing/radix-tree/linux/percpu.h tools/testing/shared/linux/percpu.h
tools/testing/radix-tree/linux/preempt.h tools/testing/shared/linux/preempt.h
tools/testing/radix-tree/linux/radix-tree.h tools/testing/shared/linux/radix-tree.h
tools/testing/radix-tree/linux/rcupdate.h tools/testing/shared/linux/rcupdate.h
tools/testing/radix-tree/linux/xarray.h tools/testing/shared/linux/xarray.h
tools/testing/radix-tree/trace/events/maple_tree.h tools/testing/shared/trace/events/maple_tree.h
+1 -9
tools/testing/radix-tree/xarray.c
··· 4 4 * Copyright (c) 2018 Matthew Wilcox <willy@infradead.org> 5 5 */ 6 6 7 - #define XA_DEBUG 7 + #include "xarray-shared.h" 8 8 #include "test.h" 9 9 10 - #define module_init(x) 11 - #define module_exit(x) 12 - #define MODULE_AUTHOR(x) 13 - #define MODULE_DESCRIPTION(X) 14 - #define MODULE_LICENSE(x) 15 - #define dump_stack() assert(0) 16 - 17 - #include "../../../lib/xarray.c" 18 10 #undef XA_DEBUG 19 11 #include "../../../lib/test_xarray.c" 20 12
+9
tools/testing/shared/maple-shared.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + 3 + #define CONFIG_DEBUG_MAPLE_TREE 4 + #define CONFIG_MAPLE_SEARCH 5 + #define MAPLE_32BIT (MAPLE_NODE_SLOTS > 31) 6 + #include "shared.h" 7 + #include <stdlib.h> 8 + #include <time.h> 9 + #include "linux/init.h"
+7
tools/testing/shared/maple-shim.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + 3 + /* Very simple shim around the maple tree. */ 4 + 5 + #include "maple-shared.h" 6 + 7 + #include "../../../lib/maple_tree.c"
+33
tools/testing/shared/shared.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + #include <linux/types.h> 4 + #include <linux/bug.h> 5 + #include <linux/kernel.h> 6 + #include <linux/bitops.h> 7 + 8 + #include <linux/gfp.h> 9 + #include <linux/rcupdate.h> 10 + 11 + #ifndef module_init 12 + #define module_init(x) 13 + #endif 14 + 15 + #ifndef module_exit 16 + #define module_exit(x) 17 + #endif 18 + 19 + #ifndef MODULE_AUTHOR 20 + #define MODULE_AUTHOR(x) 21 + #endif 22 + 23 + #ifndef MODULE_LICENSE 24 + #define MODULE_LICENSE(x) 25 + #endif 26 + 27 + #ifndef MODULE_DESCRIPTION 28 + #define MODULE_DESCRIPTION(x) 29 + #endif 30 + 31 + #ifndef dump_stack 32 + #define dump_stack() assert(0) 33 + #endif
+72
tools/testing/shared/shared.mk
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + 3 + CFLAGS += -I../shared -I. -I../../include -I../../../lib -g -Og -Wall \ 4 + -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined 5 + LDFLAGS += -fsanitize=address -fsanitize=undefined 6 + LDLIBS += -lpthread -lurcu 7 + LIBS := slab.o find_bit.o bitmap.o hweight.o vsprintf.o 8 + SHARED_OFILES = xarray-shared.o radix-tree.o idr.o linux.o $(LIBS) 9 + 10 + SHARED_DEPS = Makefile ../shared/shared.mk ../shared/*.h generated/map-shift.h \ 11 + generated/bit-length.h generated/autoconf.h \ 12 + ../../include/linux/*.h \ 13 + ../../include/asm/*.h \ 14 + ../../../include/linux/xarray.h \ 15 + ../../../include/linux/maple_tree.h \ 16 + ../../../include/linux/radix-tree.h \ 17 + ../../../lib/radix-tree.h \ 18 + ../../../include/linux/idr.h 19 + 20 + ifndef SHIFT 21 + SHIFT=3 22 + endif 23 + 24 + ifeq ($(BUILD), 32) 25 + CFLAGS += -m32 26 + LDFLAGS += -m32 27 + LONG_BIT := 32 28 + endif 29 + 30 + ifndef LONG_BIT 31 + LONG_BIT := $(shell getconf LONG_BIT) 32 + endif 33 + 34 + %.o: ../shared/%.c 35 + $(CC) -c $(CFLAGS) $< -o $@ 36 + 37 + vpath %.c ../../lib 38 + 39 + $(SHARED_OFILES): $(SHARED_DEPS) 40 + 41 + radix-tree.c: ../../../lib/radix-tree.c 42 + sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ 43 + 44 + idr.c: ../../../lib/idr.c 45 + sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ 46 + 47 + xarray-shared.o: ../shared/xarray-shared.c ../../../lib/xarray.c \ 48 + ../../../lib/test_xarray.c 49 + 50 + maple-shared.o: ../shared/maple-shared.c ../../../lib/maple_tree.c \ 51 + ../../../lib/test_maple_tree.c 52 + 53 + generated/autoconf.h: 54 + @mkdir -p generated 55 + cp ../shared/autoconf.h generated/autoconf.h 56 + 57 + generated/map-shift.h: 58 + @mkdir -p generated 59 + @if ! grep -qws $(SHIFT) generated/map-shift.h; then \ 60 + echo "Generating $@"; \ 61 + echo "#define XA_CHUNK_SHIFT $(SHIFT)" > \ 62 + generated/map-shift.h; \ 63 + fi 64 + 65 + generated/bit-length.h: FORCE 66 + @mkdir -p generated 67 + @if ! grep -qws CONFIG_$(LONG_BIT)BIT generated/bit-length.h; then \ 68 + echo "Generating $@"; \ 69 + echo "#define CONFIG_$(LONG_BIT)BIT 1" > $@; \ 70 + fi 71 + 72 + FORCE: ;
+5
tools/testing/shared/xarray-shared.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + 3 + #include "xarray-shared.h" 4 + 5 + #include "../../../lib/xarray.c"
+4
tools/testing/shared/xarray-shared.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + 3 + #define XA_DEBUG 4 + #include "shared.h"