Re: [RFC PATCH 6/7] tools: separate out shared radix-tree components
From: Liam R. Howlett
Date: Thu Jun 27 2024 - 16:04:01 EST
* Lorenzo Stoakes <lstoakes@xxxxxxxxx> [240627 15:47]:
> On Thu, Jun 27, 2024 at 01:59:18PM -0400, Liam R. Howlett wrote:
> > * Lorenzo Stoakes <lstoakes@xxxxxxxxx> [240627 06:39]:
> > > 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.
> >
> > This separation and subsequent patch requires building the
> > xarray-hsared, radix-tree, idr, find_bit, and bitmap .o files which are
> > unneeded for the target 'main'. I'm not a build expert on how to fix
> > this, but could that be reduced to the minimum set somehow?
>
> I'm confused, the existing Makefile specified:
>
> CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o \
> slab.o maple.o
>
> OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
> regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \
> iteration_check_2.o benchmark.o
>
> main: $(OFILES)
>
> Making all of the files you mentioned dependencies of main no? (xarray-shared
> being a subset of xarray.o which requires it anyway)
After replacing main with vma and dropping the vma.c, I can generate the
vma executable. I had to generate map-shift.h and bit-lenght.h, then
execute:
cc -O2 -g -Wall -I../shared -I. -I../../include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined -c -o vma.o vma.c
cc -c -O2 -g -Wall -I../shared -I. -I../../include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined ../shared/linux.c -o linux.o
cc -O2 -g -Wall -I../shared -I. -I../../include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined -c -o slab.o ../../lib/slab.c
cc -c -O2 -g -Wall -I../shared -I. -I../../include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined ../shared/maple-shim.c -o maple-shim.o
cc -O2 -g -Wall -I../shared -I. -I../../include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined -c -o vma_stub.o vma_stub.c
cc -fsanitize=address -fsanitize=undefined vma.o linux.o slab.o maple-shim.o vma_stub.o -lpthread -lurcu -o vma
Dropping a number of the pre-built items. When I looked at the list, it
seemed too numerous for what we were doing (why do we need idr, and
radix-tree?) So I tried removing as many as I could.
>
> I'm not sure this is a huge big deal as these are all rather small :)
Yeah, maybe not worth the effort.
Cheers,
Liam