Messages in this thread | | | From | Nick Desaulniers <> | Date | Mon, 22 Jun 2020 11:15:44 -0700 | Subject | Re: [PATCH 2/2] selftests/fpu: Add an FPU selftest |
| |
On Mon, Jun 22, 2020 at 10:04 AM Borislav Petkov <bp@alien8.de> wrote: > > On Sun, Jun 21, 2020 at 03:55:00AM +0800, kernel test robot wrote: > > Hi Borislav, > > > > Thank you for the patch! Yet something to improve: > > > > [auto build test ERROR on kselftest/next] > > [also build test ERROR on tip/auto-latest linus/master v5.8-rc1 next-20200618] > > [cannot apply to tip/x86/core] > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > And when submitting patch, we suggest to use as documented in > > https://git-scm.com/docs/git-format-patch] > > > > url: https://github.com/0day-ci/linux/commits/Borislav-Petkov/x86-FPU-FPU-sanitization-for-in-kernel-use/20200620-014453 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next > > config: x86_64-allmodconfig (attached as .config) > > compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 487ca07fcc75d52755c9fe2ee05bcb3b6eeeec44) > > reproduce (this is a W=1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # install x86_64 cross compiling tool for clang build > > # apt-get install binutils-x86-64-linux-gnu > > # save the attached .config to linux build tree > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot <lkp@intel.com> > > > > All errors (new ones prefixed by >>, old ones prefixed by <<): > > > > >> ERROR: modpost: "__gtdf2" [lib/test_fpu.ko] undefined! > > >> ERROR: modpost: "__divdf3" [lib/test_fpu.ko] undefined! > > >> ERROR: modpost: "__muldf3" [lib/test_fpu.ko] undefined! > > >> ERROR: modpost: "__adddf3" [lib/test_fpu.ko] undefined! > > Hmm, the point here is to actually have SSE* code in a kernel module for > testing. And gcc does the right thing, see below. > > LLVM folks, how can I make llvm not call those library functions and > actually spit out SSE* code? > > Full build command is: > > /mnt/smr/share/src/llvm/tc-build/install/bin/clang-11 -Wp,-MMD,lib/.test_fpu.o.d -nostdinc -isystem /mnt/smr/share/src/llvm/tc-build/install/lib/clang/11.0.0/include -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/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Qunused-arguments -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -no-integrated-as -Werror=unknown-warning-option -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -mno-80387 -mstack-alignment=8 -march=k8 -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mretpoline-external-thunk -fno-delete-null-pointer-checks -Wno-frame-address -Wno-address-of-packed-member -O2 -Wframe-larger-than=2048 -fstack-protector -Wno-format-invalid-specifier -Wno-gnu -mno-global-merge -Wno-unused-const-variable -g -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-merge-all-constants -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -fmacro-prefix-map=./= -fcf-protection=none -Wno-initializer-overrides -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-pointer-to-enum-cast -Wno-tautological-constant-out-of-range-compare -mhard-float -msse -DMODULE -DKBUILD_BASENAME='"test_fpu"' -DKBUILD_MODNAME='"test_fpu"' -c -o lib/test_fpu.o lib/test_fpu.c
Add -msse2. See also: commit e8a170ff9a35 ("drm/amdgpu: enable -msse2 for GCC 7.1+ users") potentially relevant, though less so: commit 00db297106e8 ("drm/amdgpu: fix stack alignment ABI mismatch for GCC 7.1+") commit c868868f6b6a ("drm/amdgpu: fix stack alignment ABI mismatch for Clang") and may your stacks always share the same alignment.
> > Thx. > > --- /tmp/test_fpu.s.gcc 2020-06-22 18:51:25.828615337 +0200 > +++ /tmp/test_fpu.s.llvm-11 2020-06-22 18:50:35.080614534 +0200 > @@ -1,74 +1,49 @@ > -test_fpu_get: > - pushq %r12 # > - pushq %rbx # > - movq %rsi, %rbx # tmp119, val > - subq $56, %rsp #, > -# lib/test_fpu.c:58: kernel_fpu_begin(); > - call kernel_fpu_begin # > -# lib/test_fpu.c:32: a = 4.0; > - movlpd .LC1(%rip), %xmm0 #, tmp106 > - movsd %xmm0, (%rsp) # tmp106, a > -# lib/test_fpu.c:33: b = 1e-15; > - movlpd .LC2(%rip), %xmm0 #, tmp107 > - movsd %xmm0, 8(%rsp) # tmp107, b > -# lib/test_fpu.c:34: c = 1e-310; > - movlpd .LC3(%rip), %xmm0 #, tmp108 > - movsd %xmm0, 16(%rsp) # tmp108, c > -# lib/test_fpu.c:37: d = a + b; > - movlpd (%rsp), %xmm0 # a, a.2_8 > - movlpd 8(%rsp), %xmm1 # b, b.3_9 > - addsd %xmm1, %xmm0 # b.3_9, _10 > -# lib/test_fpu.c:37: d = a + b; > - movsd %xmm0, 24(%rsp) # _10, d > -# lib/test_fpu.c:40: e = a + b / 2; > - movlpd 8(%rsp), %xmm0 # b, b.4_11 > -# lib/test_fpu.c:40: e = a + b / 2; > - movlpd (%rsp), %xmm1 # a, a.5_13 > -# lib/test_fpu.c:40: e = a + b / 2; > - mulsd .LC4(%rip), %xmm0 #, tmp109 > -# lib/test_fpu.c:40: e = a + b / 2; > - addsd %xmm1, %xmm0 # a.5_13, _14 > -# lib/test_fpu.c:40: e = a + b / 2; > - movsd %xmm0, 32(%rsp) # _14, e > -# lib/test_fpu.c:43: f = b / c; > - movlpd 8(%rsp), %xmm0 # b, b.6_15 > - movlpd 16(%rsp), %xmm1 # c, c.7_16 > - divsd %xmm1, %xmm0 # c.7_16, _17 > -# lib/test_fpu.c:43: f = b / c; > - movsd %xmm0, 40(%rsp) # _17, f > -# lib/test_fpu.c:46: g = a + c * f; > - movlpd 16(%rsp), %xmm0 # c, c.8_18 > - movlpd 40(%rsp), %xmm2 # f, f.9_19 > -# lib/test_fpu.c:46: g = a + c * f; > - movlpd (%rsp), %xmm1 # a, a.10_21 > -# lib/test_fpu.c:46: g = a + c * f; > - mulsd %xmm2, %xmm0 # f.9_19, tmp111 > -# lib/test_fpu.c:46: g = a + c * f; > - addsd %xmm1, %xmm0 # a.10_21, _22 > -# lib/test_fpu.c:46: g = a + c * f; > - movsd %xmm0, 48(%rsp) # _22, g > -# lib/test_fpu.c:48: if (d > a && e > a && g > a) > - movlpd 24(%rsp), %xmm1 # d, d.11_23 > - movlpd (%rsp), %xmm0 # a, a.12_24 > -# lib/test_fpu.c:48: if (d > a && e > a && g > a) > - comisd %xmm0, %xmm1 # a.12_24, d.11_23 > - jbe .L15 #, > -# lib/test_fpu.c:48: if (d > a && e > a && g > a) > - movlpd 32(%rsp), %xmm1 # e, e.13_25 > - movlpd (%rsp), %xmm0 # a, a.14_26 > -# lib/test_fpu.c:48: if (d > a && e > a && g > a) > - comisd %xmm0, %xmm1 # a.14_26, e.13_25 > - jbe .L15 #, > -# lib/test_fpu.c:48: if (d > a && e > a && g > a) > - movlpd 48(%rsp), %xmm1 # g, g.15_27 > -# lib/test_fpu.c:51: return -EINVAL; > - movl $0, %r12d #, tmp117 > - movl $-22, %eax #, tmp118 > -# lib/test_fpu.c:48: if (d > a && e > a && g > a) > - movlpd (%rsp), %xmm0 # a, a.16_28 > -# lib/test_fpu.c:51: return -EINVAL; > - comisd %xmm0, %xmm1 # a.16_28, g.15_27 > - cmovbe %eax, %r12d # tmp117,, tmp118, <retval> > -.L4: > -# lib/test_fpu.c:60: kernel_fpu_end(); > - call kernel_fpu_end # > +test_fpu_get: # @test_fpu_get > +# %bb.0: > + pushq %rbp > + pushq %rbx > + subq $56, %rsp > + movq %rsi, %rbx > + callq kernel_fpu_begin > + movabsq $4616189618054758400, %rax # imm = 0x4010000000000000 > + movq %rax, (%rsp) > + movabsq $4382569440205035030, %rax # imm = 0x3CD203AF9EE75616 > + movq %rax, 8(%rsp) > + movabsq $20240225330731, %rax # imm = 0x12688B70E62B > + movq %rax, 16(%rsp) > + movq (%rsp), %rdi > + movq 8(%rsp), %rsi > + callq __adddf3 > + movq %rax, 48(%rsp) > + movq (%rsp), %rbp > + movq 8(%rsp), %rdi > + movabsq $4602678819172646912, %rsi # imm = 0x3FE0000000000000 > + callq __muldf3 > + movq %rbp, %rdi > + movq %rax, %rsi > + callq __adddf3 > + movq %rax, 40(%rsp) > + movq 8(%rsp), %rdi > + movq 16(%rsp), %rsi > + callq __divdf3 > + movq %rax, 32(%rsp) > + movq (%rsp), %rbp > + movq 16(%rsp), %rdi > + movq 32(%rsp), %rsi > + callq __muldf3 > + movq %rbp, %rdi > + movq %rax, %rsi > + callq __adddf3 > + movq %rax, 24(%rsp) > + movq 48(%rsp), %rdi > + movq (%rsp), %rsi > + callq __gtdf2 > + testl %eax, %eax > + jle .LBB3_3 > +# %bb.1: > + movq 40(%rsp), %rdi > + movq (%rsp), %rsi > + callq __gtdf2 > + testl %eax, %eax > + jle .LBB3_3 > +# %bb.2: > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200622170446.GG32200%40zn.tnic.
-- Thanks, ~Nick Desaulniers
| |