akiradeveloper / dm-writeboost

Log-structured Caching for Linux
GNU General Public License v2.0
120 stars 19 forks source link

module build fails for 6.1.83+, 6.6.23+, 6.7.11+, 6.8.2+, 6.9+ #245

Closed anbe42 closed 6 months ago

anbe42 commented 6 months ago
DKMS make.log for dm-writeboost-2.2.16 for kernel 6.1.0-20-cloud-amd64 (x86_64)
Sat Apr 27 11:45:49 UTC 2024
make -C /lib/modules/6.1.0-20-cloud-amd64/build M=/var/lib/dkms/dm-writeboost/2.2.16/build modules
make[1]: Entering directory '/usr/src/linux-headers-6.1.0-20-cloud-amd64'
make -f /usr/src/linux-headers-6.1.0-20-common/scripts/Makefile.build obj=/var/lib/dkms/dm-writeboost/2.2.16/build need-builtin=1 need-modorder=1 
  printf '%s
'   dm-writeboost-target.o dm-writeboost-metadata.o dm-writeboost-daemon.o | awk '!x[$0]++ { print("/var/lib/dkms/dm-writeboost/2.2.16/build/"$0) }' > /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost.mod
   gcc-12 -Wp,-MMD,/var/lib/dkms/dm-writeboost/2.2.16/build/.dm-writeboost-target.o.d -nostdinc -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-6.1.0-20-common/include -I./include -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-6.1.0-20-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler-version.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/kconfig.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=/usr/src/linux-headers-6.1.0-20-common/= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g  -DMODULE  -DKBUILD_BASENAME='"dm_writeboost_target"' -DKBUILD_MODNAME='"dm_writeboost"' -D__KBUILD_MODNAME=kmod_dm_writeboost -c -o /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-target.o /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-target.c   ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --orc --retpoline --rethunk --sls --static-call --uaccess   --module /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-target.o
   gcc-12 -Wp,-MMD,/var/lib/dkms/dm-writeboost/2.2.16/build/.dm-writeboost-metadata.o.d -nostdinc -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-6.1.0-20-common/include -I./include -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-6.1.0-20-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler-version.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/kconfig.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=/usr/src/linux-headers-6.1.0-20-common/= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g  -DMODULE  -DKBUILD_BASENAME='"dm_writeboost_metadata"' -DKBUILD_MODNAME='"dm_writeboost"' -D__KBUILD_MODNAME=kmod_dm_writeboost -c -o /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-metadata.o /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-metadata.c   ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --orc --retpoline --rethunk --sls --static-call --uaccess   --module /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-metadata.o
   gcc-12 -Wp,-MMD,/var/lib/dkms/dm-writeboost/2.2.16/build/.dm-writeboost-daemon.o.d -nostdinc -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-6.1.0-20-common/include -I./include -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-6.1.0-20-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler-version.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/kconfig.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=/usr/src/linux-headers-6.1.0-20-common/= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g  -DMODULE  -DKBUILD_BASENAME='"dm_writeboost_daemon"' -DKBUILD_MODNAME='"dm_writeboost"' -D__KBUILD_MODNAME=kmod_dm_writeboost -c -o /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-daemon.o /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-daemon.c   ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --orc --retpoline --rethunk --sls --static-call --uaccess   --module /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-daemon.o
/var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-target.c: In function 'wb_io_fn':
/var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-target.c:56:19: error: too few arguments to function 'dm_io'
   56 |         io->err = dm_io(io->io_req, io->num_regions, io->regions, &io->err_bits);
      |                   ^~~~~
In file included from /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost.h:37,
                 from /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-target.c:23:
/usr/src/linux-headers-6.1.0-20-common/include/linux/dm-io.h:81:5: note: declared here
   81 | int dm_io(struct dm_io_request *io_req, unsigned int num_regions,
      |     ^~~~~
/var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-target.c: In function 'wb_io_internal':
/var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-target.c:82:23: error: too few arguments to function 'dm_io'
   82 |                 err = dm_io(io_req, num_regions, regions, err_bits);
      |                       ^~~~~
/usr/src/linux-headers-6.1.0-20-common/include/linux/dm-io.h:81:5: note: declared here
   81 | int dm_io(struct dm_io_request *io_req, unsigned int num_regions,
      |     ^~~~~
make[2]: *** [/usr/src/linux-headers-6.1.0-20-common/scripts/Makefile.build:255: /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-target.o] Error 1
make[2]: *** Waiting for unfinished jobs....
  /usr/src/linux-headers-6.1.0-20-common/scripts/check-local-export /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-daemon.o
   { echo ; echo '/var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-daemon.o: $(wildcard ./tools/objtool/objtool)' ; } >> /var/lib/dkms/dm-writeboost/2.2.16/build/.dm-writeboost-daemon.o.cmd
  if nm /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-daemon.o 2>/dev/null | grep -q __ksymtab; then  gcc-12 -E -D__GENKSYMS__ -Wp,-MMD,/var/lib/dkms/dm-writeboost/2.2.16/build/.dm-writeboost-daemon.o.d -nostdinc -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-6.1.0-20-common/include -I./include -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-6.1.0-20-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler-version.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/kconfig.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=/usr/src/linux-headers-6.1.0-20-common/= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g  -DMODULE  -DKBUILD_BASENAME='"dm_writeboost_daemon"' -DKBUILD_MODNAME='"dm_writeboost"' -D__KBUILD_MODNAME=kmod_dm_writeboost /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-daemon.c | scripts/genksyms/genksyms   -r /dev/null >> /var/lib/dkms/dm-writeboost/2.2.16/build/.dm-writeboost-daemon.o.cmd; fi
  /usr/src/linux-headers-6.1.0-20-common/scripts/check-local-export /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-metadata.o
   { echo ; echo '/var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-metadata.o: $(wildcard ./tools/objtool/objtool)' ; } >> /var/lib/dkms/dm-writeboost/2.2.16/build/.dm-writeboost-metadata.o.cmd
  if nm /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-metadata.o 2>/dev/null | grep -q __ksymtab; then  gcc-12 -E -D__GENKSYMS__ -Wp,-MMD,/var/lib/dkms/dm-writeboost/2.2.16/build/.dm-writeboost-metadata.o.d -nostdinc -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-6.1.0-20-common/include -I./include -I/usr/src/linux-headers-6.1.0-20-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-6.1.0-20-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler-version.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/kconfig.h -include /usr/src/linux-headers-6.1.0-20-common/include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=/usr/src/linux-headers-6.1.0-20-common/= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g  -DMODULE  -DKBUILD_BASENAME='"dm_writeboost_metadata"' -DKBUILD_MODNAME='"dm_writeboost"' -D__KBUILD_MODNAME=kmod_dm_writeboost /var/lib/dkms/dm-writeboost/2.2.16/build/dm-writeboost-metadata.c | scripts/genksyms/genksyms   -r /dev/null >> /var/lib/dkms/dm-writeboost/2.2.16/build/.dm-writeboost-metadata.o.cmd; fi
make[1]: *** [/usr/src/linux-headers-6.1.0-20-common/Makefile:2035: /var/lib/dkms/dm-writeboost/2.2.16/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-20-cloud-amd64'
make: *** [Makefile:11: all] Error 2

The corresponding change "dm io: Support IO priority" has been introduced in v6.9-rc1 (6e5f0f6383b4896c7e9b943d84b136149d0f45e9) and has been backported to v6.8.2 (3d02f57794b56f8a04a21fdfb04f20a1c9f712a7) v6.7.11 (4156ddd66b15ca409cd52dc7040c28c25143ce5a) v6.6.23 (5cfcea64883486d79c695afdc502e32eb1b71587) v6.1.83 (92b3c2437df8fe55a5c7816d9521b1fb7d0718b0)

The solution is probably to conditionally append ', IOPRIO_DEFAULT' as last parameter to the dm_io calls.

akiradeveloper commented 6 months ago

@anbe42 Thank you for reporting.

The solution is probably to conditionally append ', IOPRIO_DEFAULT' as last parameter to the dm_io calls.

should be true.

But we must to pay attention to supporting older kernels. It now supports 3.10 or later. There are a lot of version-code switch in the code and it is really bad. I want to sort it out to discontinue the support for really older version.

By the way, the modification to dm_io needs version-code switch as well. Since they are backported to older kernel like 6.1, 6.6, 6.7 and 6.8. Other kernels like 6.2 isn't affected? If so, the switch will be very terrible.

anbe42 commented 6 months ago

What about replacing all dm_io() calls with a DM_IO() macro:

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,2)) || \
        ((LINUX_VERSION_CODE >= KERNEL_VERSION(6,7,11)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6,8,0))) || \
        ((LINUX_VERSION_CODE >= KERNEL_VERSION(6,6,23)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6,7,0))) || \
        ((LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,83)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0)))
// Linux commit 6e5f0f6383b4896c7e9b943d84b136149d0f45e9 "dm io: Support IO priority"
// introduced the 5th argument.
#define DM_IO(arg1, arg2, arg3, arg4) dm_io(arg1, arg2, arg3, arg4, IOPRIO_DEFAULT)
#else
#define DM_IO(arg1, arg2, arg3, arg4) dm_io(arg1, arg2, arg3, arg4)
#endif

(completely untested)

akiradeveloper commented 6 months ago

Thank you. But is this really the best one?

I want a more succinct solution because I hardly think that complicated version-switches are maintainable.

What is the aim of the flag added to dm_io and the reason it is backported to those specific kernel versions?