WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@ddiss
Copy link

@ddiss ddiss commented Jul 4, 2025

This is a follow up change for commit 3c97822 ("lkl: add tests build barrier") tracked via #558. The hijack and zpoline libraries also share object files, so need a barrier to avoid parallel build failures.

@ddiss ddiss marked this pull request as draft July 4, 2025 07:40
@ddiss
Copy link
Author

ddiss commented Jul 4, 2025

This is fixing the parallel build failures I raised in #558 (comment) with make-4.4.1-3.3 (openSUSE Tumbleweed) , but it strangely doesn't work with make-4.2.1-7.3.2 (Leap 15.6). The .WAIT install filter appears to be broken:

make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=. obj=lklfuse
make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=lib obj=liblkl
make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=tests obj=disk
make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=tests obj=boot
make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=tests obj=disk-vfio-pci
make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=tests obj=net-test
make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=tests obj=config
make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=tests obj=test-dlmopen
make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=lib/hijack obj=liblkl-hijack
make -f /home/david/kernel/lkl/tools/build/Makefile.build dir=lib/hijack obj=liblkl-zpoline
\
    install -d /home/david/install/here/usr/include ; \
    install -m 644 include/lkl.h include/lkl_host.h /home/david/kernel/lkl/tools/lkl/include/lkl_autoconf.h \
      include/lkl_config.h /home/david/install/here/usr/include ; \
    cp -r /home/david/kernel/lkl/tools/lkl/include/lkl /home/david/install/here/usr/include
\
    install -d /home/david/install/here/usr/lib ; \
    install -m 644 /home/david/kernel/lkl/tools/lkl/lib/liblkl.so /home/david/kernel/lkl/tools/lkl/lib/hijack/liblkl-hijack.so .WAIT /home/david/kernel/lkl/tools/lkl/lib/hijack/liblkl-zpoline.so /home/david/kernel/lkl/tools/lkl/liblkl.a /home/david/install/here/usr/lib
install: cannot stat '.WAIT': No such file or directory
make: *** [Makefile:180: libraries_install] Error 1

@ddiss
Copy link
Author

ddiss commented Jul 4, 2025

This is fixing the parallel build failures I raised in #558 (comment) with make-4.4.1-3.3 (openSUSE Tumbleweed) , but it strangely doesn't work with make-4.2.1-7.3.2 (Leap 15.6). The .WAIT install filter appears to be broken:

ah, the expand-targets filter isn't supposed to remove the .WAIT target, only avoid adding $(EXESUF) / $(SOSUF) to it.

@ddiss
Copy link
Author

ddiss commented Jul 4, 2025

This is fixing the parallel build failures I raised in #558 (comment) with make-4.4.1-3.3 (openSUSE Tumbleweed) , but it strangely doesn't work with make-4.2.1-7.3.2 (Leap 15.6). The .WAIT install filter appears to be broken:

ah, the expand-targets filter isn't supposed to remove the .WAIT target, only avoid adding $(EXESUF) / $(SOSUF) to it.

This extra change seems to work, but it's not exactly pretty:

--- a/tools/lkl/Makefile
+++ b/tools/lkl/Makefile
@@ -177,9 +177,9 @@ headers_install: $(TARGETS)
            cp -r $(OUTPUT)include/lkl $(DESTDIR)$(INCDIR)
 
 libraries_install: $(call expand-targets,$(libs-y),$(SOSUF)) $(OUTPUT)liblkl.a
-       $(call QUIET_INSTALL, libraries) \
+       $(if $(filter .%,$^),,$(call QUIET_INSTALL, libraries) \
            install -d $(DESTDIR)$(LIBDIR) ; \
-           install -m 644 $^ $(DESTDIR)$(LIBDIR)
+           install -m 644 $^ $(DESTDIR)$(LIBDIR))

Will squash this into the commit, but please feel free to suggest something cleaner.

@ddiss ddiss force-pushed the fix_hijack_zpoline_parallel_build branch from f54c767 to 4ee5d9b Compare July 4, 2025 10:59
@ddiss
Copy link
Author

ddiss commented Jul 4, 2025

v2:

  • filter .WAIT target from install invocation

@ddiss
Copy link
Author

ddiss commented Jul 7, 2025

make install rule still isn't working for older distros. keeping this flagged as draft.

@ddiss
Copy link
Author

ddiss commented Sep 2, 2025

I finally have a fix that I'm happy with for this. As mentioned, the .WAIT target causes issues with libraries_install on make 4.2.1 (works with 4.4.1), so I went with a simple shared -in.o prerequisite. Will do some more testing and then push here.

@ddiss ddiss force-pushed the fix_hijack_zpoline_parallel_build branch from 4ee5d9b to d229932 Compare September 2, 2025 04:51
@ddiss ddiss marked this pull request as ready for review September 2, 2025 04:51
@ddiss
Copy link
Author

ddiss commented Sep 2, 2025

v3.

  • use a simple shared libhijack-priv-in.o prerequisite instead of .WAIT

@ddiss
Copy link
Author

ddiss commented Sep 2, 2025

windows-2022 test failure is due to:

  TEST       not ok   nanosleep 
sleep 78556400 (ret=0), expected sleep 87654321

circle-ci qemu fails to boot:

Too long with no output (exceeded 10m0s): context deadline exceeded

Both of these are unrelated to the change here IMO.

@ddiss
Copy link
Author

ddiss commented Sep 2, 2025

This is linking libhijack-priv-in.o into liblkl.so which is obviously wrong. I need another minor change to track the hijack libraries separate from liblkl.so...

@ddiss
Copy link
Author

ddiss commented Sep 2, 2025

This is linking libhijack-priv-in.o into liblkl.so which is obviously wrong. I need another minor change to track the hijack libraries separate from liblkl.so...

The existing $(OUTPUT)liblkl$(SOSUF) rule doesn't match anything, due to the lack of the lib/ prefix. Fixing that up and linking there, separate to the hijack libraries, seems reasonable. v4 to follow...

This is a follow up change for commit 3c97822 ("lkl: add tests
build barrier") tracked via lkl#558.
The hijack and zpoline libraries also share object files, so need extra
logic to avoid parallel build failures.

Add a new intermediate libhijack-priv-in.o prerequisite for the hijack
libraries, avoiding the .WAIT target which breaks make libraries_install
on older (e.g. 4.2.1) versions of make.
The existing liblkl$(SOSUF) target is currently unmatched, so fix it and
use it as a linker target which omits libhijack-priv-in.o.

Signed-off-by: David Disseldorp <[email protected]>
@ddiss ddiss force-pushed the fix_hijack_zpoline_parallel_build branch from d229932 to 6784e53 Compare September 2, 2025 15:14
@ddiss
Copy link
Author

ddiss commented Sep 2, 2025

v4:

  • the existing liblkl$(SOSUF) target is currently unmatched, so fix it and use it as a linker target which omits libhijack-priv-in.o

@ddiss
Copy link
Author

ddiss commented Sep 3, 2025

One follow up I'd also like to propose (via a separate PR) is to use the same private common in.o approach for tests, effectively reverting the use of .WAIT in 3c97822 . Instead we'd be adding something like:

$(tests-y:%=$(OUTPUT)%$(EXESUF)): $(tests-priv-y:%=$(OUTPUT)%-in.o) 
...
tests-priv-y := tests/tests-common
...
tests-common-y += cla.o test.o

@tavip tavip merged commit 6784e53 into lkl:master Sep 4, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants