linux-stable/arch/xtensa/include/asm
Linus Torvalds aaff74d886 work around gcc bugs with 'asm goto' with outputs
commit 4356e9f841 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'.

but 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:24:47 +01:00
..
Kbuild parport_pc: Also enable driver for PCI systems 2022-03-18 14:01:41 +01:00
asm-offsets.h
asm-prototypes.h xtensa: add asm-prototypes.h 2023-06-12 19:48:57 -07:00
asm-uaccess.h uaccess: remove CONFIG_SET_FS 2022-02-25 09:36:06 +01:00
asmmacro.h xtensa: add asm-prototypes.h 2023-06-12 19:48:57 -07:00
atomic.h locking/atomic: xtensa: add preprocessor symbols 2023-06-05 09:57:18 +02:00
barrier.h xtensa: enable KCSAN 2022-05-01 19:51:22 -07:00
bitops.h xtensa: enable KCSAN 2022-05-01 19:51:22 -07:00
bootparam.h treewide: Replace zero-length arrays with flexible-array members 2022-02-17 07:00:39 -06:00
cache.h xtensa: add XIP kernel support 2019-11-26 11:33:38 -08:00
cacheasm.h
cacheflush.h mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
checksum.h xtensa: propagate the calling conventions change down into csum_partial_copy_generic() 2020-08-20 15:45:21 -04:00
cmpxchg.h locking/arch: Rename all internal __xchg() names to __arch_xchg() 2023-04-29 09:08:44 +02:00
coprocessor.h xtensa: support coprocessors on SMP 2022-05-01 19:51:23 -07:00
core.h xtensa: add default definition for XCHAL_HAVE_DIV32 2023-09-20 04:56:41 -07:00
current.h xtensa: Implement "current_stack_pointer" 2022-02-25 18:21:23 -08:00
delay.h
dma.h PCI: Move isa_dma_bridge_buggy out of asm/dma.h 2022-07-22 17:24:47 -05:00
elf.h xtensa: add FDPIC and static PIE support for noMMU 2022-09-13 18:28:00 -07:00
fixmap.h xtensa/mm/highmem: Make generic kmap_atomic() work correctly 2020-11-16 21:19:24 +01:00
flat.h binfmt_flat: remove the persistent argument from flat_get_addr_from_rp 2019-06-24 09:16:47 +10:00
ftrace.h xtensa: drop ARCH_WANT_FRAME_POINTERS 2023-06-12 19:48:57 -07:00
futex.h futex: Fix additional regressions 2021-12-11 23:31:51 +01:00
highmem.h xtensa/mm/highmem: Make generic kmap_atomic() work correctly 2020-11-16 21:19:24 +01:00
hw_breakpoint.h xtensa: hw_breakpoint: include header for missing prototype 2023-09-20 05:03:21 -07:00
initialize_mmu.h docs: move xtensa documentation under Documentation/arch/ 2023-03-30 13:00:22 -06:00
io.h xtensa: mm: convert to GENERIC_IOREMAP 2023-08-18 10:12:35 -07:00
irq.h xtensa: replace variant/core.h with asm/core.h 2019-05-06 17:48:55 -07:00
irqflags.h xtensa: replace CONFIG_DEBUG_KERNEL with CONFIG_DEBUG_MISC 2019-05-14 19:52:50 -07:00
jump_label.h work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
kasan.h
kmem_layout.h xtensa: use CONFIG_USE_OF instead of CONFIG_OF 2021-09-27 06:08:58 -07:00
linkage.h
mmu.h
mmu_context.h xtensa: use asm-generic/mmu_context.h for no-op implementations 2020-10-27 16:02:39 +01:00
mtd-xip.h xtensa: add XIP-aware MTD support 2023-08-28 18:25:23 -07:00
mxregs.h
nommu_context.h xtensa: use asm-generic/mmu_context.h for no-op implementations 2020-10-27 16:02:39 +01:00
page.h mm, arch: add generic implementation of pfn_valid() for FLATMEM 2023-02-09 16:51:41 -08:00
pci-bridge.h xtensa: Remove unused early_read_config_byte() et al declarations 2022-03-06 20:17:09 -08:00
pci.h PCI: Remove pci_get_legacy_ide_irq() and asm-generic/pci.h 2022-07-22 17:23:45 -05:00
perf_event.h
pgalloc.h xtensa: drop definition of PGD_ORDER 2022-07-17 17:14:44 -07:00
pgtable.h Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
platform.h xtensa: drop platform_halt and platform_power_off 2023-06-12 19:48:56 -07:00
processor.h xtensa: signal: include headers for function prototypes 2023-09-20 05:03:19 -07:00
ptrace.h xtensa: ptrace: add prototypes to <asm/ptrace.h> 2023-09-20 05:03:19 -07:00
regs.h xtensa: clean up PS_WOE_BIT usage 2019-09-01 13:11:57 -07:00
seccomp.h xtensa: Enable seccomp architecture tracking 2020-11-20 11:16:35 -08:00
sections.h xtensa: add XIP-aware MTD support 2023-08-28 18:25:23 -07:00
serial.h
shmparam.h
signal.h
smp.h xtensa: smp: add headers for missing function prototypes 2023-09-20 05:03:20 -07:00
spinlock.h locking/arch: Move qrwlock.h include after qspinlock.h 2021-02-11 07:59:54 -05:00
spinlock_types.h locking: Allow to include asm/spinlock_types.h from linux/spinlock_types_raw.h 2021-12-07 15:14:12 +01:00
stackprotector.h stackprotector: actually use get_random_canary() 2022-11-18 02:18:10 +01:00
stacktrace.h xtensa: Implement "current_stack_pointer" 2022-02-25 18:21:23 -08:00
string.h xtensa: drop bcopy implementation 2023-06-12 19:48:57 -07:00
switch_to.h
syscall.h arch: remove unused function syscall_set_arguments() 2021-09-14 16:06:20 +02:00
sysmem.h
thread_info.h xtensa: improve call0 ABI probing 2022-05-17 03:35:43 -07:00
timex.h xtensa: use fallback for random_get_entropy() instead of zero 2022-05-13 23:59:23 +02:00
tlb.h xtensa: tlb: include <asm/tlb.h> for missing prototype 2023-09-20 05:03:21 -07:00
tlbflush.h mm: update legacy flush_tlb_* to use vma 2021-06-29 10:53:52 -07:00
traps.h xtensa: add load/store exception handler 2023-06-13 21:56:27 -07:00
uaccess.h uaccess: remove CONFIG_SET_FS 2022-02-25 09:36:06 +01:00
ucontext.h
unistd.h arch: handle arches who do not yet define clone3 2019-06-21 01:54:53 +02:00
vectors.h xtensa: reorganize vectors placement 2020-02-04 21:57:02 -08: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