Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 726660 - sys-kernel/gentoo-sources-5.7.0 - arch/x86/events/amd/ibs.o: warning: objtool: perf_ibs_init()+0x1f: can't find jump dest instruction at .text+0x31
Summary: sys-kernel/gentoo-sources-5.7.0 - arch/x86/events/amd/ibs.o: warning: objtool...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: https://bugzilla.kernel.org/show_bug....
Whiteboard:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2020-06-01 15:37 UTC by ernsteiswuerfel
Modified: 2020-07-02 11:16 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (file_726660.txt,6.79 KB, text/plain)
2020-06-01 15:37 UTC, ernsteiswuerfel
Details
kernel .config (kernel 5.7.0, Supermicro H8SGL, Opteron 6380) (config_570_opt,101.98 KB, text/plain)
2020-06-01 15:41 UTC, ernsteiswuerfel
Details
Drop TBM for bdver{2,3,4} (5012_enable-cpu-optimizations-for-gcc91-fix.patch,1.00 KB, patch)
2020-06-14 10:50 UTC, Maxim Britov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel archtester 2020-06-01 15:37:07 UTC
Created attachment 643046 [details]
emerge --info

.config was copied over from gentoo-sources-5.6.15 + make oldconfig.

 # make
  HOSTCC  scripts/basic/fixdep
  HOSTCC  arch/x86/tools/relocs_32.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_common.o
  HOSTLD  arch/x86/tools/relocs
  HOSTCXX -fPIC scripts/gcc-plugins/structleak_plugin.o
  HOSTLLD -shared scripts/gcc-plugins/structleak_plugin.so
  HOSTCC  scripts/sorttable
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/extract-cert
  HOSTCC  scripts/mod/mk_elfconfig
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      kernel/bounds.s
  CC      arch/x86/kernel/asm-offsets.s
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  HOSTCC   /usr/src/linux-5.7.0-gentoo/tools/objtool/fixdep.o
  HOSTLD   /usr/src/linux-5.7.0-gentoo/tools/objtool/fixdep-in.o
  LINK     /usr/src/linux-5.7.0-gentoo/tools/objtool/fixdep
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/exec-cmd.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/help.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/pager.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/parse-options.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/run-command.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/sigchain.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/subcmd-config.o
  LD       /usr/src/linux-5.7.0-gentoo/tools/objtool/libsubcmd-in.o
  AR       /usr/src/linux-5.7.0-gentoo/tools/objtool/libsubcmd.a
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/arch/x86/decode.o
  LD       /usr/src/linux-5.7.0-gentoo/tools/objtool/arch/x86/objtool-in.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/builtin-check.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/builtin-orc.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/check.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/orc_gen.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/orc_dump.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/elf.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/special.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/objtool.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/libstring.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/libctype.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/str_error_r.o
  CC       /usr/src/linux-5.7.0-gentoo/tools/objtool/librbtree.o
  LD       /usr/src/linux-5.7.0-gentoo/tools/objtool/objtool-in.o
  LINK     /usr/src/linux-5.7.0-gentoo/tools/objtool/objtool
  CHK     include/generated/compile.h
  CC      init/main.o
  CC      init/version.o
  CC      init/do_mounts.o
  CC      init/noinitramfs.o
  CC      init/calibrate.o
  CC      init/init_task.o
  AR      init/built-in.a
  AR      usr/built-in.a
  CC      arch/x86/entry/vdso/vma.o
  CC      arch/x86/entry/vdso/vdso32-setup.o
  LDS     arch/x86/entry/vdso/vdso.lds
  AS      arch/x86/entry/vdso/vdso-note.o
  CC      arch/x86/entry/vdso/vclock_gettime.o
  CC      arch/x86/entry/vdso/vgetcpu.o
  VDSO    arch/x86/entry/vdso/vdso64.so.dbg
  OBJCOPY arch/x86/entry/vdso/vdso64.so
  HOSTCC  arch/x86/entry/vdso/vdso2c
  VDSO2C  arch/x86/entry/vdso/vdso-image-64.c
  CC      arch/x86/entry/vdso/vdso-image-64.o
  LDS     arch/x86/entry/vdso/vdso32/vdso32.lds
  CC      arch/x86/entry/vdso/vdso32/vclock_gettime.o
  AS      arch/x86/entry/vdso/vdso32/note.o
  AS      arch/x86/entry/vdso/vdso32/system_call.o
  AS      arch/x86/entry/vdso/vdso32/sigreturn.o
  VDSO    arch/x86/entry/vdso/vdso32.so.dbg
  OBJCOPY arch/x86/entry/vdso/vdso32.so
  VDSO2C  arch/x86/entry/vdso/vdso-image-32.c
  CC      arch/x86/entry/vdso/vdso-image-32.o
  AR      arch/x86/entry/vdso/built-in.a
  CC      arch/x86/entry/vsyscall/vsyscall_64.o
arch/x86/entry/vsyscall/vsyscall_64.o: warning: objtool: emulate_vsyscall()+0x3a2: stack state mismatch: cfa1=7+56 cfa2=7+48
  AS      arch/x86/entry/vsyscall/vsyscall_emu_64.o
  AR      arch/x86/entry/vsyscall/built-in.a
  AS      arch/x86/entry/entry_64.o
  AS      arch/x86/entry/thunk_64.o
  CC      arch/x86/entry/syscall_64.o
  CC      arch/x86/entry/common.o
  AS      arch/x86/entry/entry_64_compat.o
  CC      arch/x86/entry/syscall_32.o
  AR      arch/x86/entry/built-in.a
  CC      arch/x86/events/amd/core.o
arch/x86/events/amd/core.o: warning: objtool: amd_pmu_handle_irq()+0x28: stack state mismatch: cfa1=7+8 cfa2=7+0
  CC      arch/x86/events/amd/uncore.o
  CC      arch/x86/events/amd/ibs.o
arch/x86/events/amd/ibs.o: warning: objtool: perf_ibs_init()+0x1f: can't find jump dest instruction at .text+0x31
make[3]: *** [scripts/Makefile.build:267: arch/x86/events/amd/ibs.o] Fehler 255
make[3]: *** Datei „arch/x86/events/amd/ibs.o“ wird gelöscht
make[2]: *** [scripts/Makefile.build:488: arch/x86/events/amd] Fehler 2
make[1]: *** [scripts/Makefile.build:488: arch/x86/events] Fehler 2
make: *** [Makefile:1729: arch/x86] Error 2
Comment 1 ernsteiswuerfel archtester 2020-06-01 15:41:12 UTC
Created attachment 643048 [details]
kernel .config (kernel 5.7.0, Supermicro H8SGL, Opteron 6380)
Comment 2 Ooblick 2020-06-02 16:28:57 UTC
I'm seeing the same errors on my AMD FX-6350 (Piledriver), which had CONFIG_MNATIVE=y set. I still see it changing to CONFIG_MPILEDRIVER=y. I believe your Opteron 6380 is also a Piledriver CPU.

Based on https://bugs.gentoo.org/642924#c21 changing to CONFIG_MBULLDOZER=y "fixed" the issue.
Comment 3 Maxim Britov 2020-06-02 19:42:45 UTC
5012_enable-cpu-optimizations-for-gcc91.patch

--- a/arch/x86/Makefile 2019-12-15 18:16:08.000000000 -0500
+        cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1)
+        cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2)
+        cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3)
+        cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4)


everything with: -march=bdverX
fails for me gcc8/gcc9/gcc10
Comment 4 ernsteiswuerfel archtester 2020-06-03 17:11:51 UTC
(In reply to Ooblick from comment #2)
> I'm seeing the same errors on my AMD FX-6350 (Piledriver), which had
> CONFIG_MNATIVE=y set. I still see it changing to CONFIG_MPILEDRIVER=y. I
> believe your Opteron 6380 is also a Piledriver CPU.
> 
> Based on https://bugs.gentoo.org/642924#c21 changing to CONFIG_MBULLDOZER=y
> "fixed" the issue.
I can confirm this. Setting CONFIG_MBULLDOZER=y works.

Yes, the Opteron 6380 is a Piledriver class CPU. <gentoo-sources-5.7.0 work fine with CONFIG_MNATIVE=y or CONFIG_MPILEDRIVER=y.
Comment 5 Jiří Moravec 2020-06-06 20:33:04 UTC
I was able to compile 5.7 kernel with this change in arch/x86/Makefile:

@@ -127,7 +127,7
         cflags-$(CONFIG_MBOBCAT) += $(call cc-option,-march=btver1)
         cflags-$(CONFIG_MJAGUAR) += $(call cc-option,-march=btver2)
         cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1)
-        cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2)
+        cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2 -mtune=bdver2)
         cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3)
         cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4)
         cflags-$(CONFIG_MZEN) += $(call cc-option,-march=znver1)
Comment 6 Bernd 2020-06-09 16:43:23 UTC
I'm having the same issue on 5.7.0 as well as 5.7.1 with an AMD FX 8350 (Bulldozer) chip. Changing from CONFIG_MNATIVE=y to CONFIG_MBULLDOZER=y solved it, like in comment #2 and comment #4.
Comment 7 Maxim Britov 2020-06-14 10:50:52 UTC
Created attachment 644620 [details, diff]
Drop TBM for bdver{2,3,4}
Comment 8 ernsteiswuerfel archtester 2020-06-14 11:20:24 UTC
(In reply to Maxim Britov from comment #7)
> Created attachment 644620 [details, diff] [details, diff]
> Drop TBM for bdver{2,3,4}
Interesting! So the gcc backend for this instruction is broken? Or kernels <5.7.0 do not make gcc generate this instruction?

gcc's manual says TBM is an instruction only found in bdver{2,3,4}:
>The following built-in functions are available when -mtbm is used. Both of them
>generate the immediate form of the bextr machine instruction.
>unsigned int __builtin_ia32_bextri_u32 (unsigned int,
>                                        const unsigned int);
>unsigned long long __builtin_ia32_bextri_u64 (unsigned long long,
>                                              const unsigned long long);
Comment 10 ernsteiswuerfel archtester 2020-06-17 22:19:15 UTC
(In reply to Maxim Britov from comment #9)
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95671#c8
Thanks for taking it upstream!
Comment 11 Maxim Britov 2020-07-01 22:14:04 UTC
`
sys-kernel/gentoo-sources: Linux 5.7.7 and cpu opt patch update Mike Pagano
sys-kernel/gentoo-sources: Linux 5.4.50 and cpu opt patch update Mike Pagano
sys-kernel/gentoo-sources: Linux 4.19.131 and cpu opt patch update Mike Pagano

sys-kernel/gentoo-sources: Linux 4.14.187 and update to cpu opt patch Mike Pagano
`
Comment 12 ernsteiswuerfel archtester 2020-07-02 11:16:55 UTC
I can confirm that 5.7.7 builds fine again with Piledriver setting for my Opteron 6380 as Maxims suggested config was integrated into genpatches-5.7-8.experimental and the other stable releases.