On Mon, Jul 6, 2020 at 11:02 AM Sedat Dilek <[email protected]> wrote: > > On Mon, Jul 6, 2020 at 10:43 AM Sedat Dilek <[email protected]> wrote: > > > > On Mon, Jul 6, 2020 at 10:39 AM Peter Zijlstra <[email protected]> wrote: > > > > > > On Mon, Jul 06, 2020 at 09:09:55AM +0200, Sedat Dilek wrote: > > > > [ Please CC me I am not subscribed to this mailing-list ] > > > > > > > > Hi Josh and Peter, > > > > > > > > today I switched over from Linux v5.7.y to Linux v5.8-rc4 and built > > > > the first time with GCC version 10 on Debian/testing AMD64. > > > > > > > > $ cat /proc/version > > > > Linux version 5.8.0-rc4-1-amd64-gcc10 ([email protected]@iniza) > > > > (gcc-10 (Debian 10.1.0-4) 10.1.0, GNU ld (GNU Binutils for Debian) > > > > 2.34) #1~bullseye+dileks1 SMP 2020-07-06 > > > > > > > > I see these objtool warnings (which are new to me): > > > > > > > > $ grep warning: build-log_5.8.0-rc4-1-amd64-gcc10.txt | sort > > > > arch/x86/kernel/cpu/mce/core.o: warning: objtool: mce_panic()+0x118: > > > > unreachable instruction > > > > drivers/atm/horizon.o: warning: objtool: interrupt_handler()+0x19f: > > > > unreachable instruction > > > > drivers/message/fusion/mptbase.o: warning: objtool: > > > > mpt_Soft_Hard_ResetHandler()+0x33a: unreachable instruction > > > > drivers/scsi/aic7xxx/aic79xx_core.o: warning: objtool: > > > > ahd_intr.part.0()+0x10f: unreachable instruction > > > > drivers/scsi/pcmcia/aha152x_core.o: warning: objtool: run()+0x4c0: > > > > unreachable instruction > > > > fs/btrfs/backref.o: warning: objtool: > > > > btrfs_backref_finish_upper_links()+0x309: unreachable instruction > > > > fs/btrfs/extent_io.o: warning: objtool: __set_extent_bit.cold()+0xc: > > > > unreachable instruction > > > > fs/btrfs/relocation.o: warning: objtool: > > > > update_backref_cache.part.0()+0x1de: unreachable instruction > > > > kernel/exit.o: warning: objtool: __x64_sys_exit_group()+0x14: > > > > unreachable instruction > > > > net/core/skbuff.o: warning: objtool: skb_push.cold()+0x15: unreachable > > > > instruction > > > > > > That's more CONFIG_LIVEPATCH=y wreckage I expect. The problem is that > > > GCC -flive-patching= thing wreck the propagation of the noreturn. > > > > > > This really is a compiler issue and we've not managed a sensible > > > work-around in objtool. > > > > Thanks for the quick response. > > > > I have... > > > > CONFIG_LIVEPATCH=y > > > > ...and see in my build-log: > > > > -flive-patching=inline-clone > > > > - Sedat - > > OK, I found some discussions in "Re: linux-next: Tree for May 21 > (objtool warnings)" [1]. > > GCC docs say [2]: > - BOQ (Begin Of Quote) - > [ -flive-patching=level ] > > The level argument should be one of the following: > > [ ‘inline-clone’ ] > > Only enable inlining and cloning optimizations, which includes > inlining, cloning, interprocedural scalar replacement of aggregates > and partial inlining. As a result, when patching a function, all its > callers and its clones’ callers are impacted, therefore need to be > patched as well. > > -flive-patching=inline-clone disables the following optimization flags: > > -fwhole-program -fipa-pta -fipa-reference -fipa-ra > -fipa-icf -fipa-icf-functions -fipa-icf-variables > -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable > -fipa-stack-alignment > > [ ‘inline-only-static’ ] > > Only enable inlining of static functions. As a result, when patching a > static function, all its callers are impacted and so need to be > patched as well. > > In addition to all the flags that -flive-patching=inline-clone > disables, -flive-patching=inline-only-static disables the following > additional optimization flags: > > -fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp > > When -flive-patching is specified without any value, the default value > is inline-clone. > > This flag is disabled by default. > > Note that -flive-patching is not supported with link-time optimization > (-flto). > - EOQ (End of Quote) - > > Josh says in [3]: > > > The issue here is that with -fno-ipa-pure-const, GCC no longer > > automatically detects that the static inline function is noreturn, so it > > emits unreachable instructions after a call to it. > > - Sedat - > > [1] https://marc.info/?t=159011496400002&r=1&w=2 > [2] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html > [3] https://marc.info/?l=linux-next&m=159059217601108&w=2
[ arch/x86/kernel/cpu/mce/core.o ] After "-flive-patching=inline-clone" I manually added in the make line: #1: -fno-ipa-pure-const $ ./tools/objtool/objtool orc generate --no-fp --retpoline --uaccess arch/x86/kernel/cpu/mce/core.o arch/x86/kernel/cpu/mce/core.o: warning: objtool: mce_panic()+0x118: unreachable instruction #2: -fipa-pure-const $ gcc-10 -Wp,-MMD,arch/x86/kernel/cpu/mce/.core.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/10/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__ -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 -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 -mskip-rax-setup -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 -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-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -gdwarf-4 -gz=zlib -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -fipa-pure-const -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -fcf-protection=none -Wno-packed-not-aligned -DKBUILD_MODFILE='"arch/x86/kernel/cpu/mce/core"' -DKBUILD_BASENAME='"core"' -DKBUILD_MODNAME='"core"' -c -o arch/x86/kernel/cpu/mce/core.o arch/x86/kernel/cpu/mce/core.c cc1: error: ‘-fipa-pure-const’ is incompatible with ‘-flive-patching=inline-only-static|inline-clone’ - Sedat -

