linux-stable/arch/arc/include/asm
Linus Torvalds f70efe54b9 work around gcc bugs with 'asm goto' with outputs
commit 68fb3ca0e4 upstream.

We've had issues with gcc and 'asm goto' before, and we created a
'asm_volatile_goto()' macro for that in the past: see commits
3f0116c323 ("compiler/gcc4: Add quirk for 'asm goto' miscompilation
bug") and a9f180345f ("compiler/gcc4: Make quirk for
asm_volatile_goto() unconditional").

Then, much later, we ended up removing the workaround in commit
43c249ea0b ("compiler-gcc.h: remove ancient workaround for gcc PR
58670") because we no longer supported building the kernel with the
affected gcc versions, but we left the macro uses around.

Now, Sean Christopherson reports a new version of a very similar
problem, which is fixed by re-applying that ancient workaround.  But the
problem in question is limited to only the 'asm goto with outputs'
cases, so instead of re-introducing the old workaround as-is, let's
rename and limit the workaround to just that much less common case.

It looks like there are at least two separate issues that all hit in
this area:

 (a) some versions of gcc don't mark the asm goto as 'volatile' when it
     has outputs:

        https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98619
        https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110420

     which is easy to work around by just adding the 'volatile' by hand.

 (b) Internal compiler errors:

        https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110422

     which are worked around by adding the extra empty 'asm' as a
     barrier, as in the original workaround.

but the problem Sean sees may be a third thing since it involves bad
code generation (not an ICE) even with the manually added 'volatile'.

The same old workaround works for this case, even if this feels a
bit like voodoo programming and may only be hiding the issue.

Reported-and-tested-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/all/20240208220604.140859-1-seanjc@google.com/
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Uros Bizjak <ubizjak@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Andrew Pinski <quic_apinski@quicinc.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-23 09:12:28 +01:00
..
arcregs.h ARC: allow userspace DSP applications to use AGU extensions 2020-03-16 10:30:49 -07:00
asm-offsets.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
asserts.h ARC: allow userspace DSP applications to use AGU extensions 2020-03-16 10:30:49 -07:00
atomic-llsc.h ARC: atomics: Add compiler barrier to atomic operations... 2023-09-19 12:28:04 +02:00
atomic-spinlock.h ARC: atomic: !LLSC: use int data type consistently 2021-08-24 14:25:46 -07:00
atomic.h ARC: atomic_cmpxchg/atomic_xchg: implement relaxed variants 2021-08-24 14:25:47 -07:00
atomic64-arcv2.h ARC: atomics: Add compiler barrier to atomic operations... 2023-09-19 12:28:04 +02:00
barrier.h ARC: [plat-eznps]: Drop support for EZChip NPS platform 2020-10-05 21:02:29 -07:00
bitops.h ARC: bitops: Change __fls to return unsigned long 2022-10-17 16:32:12 -07:00
bug.h arc: add show_stack_loglvl() 2020-06-09 09:39:10 -07:00
cache.h ARC: mm: move mmu/cache externs out to setup.h 2021-08-24 14:25:48 -07:00
cacheflush.h Add linux/cacheflush.h 2021-11-17 10:36:15 -05:00
checksum.h arc: Prefer unsigned int to bare use of unsigned 2021-08-03 18:58:33 -07:00
cmpxchg.h ARC: atomic_cmpxchg/atomic_xchg: implement relaxed variants 2021-08-24 14:25:47 -07:00
current.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
delay.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
disasm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
dma.h PCI: Move isa_dma_bridge_buggy out of asm/dma.h 2022-07-22 17:24:47 -05:00
dsp-impl.h ARC: guard dsp early init against non ARCv2 2020-04-29 11:53:51 -07:00
dsp.h ARC: allow userspace DSP applications to use AGU extensions 2020-03-16 10:30:49 -07:00
dwarf.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
elf.h ARC: elf: use right ELF_ARCH 2020-06-16 12:56:37 -07:00
entry-arcv2.h ARC: entry: comment 2020-04-12 22:45:35 -07:00
entry-compact.h ARC: Fix comment typo 2022-10-17 16:32:11 -07:00
entry.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
exec.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
fb.h
fpu.h ARC: fpu: fix randconfig build error reported by 0-day test service 2020-02-09 22:17:22 -08:00
futex.h futex: arch_futex_atomic_op_inuser() calling conventions change 2020-03-27 23:58:51 -04:00
highmem.h arc/mm/highmem: Use generic kmap atomic implementation 2020-11-06 23:14:55 +01:00
hugepage.h arch: Add pmd_pfn() where it is missing 2022-03-21 12:59:02 -04:00
io.h arc: iounmap() arg is volatile 2022-10-17 16:32:12 -07:00
irq.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
irqflags-arcv2.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
irqflags-compact.h arc: Replace lkml.org links with lore 2021-12-28 19:48:49 -08:00
irqflags.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
jump_label.h work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:12:28 +01:00
Kbuild local64.h: make <asm/local64.h> mandatory 2020-12-29 15:36:49 -08:00
kdebug.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
kgdb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
kprobes.h kprobes: treewide: Make it harder to refer kretprobe_trampoline directly 2021-09-30 21:24:06 -04:00
linkage.h ARC: define ASM_NL and __ALIGN(_STR) outside #ifdef __ASSEMBLY__ guard 2023-07-19 16:21:42 +02:00
mach_desc.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
mmu-arcv2.h ARC: mm: disintegrate mmu.h (arcv2 bits out) 2021-08-25 15:53:19 -07:00
mmu.h ARC: mm: disintegrate mmu.h (arcv2 bits out) 2021-08-25 15:53:19 -07:00
mmu_context.h ARC: mm: move MMU specific bits out of ASID allocator 2021-08-24 14:25:48 -07:00
module.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
page.h ARC: mm: support 4 levels of page tables 2021-08-26 13:43:19 -07:00
pci.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
perf_event.h ARC: bpf: define uapi for BPF_PROG_TYPE_PERF_EVENT program type 2022-04-26 09:35:28 -07:00
pgalloc.h ARC: mm: support 4 levels of page tables 2021-08-26 13:43:19 -07:00
pgtable-bits-arcv2.h arc/mm: enable ARCH_HAS_VM_GET_PAGE_PROT 2022-07-17 17:14:40 -07:00
pgtable-levels.h ARC: mm: fix leakage of memory allocated for PTE 2022-10-17 16:32:12 -07:00
pgtable.h ARC: fix potential build snafu 2021-10-15 18:06:32 -07:00
processor.h kernel: exit: cleanup release_thread() 2022-09-11 21:55:07 -07:00
ptrace.h ARC: enable HAVE_REGS_AND_STACK_ACCESS_API feature 2022-04-25 13:09:47 -07:00
sections.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
serial.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
setup.h ARC: mm: move mmu/cache externs out to setup.h 2021-08-24 14:25:48 -07:00
shmparam.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
smp.h ARC: switch to generic bitops 2021-08-24 14:25:47 -07:00
spinlock.h ARC: [plat-eznps]: Drop support for EZChip NPS platform 2020-10-05 21:02:29 -07:00
spinlock_types.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
stacktrace.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
string.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
switch_to.h ARC: [plat-eznps]: Drop support for EZChip NPS platform 2020-10-05 21:02:29 -07:00
syscall.h ARC: implement syscall tracepoints 2022-04-25 13:09:47 -07:00
syscalls.h ARC: wireup clone3 syscall 2020-01-15 16:08:12 -08:00
thread_info.h ARC: implement syscall tracepoints 2022-04-25 13:09:47 -07:00
timex.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tlb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tlbflush.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
uaccess.h uaccess: remove CONFIG_SET_FS 2022-02-25 09:36:06 +01:00
unaligned.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
unwind.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
vermagic.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
vmalloc.h mm/vmalloc: Add empty <asm/vmalloc.h> headers and use them from <linux/vmalloc.h> 2019-12-10 10:12:55 +01:00