akiradeveloper / dm-writeboost

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

Handle STATUSTYPE_IMA #236

Closed akiradeveloper closed 2 years ago

akiradeveloper commented 2 years ago

Writeboost should handle STATUSTYPE_IMA

I actually don't know what this is but seems to better handle appropriately.

tanantharaman commented 2 years ago

I cannot compile the dm-writeboost module with dkms for Linux 5.18.1, and get this error (using gcc 9.3.0) /var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost-target.c: In function ‘writeboost_status’: /var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost-target.c:1899:2: error: enumeration value ‘STATUSTYPE_IMA’ not handled in switch [-Werror=switch] 1899 | switch (type) {

akiradeveloper commented 2 years ago

With 5.17, I emits a warning and I guess it is granted as an error based on gcc's setting.

$ make
make -C /lib/modules/5.17.0/build M=/home/akira/dm-writeboost/src modules
make[1]: Entering directory '/home/akira/linux'
  CC [M]  /home/akira/dm-writeboost/src/dm-writeboost-target.o
/home/akira/dm-writeboost/src/dm-writeboost-target.c: In function 'writeboost_status':
/home/akira/dm-writeboost/src/dm-writeboost-target.c:1899:2: warning: enumeration value 'STATUSTYPE_IMA' not handled in switch [-Wswitch]
  switch (type) {
  ^~~~~~
  CC [M]  /home/akira/dm-writeboost/src/dm-writeboost-metadata.o
  CC [M]  /home/akira/dm-writeboost/src/dm-writeboost-daemon.o
  LD [M]  /home/akira/dm-writeboost/src/dm-writeboost.o
  MODPOST /home/akira/dm-writeboost/src/Module.symvers
  CC [M]  /home/akira/dm-writeboost/src/dm-writeboost.mod.o
  LD [M]  /home/akira/dm-writeboost/src/dm-writeboost.ko
make[1]: Leaving directory '/home/akira/linux'
akiradeveloper commented 2 years ago

I can compile in 5.17.

# make install
cp -r src /usr/src/dm-writeboost-2.2.15
dkms add -m dm-writeboost -v 2.2.15

Creating symlink /var/lib/dkms/dm-writeboost/2.2.15/source ->
                 /usr/src/dm-writeboost-2.2.15

DKMS: add completed.
dkms build -m dm-writeboost -v 2.2.15

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j4 KERNELRELEASE=5.17.0 all KERNEL_TREE=/lib/modules/5.17.0/build.....
cleaning build area...

DKMS: build completed.
dkms install -m dm-writeboost -v 2.2.15

dm-writeboost.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.17.0/updates/dkms/

depmod...

Backing up initrd.img-5.17.0 to /boot/initrd.img-5.17.0.old-dkms
Making new initrd.img-5.17.0
(If next boot fails, revert to initrd.img-5.17.0.old-dkms image)
update-initramfs.......

DKMS: install completed.

@tanantharaman Please copy and paste all the procedures and messages so I can reproduce the error.

akiradeveloper commented 2 years ago

https://elixir.bootlin.com/linux/v5.15/source/drivers/md/dm-dust.c

the switch has appeared in 5.15 and the easiest fix for now is to add a switch that does nothing.

case 
    *result = '\0';
    break;
}

If someone needs a detailed implementation of this switch I leave him the task.

tanantharaman commented 2 years ago

Here are more details of my failed 5.18.1 build. After upgrading kernel from 5.14.5 to 5.18.1 I ran:

dkms install dm-writeboost/2.2.15

Deprecated feature: REMAKE_INITRD

Building module: cleaning build area... make -j48 KERNELRELEASE=5.18.1-1.el7.elrepo.x86_64 all KERNEL_TREE=/lib/modules/5.18.1-1.el7.elrepo.x86_64/build...(bad exit status: 2) Error! Bad return status for module build on kernel: 5.18.1-1.el7.elrepo.x86_64 (x86_64) Consult /var/lib/dkms/dm-writeboost/2.2.15/build/make.log for more information. -----End of stdout----

I had previously modified the Makefile for Linux 5.14.5 to use gcc 9.3.0 (instead of my Centos7 system default gcc 4.8) so the Makefile used was -------Makefile----- KERNEL_SOURCE_VERSION ?= $(shell uname -r) KERNEL_TREE ?= /lib/modules/$(KERNEL_SOURCE_VERSION)/build

CC = /opt/gcc-9.3.0/bin/gcc -B/opt/binutils-2.34 -v

obj-m := dm-writeboost.o dm-writeboost-objs := \ dm-writeboost-target.o \ dm-writeboost-metadata.o \ dm-writeboost-daemon.o

all: export PATH=/opt/binutils-2.34/bin:/sbin:/bin:/usr/sbin:/usr/bin; $(MAKE) -C $(KERNEL_TREE) M=$(PWD) modules

clean: $(MAKE) -C $(KERNEL_TREE) M=$(PWD) clean ------End of Makefile---------

The last few lines of /var/lib/dkms/dm-writeboost/2.2.15/build/make.log after the failed "dkms install .." was -------------------make.log--------- ... /var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost-target.c:1899:2: error: enumeration value ‘STATUSTYPE_IMA’ not handled in switch [-Werror=switch] 1899 | switch (type) { ..... KBUILD_MODNAME="dm_writeboost"' '-D' 'KBUILD_MODNAME=kmod_dm_writeboost' '-c' '-o' '/var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost-daemon.o' '-march=x86-64' COLLECT_GCC_OPTIONS='-B' '/opt/binutils-2.34' '-v' '-nostdinc' '-I' './arch/x86/include' '-I' './arch/x86/include/generated' '-I' './include' '-I' './arch/x86/include/uapi' '-I' './arch/x86/include/generated/uapi' '-I' './include/uapi' '-I' './include/generated/uapi' '-include' './include/linux/compiler-version.h' '-include' './include/linux/kconfig.h' '-include' './include/linux/compiler_types.h' '-D' 'KERNEL' '-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' '-m64' '-falign-jumps=1' '-falign-loops=1' '-mno-80387' '-mno-fp-ret-in-387' '-mpreferred-stack-boundary=3' '-mtune=generic' '-mno-red-zone' '-mcmodel=kernel' '-Wno-sign-compare' '-fno-asynchronous-unwind-tables' '-mindirect-branch=thunk-extern' '-mindirect-branch-register' '-fno-jump-tables' '-fno-delete-null-pointer-checks' '-O2' '--param' 'allow-store-data-races=0' '-Wframe-larger-than=2048' '-fstack-protector-strong' '-Werror' '-Wimplicit-fallthrough=5' '-Wno-main' '-fno-omit-frame-pointer' '-fno-optimize-sibling-calls' '-pg' '-mrecord-mcount' '-fno-inline-functions-called-once' '-Wdeclaration-after-statement' '-Wvla' '-Wno-pointer-sign' '-Wno-maybe-uninitialized' '-Walloc-size-larger-than=18446744073709551615EiB' '-fno-strict-overflow' '-fstack-check=no' '-fconserve-stack' '-Werror=date-time' '-D' 'MODULE' '-D' 'KBUILD_BASENAME="dm_writeboost_metadata"' '-D' 'KBUILD_MODNAME="dm_writeboost"' '-D' '__KBUILD_MODNAME=kmod_dm_writeboost' '-c' '-o' '/var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost-metadata.o' '-march=x86-64' as -v -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --64 -o /var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost-metadata.o /tmp/ccyLdONJ.s GNU assembler version 2.34 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.34 COMPILER_PATH=/opt/binutils-2.34/:/opt/gcc-9.3.0/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/:/opt/gcc-9.3.0/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/:/opt/gcc-9.3.0/libexec/gcc/x86_64-pc-linux-gnu/:/opt/gcc-9.3.0/lib/gcc/x86_64-pc-linux-gnu/9.3.0/:/opt/gcc-9.3.0/lib/gcc/x86_64-pc-linux-gnu/ LIBRARY_PATH=/opt/binutils-2.34/:/opt/gcc-9.3.0/lib/gcc/x86_64-pc-linux-gnu/9.3.0/:/opt/gcc-9.3.0/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/gcc-9.3.0/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-B' '/opt/binutils-2.34' '-v' '-nostdinc' '-I' './arch/x86/include' '-I' './arch/x86/include/generated' '-I' './include' '-I' './arch/x86/include/uapi' '-I' './arch/x86/include/generated/uapi' '-I' './include/uapi' '-I' './include/generated/uapi' '-include' './include/linux/compiler-version.h' '-include' './include/linux/kconfig.h' '-include' './include/linux/compiler_types.h' '-D' 'KERNEL' '-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' '-m64' '-falign-jumps=1' '-falign-loops=1' '-mno-80387' '-mno-fp-ret-in-387' '-mpreferred-stack-boundary=3' '-mtune=generic' '-mno-red-zone' '-mcmodel=kernel' '-Wno-sign-compare' '-fno-asynchronous-unwind-tables' '-mindirect-branch=thunk-extern' '-mindirect-branch-register' '-fno-jump-tables' '-fno-delete-null-pointer-checks' '-O2' '--param' 'allow-store-data-races=0' '-Wframe-larger-than=2048' '-fstack-protector-strong' '-Werror' '-Wimplicit-fallthrough=5' '-Wno-main' '-fno-omit-frame-pointer' '-fno-optimize-sibling-calls' '-pg' '-mrecord-mcount' '-fno-inline-functions-called-once' '-Wdeclaration-after-statement' '-Wvla' '-Wno-pointer-sign' '-Wno-maybe-uninitialized' '-Walloc-size-larger-than=18446744073709551615EiB' '-fno-strict-overflow' '-fstack-check=no' '-fconserve-stack' '-Werror=date-time' '-D' 'MODULE' '-D' 'KBUILD_BASENAME="dm_writeboost_metadata"' '-D' 'KBUILD_MODNAME="dm_writeboost"' '-D' '__KBUILD_MODNAME=kmod_dm_writeboost' '-c' '-o' '/var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost-metadata.o' '-march=x86-64' cc1: all warnings being treated as errors make[3]: [/var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost-target.o] Error 1 make[2]: [/var/lib/dkms/dm-writeboost/2.2.15/build] Error 2 make[1]: *** [sub-make] Error 2 make[1]: Leaving directory `/usr/src/kernels/5.18.1-1.el7.elrepo.x86_64' make: *** [all] Error 2

The earlier lines of make.log had no errors : let me know if you need them. Sorry for the strange formating.

tanantharaman commented 2 years ago

I tried adding the fix you suggested to dm-writeboost-target.c, but now I get a different error about missing dm-writeboost.ko ----last few lines of new make.log---- ... LD [M] /var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost.o MODPOST /var/lib/dkms/dm-writeboost/2.2.15/build/Module.symvers ERROR: modpost: "mcount" [/var/lib/dkms/dm-writeboost/2.2.15/build/dm-writeboost.ko] undefined! make[3]: [/var/lib/dkms/dm-writeboost/2.2.15/build/Module.symvers] Error 1 make[3]: Deleting file /var/lib/dkms/dm-writeboost/2.2.15/build/Module.symvers' make[2]: *** [modules] Error 2 make[1]: *** [__sub-make] Error 2 make[1]: Leaving directory/usr/src/kernels/5.18.1-1.el7.elrepo.x86_64' make: *** [all] Error 2 -----End of make.log---