linux-stable/arch/powerpc/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
..
book3s powerpc/64s: Fix __pte_needs_flush() false positive warning 2023-04-06 12:10:54 +02:00
nohash powerpc/40x: Remove stale PTE_ATOMIC_UPDATES macro 2023-11-20 11:52:12 +01:00
vdso powerpc/64s: Make POWER10 and later use pause_short in cpu_relax loops 2022-09-28 19:22:10 +10:00
8xx_immap.h
accounting.h
agp.h
archrandom.h
asm-compat.h
asm-const.h
asm-offsets.h
asm-prototypes.h powerpc/64s: early boot machine check handler 2022-09-28 19:22:13 +10:00
async_tx.h
atomic.h
backlight.h
barrier.h powerpc: Remove CONFIG_PPC_FSL_BOOK3E 2022-09-26 23:00:13 +10:00
bitops.h
bootx.h
bpf_perf_event.h
btext.h
bug.h work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:12:28 +01:00
cache.h
cacheflush.h
cell-pmu.h
cell-regs.h
checksum.h
clocksource.h
cmpxchg.h
code-patching-asm.h
code-patching.h
compat.h
context_tracking.h
copro.h
cpm.h
cpm1.h
cpm2.h
cpu_has_feature.h
cpu_setup.h powerpc/cputable: Move __cpu_setup() prototypes out of cputable.h 2022-09-26 22:26:49 +10:00
cpufeature.h
cpuidle.h
cputable.h powerpc: Change CONFIG_E500 to CONFIG_PPC_E500 2022-09-26 23:00:13 +10:00
cputhreads.h
cputime.h
crashdump-ppc64.h
current.h
dbdma.h
dbell.h
dcr-generic.h
dcr-mmio.h
dcr-native.h
dcr-regs.h
dcr.h
debug.h
delay.h
device.h
disassemble.h
dma-direct.h
dma.h
drmem.h
dt_cpu_ftrs.h
dtl.h
edac.h
eeh.h
eeh_event.h
ehv_pic.h
elf.h
elfnote.h
emergency-restart.h
emulated_ops.h
epapr_hcalls.h
exception-64e.h
exception-64s.h
exec.h
extable.h
fadump-internal.h
fadump.h
fb.h
feature-fixups.h
firmware.h
fixmap.h
floppy.h
fs_pd.h
fsl_gtm.h
fsl_hcalls.h
fsl_lbc.h
fsl_pamu_stash.h
fsl_pm.h
ftrace.h powerpc/ftrace: fix syscall tracing on PPC64_ELF_ABI_V1 2023-01-07 11:11:48 +01:00
futex.h
grackle.h
hardirq.h
head-64.h
heathrow.h
highmem.h
hmi.h
hugetlb.h powerpc: Remove CONFIG_PPC_FSL_BOOK3E 2022-09-26 23:00:13 +10:00
hvcall.h powerpc/pseries: Fix the H_CALL error code in PLPKS driver 2022-12-31 13:32:50 +01:00
hvconsole.h
hvcserver.h
hvsi.h
hw_breakpoint.h
hw_irq.h powerpc/64: Don't recurse irq replay 2023-03-17 08:50:30 +01:00
hydra.h
i8259.h
ibmebus.h
icswx.h
ide.h
idle.h
imc-pmu.h powerpc/imc-pmu: Fix use of mutex in IRQs disabled section 2023-01-18 11:58:21 +01:00
immap_cpm2.h
inst.h
interrupt.h powerpc/64s: Add missing declaration for machine_check_early_boot() 2022-11-26 00:25:32 +11:00
io-defs.h
io-workarounds.h
io.h
io_event_irq.h
iommu.h
ipic.h
irq.h
irq_work.h arch: consolidate arch_irq_work_raise prototypes 2024-02-05 20:12:49 +00:00
irqflags.h
isa-bridge.h
jump_label.h work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:12:28 +01:00
kasan.h
Kbuild
kdebug.h
kdump.h
kexec.h powerpc: Remove CONFIG_FSL_BOOKE 2022-09-26 22:47:37 +10:00
kexec_ranges.h
keylargo.h
kfence.h powerpc/64s: Enable KFENCE on book3s64 2022-09-28 19:22:10 +10:00
kgdb.h powerpc: Change CONFIG_E500 to CONFIG_PPC_E500 2022-09-26 23:00:13 +10:00
kprobes.h
kup.h
kvm_asm.h
kvm_book3s.h
kvm_book3s_32.h
kvm_book3s_64.h
kvm_book3s_asm.h
kvm_book3s_uvmem.h
kvm_booke.h
kvm_booke_hv_asm.h
kvm_fpu.h
kvm_guest.h
kvm_host.h powerpc: Remove CONFIG_PPC_FSL_BOOK3E 2022-09-26 23:00:13 +10:00
kvm_para.h
kvm_ppc.h
libata-portmap.h
linkage.h
livepatch.h
local.h
lppaca.h powerpc/pseries: Rework lppaca_shared_proc() to avoid DEBUG_PREEMPT 2023-09-13 09:42:48 +02:00
lv1call.h
machdep.h powerpc: Cleanup idle for e500 2022-09-26 23:00:14 +10:00
macio.h
mc146818rtc.h
mce.h
mediabay.h
mem_encrypt.h
membarrier.h
mman.h
mmiowb.h
mmu.h powerpc/mm: Fix build failures due to arch_reserved_kernel_pages() 2024-02-05 20:12:46 +00:00
mmu_context.h
mmzone.h powerpc/64s: Fix CONFIG_NUMA=n build due to create_section_mapping() 2024-02-05 20:12:46 +00:00
module.h
module.lds.h
mpc5xxx.h
mpc6xx.h
mpc52xx.h
mpc52xx_psc.h
mpc85xx.h
mpc5121.h
mpc8260.h
mpic.h
mpic_msgr.h
mpic_timer.h
msi_bitmap.h
nmi.h
nvram.h
ohare.h
opal-api.h
opal.h
paca.h powerpc: Don't include lppaca.h in paca.h 2023-09-13 09:42:48 +02:00
page.h powerpc: Remove CONFIG_PPC_FSL_BOOK3E 2022-09-26 23:00:13 +10:00
page_32.h
page_64.h
paravirt.h powerpc: Don't include lppaca.h in paca.h 2023-09-13 09:42:48 +02:00
paravirt_api_clock.h
parport.h
pasemi_dma.h
pci-bridge.h
pci.h
percpu.h
perf_event.h
perf_event_fsl_emb.h
perf_event_server.h
pgalloc.h
pgtable-be-types.h powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused 2022-09-26 20:58:18 +10:00
pgtable-types.h powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused 2022-09-26 20:58:18 +10:00
pgtable.h powerpc/mm: Reduce redundancy in pgtable.h 2022-09-26 20:58:18 +10:00
pkeys.h
plpar_wrappers.h powerpc: Don't include lppaca.h in paca.h 2023-09-13 09:42:48 +02:00
pmac_feature.h
pmac_low_i2c.h
pmac_pfunc.h
pmc.h
pmi.h
pnv-ocxl.h
pnv-pci.h
powernv.h
ppc-opcode.h powerpc: add ISA v3.0 / v3.1 wait opcode macro 2022-09-28 19:22:10 +10:00
ppc-pci.h
ppc4xx.h
ppc_asm.h powerpc/64e: provide an addressing macro for use with TOC in alternate register 2022-09-28 19:22:12 +10:00
probes.h
processor.h - hfs and hfsplus kmap API modernization from Fabio Francesco 2022-10-12 11:00:22 -07:00
prom.h
ps3.h
ps3av.h
ps3gpu.h
ps3stor.h
pte-walk.h
ptrace.h powerpc: Reverse stack frame marker on little endian 2022-09-28 22:21:17 +10:00
qspinlock.h
qspinlock_paravirt.h
reg.h powerpc/perf: Properly detect mpc7450 family 2023-05-11 23:03:31 +09:00
reg_8xx.h
reg_a2.h
reg_booke.h powerpc: Change CONFIG_E500 to CONFIG_PPC_E500 2022-09-26 23:00:13 +10:00
reg_fsl_emb.h
rheap.h
rio.h
rtas-types.h
rtas.h
runlatch.h powerpc/64s: Fix irq state management in runlatch functions 2022-09-28 19:22:11 +10:00
seccomp.h
sections.h
secure_boot.h
security_features.h
secvar.h
serial.h
set_memory.h
setjmp.h
setup.h powerpc: Add hardware description string 2022-09-30 18:35:52 +10:00
sfp-machine.h
shmparam.h
signal.h
simple_spinlock.h
simple_spinlock_types.h
smp.h powerpc/64: Move paca allocation to early_setup() 2023-03-17 08:50:31 +01:00
smu.h
sparsemem.h
spinlock.h
spinlock_types.h
spu.h
spu_csa.h
spu_info.h
spu_priv1.h
sstep.h
stackprotector.h
stacktrace.h
static_call.h
string.h
svm.h
swab.h
swiotlb.h
switch_to.h
synch.h powerpc: Change CONFIG_E500 to CONFIG_PPC_E500 2022-09-26 23:00:13 +10:00
syscall.h powerpc: Provide syscall wrapper 2022-09-28 19:22:09 +10:00
syscall_wrapper.h powerpc: Don't add __powerpc_ prefix to syscall entry points 2022-10-07 00:59:54 +11:00
syscalls.h powerpc/32: fix syscall wrappers with 64-bit arguments 2022-11-01 10:24:09 +11:00
syscalls_32.h powerpc: Include all arch-specific syscall prototypes 2022-09-28 19:22:08 +10:00
task_size_32.h
task_size_64.h
tce.h
thread_info.h
time.h
timex.h
tlb.h
tlbflush.h
tm.h
topology.h
trace.h
trace_clock.h
tsi108.h
tsi108_irq.h
tsi108_pci.h
types.h
uaccess.h work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:12:28 +01:00
udbg.h powerpc/udbg: Remove extern function prototypes 2022-09-28 19:22:14 +10:00
uic.h
ultravisor-api.h
ultravisor.h
uninorth.h
unistd.h powerpc: Use generic fallocate compatibility syscall 2022-09-26 23:00:15 +10:00
uprobes.h
user.h
vas.h
vdso.h
vdso_datapage.h
vermagic.h
vga.h
vio.h
vmalloc.h
word-at-a-time.h word-at-a-time: use the same return type for has_zero regardless of endianness 2023-08-11 12:08:11 +02:00
xics.h
xive-regs.h
xive.h
xmon.h
xor.h
xor_altivec.h