Skip to contentSkip to conversation

Please pull powerpc/linux.git powerpc-6.1-1 tag

GIT PULL Merged Michael Ellerman 6 participants 33 messages Oct 9, 2022 – Oct 13, 2022

Subsystems (2)
lore
Share & tools
lore

Michael Ellerman

author reviewer
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Linus,

Please pull powerpc updates for 6.1.

No conflicts with your tree. There will be a conflict when you merge the kbuild tree, due to us renaming head_fsl_booke.S to head_85xx.S. The resolution is mostly trivial, linux-next has the correct result if it's unclear.

cheers

Notable out of area changes:
ec65560ad84d watchdog: booke_wdt: Replace PPC_FSL_BOOK3E by PPC_E500:
drivers/watchdog/Kconfig
drivers/watchdog/booke_wdt.c

b8f3e48834fe powerpc/rtas: block error injection when locked down:
include/linux/security.h
security/security.c

include/asm-generic/compat.h # 43d5de2b67d7 asm-generic: compat: Support BE for long long args in 32-bit ABIs
include/linux/hugetlb.h # 691cdf016d3b powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused
include/math-emu/op-common.h # 7245fc5bb7a9 powerpc/math-emu: Remove -w build flag and fix warnings
init/Kconfig # 02382aff7235 powerpc/64: Remove PPC64 special case for cputime accounting default

The following changes since commit 1c23f9e627a7b412978b4e852793c5e3c3efc555:

Linux 6.0-rc2 (2022-08-21 17:32:54 -0700)

are available in the git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-6.1-1

for you to fetch changes up to 376b3275c19f83d373e841e9af2d7658693190b9:

KVM: PPC: Book3S HV: Fix stack frame regs marker (2022-10-07 21:30:25 +1100)

- ------------------------------------------------------------------ powerpc updates for 6.1

- Remove our now never-true definitions for pgd_huge() and p4d_leaf().

- Add pte_needs_flush() and huge_pmd_needs_flush() for 64-bit.

- Add support for syscall wrappers.

- Add support for KFENCE on 64-bit.

- Update 64-bit HV KVM to use the new guest state entry/exit accounting API.

- Support execute-only memory when using the Radix MMU (P9 or later).

- Implement CONFIG_PARAVIRT_TIME_ACCOUNTING for pseries guests.

- Updates to our linker script to move more data into read-only sections.

- Allow the VDSO to be randomised on 32-bit.

- Many other small features and fixes.

Thanks to: Andrew Donnellan, Aneesh Kumar K.V, Arnd Bergmann, Athira Rajeev, Christophe Leroy, David Hildenbrand, Disha Goel, Fabiano Rosas, Gaosheng Cui, Gustavo A. R. Silva, Haren Myneni, Hari Bathini, Jilin Yuan, Joel Stanley, Kajol Jain, Kees Cook, Krzysztof Kozlowski, Laurent Dufour, Liang He, Li Huafei, Lukas Bulwahn, Madhavan Srinivasan, Nathan Chancellor, Nathan Lynch, Nicholas Miehlbradt, Nicholas Piggin, Pali Rohár, Rohan McLure, Russell Currey, Sachin Sant, Segher Boessenkool, Shrikanth Hegde, Tyrel Datwyler, Wolfram Sang, ye xingchen, Zheng Yongjun.

- ------------------------------------------------------------------ Aneesh Kumar K.V (3):
powerpc/mm/book3s/hash: Rename flush_tlb_pmd_range powerpc/mm: Always update max/min_low_pfn in mem_topology_setup() powerpc/mm: Fix UBSAN warning reported on hugetlb

Athira Rajeev (2):
powerpc/perf: Fix branch_filter support for multiple filters selftests/powerpc: Update bhrb filter sampling test for multiple branch filters

Christophe Leroy (38):
powerpc/vdso: Don't map VDSO at a fixed address on PPC32
powerpc: Remove stale declarations in mmu_decl.h powerpc/fsl_booke: Make calc_cam_sz() static powerpc/code-patching: Speed up page mapping/unmapping powerpc/32: Drop a stale comment about reservation of gigantic pages powerpc/32: Allow fragmented physical memory
powerpc/32: Remove wii_memory_fixups()
powerpc/math-emu: Remove -w build flag and fix warnings powerpc/vdso: link with -z noexecstack
powerpc/math-emu: Inhibit W=1 warnings
powerpc/nohash: Remove pgd_huge() stub
powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused powerpc/book3s: Inline first level of update_mmu_cache() powerpc/mm: Reduce redundancy in pgtable.h
powerpc/mm: Make PAGE_KERNEL_xxx macros grep-friendly powerpc/highmem: Properly handle fragmented memory powerpc/Kconfig: Fix non existing CONFIG_PPC_FSL_BOOKE powerpc/64e: Tie PPC_BOOK3E_64 to PPC_E500MC
powerpc/64e: Remove unnecessary #ifdef CONFIG_PPC_FSL_BOOK3E powerpc/cputable: Remove __machine_check_early_realmode_p{7/8/9} prototypes powerpc/cputable: Move __cpu_setup() prototypes out of cputable.h powerpc/cputable: Split cpu_specs[] out of cputable.h
powerpc: Remove CONFIG_FSL_BOOKE
powerpc/cputable: Split cpu_specs[] for mpc85xx and e500mc
powerpc: Remove CONFIG_PPC_BOOK3E
powerpc: Remove redundant selection of E500 and E500MC
powerpc: Change CONFIG_E500 to CONFIG_PPC_E500
Documentation: Rename PPC_FSL_BOOK3E to PPC_E500
watchdog: booke_wdt: Replace PPC_FSL_BOOK3E by PPC_E500
powerpc: Remove CONFIG_PPC_FSL_BOOK3E
powerpc: Remove CONFIG_PPC_BOOK3E_MMU
powerpc: Replace PPC_85xx || PPC_BOOKE_64 by PPC_E500
powerpc: Simplify redundant Kconfig tests
powerpc: Cleanup idle for e500
powerpc: Remove impossible mmu_psize_defs[] on nohash powerpc/irq: Refactor irq_soft_mask_{set,or}_return() powerpc/64s: Remove unneeded #ifdef CONFIG_DEBUG_PAGEALLOC in hash_utils powerpc/64s: Allow double call of kernel_[un]map_linear_page()

David Hildenbrand (1):
powerpc/prom_init: drop PROM_BUG()

Fabiano Rosas (1):
KVM: PPC: Book3S HV: Fix decrementer migration

Gaosheng Cui (9):
powerpc/xmon: remove unused ppc_parse_cpu() declaration powerpc/spufs: remove orphan declarations from spufs.h
powerpc: remove unused chrp_event_scan() declaration
powerpc: remove unused udbg_init_debug_beat() declaration powerpc/mm: remove orphan declarations from mmu_context.h powerpc/powernv: remove orphan declarations from opal.h powerpc/sysdev: remove unused xics_ipi_dispatch() declaration powerpc/ps3: remove orphan declarations from ps3av.h
KVM: PPC: remove orphan declarations from kvm_ppc.h

Gustavo A. R. Silva (1):
powerpc/85xx: Fix fall-through warning for Clang

Haren Myneni (3):
powerpc/pseries: Move vas_migration_handler early during migration
powerpc: Ignore DSI error caused by the copy/paste instruction powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL

Hari Bathini (1):
powerpc/64/kdump: Limit kdump base to 512MB

Jilin Yuan (3):
powerpc/mobility: fix repeated words in comments powerpc/vas: fix repeated words in comments powerpc/xive: fix repeated words in comments

Joel Stanley (1):
powerpc/microwatt: Add LiteX MMC driver

Li Huafei (1):
powerpc/kprobes: Fix null pointer reference in arch_prepare_kprobe()

Liang He (31):
powerpc/512x: Add missing of_node_put() in mpc5121_clk_init() powerpc/85xx: Add missing of_node_put() in ksi8560.c powerpc/52xx: Add missing of_node_put() in media5200.c powerpc/85xx: Add missing of_node_put() in sgy_cst1000 powerpc/maple: Add missing of_node_put() in time.c
powerpc/8xx: Add missing of_node_put() in tqm8xx_setup.c powerpc/embedded6xx: Add missing of_node_put()s
powerpc/perf: Add missing of_node_put()s in imc-pmu.c powerpc/kernel: Add missing of_node_put() in legacy_serial.c powerpc/cell: Add missing of_node_put()s
powerpc/cell: Add missing of_node_put()s in cbe_regs.c powerpc/cell: Add missing of_node_put() in iommu.c powerpc/pseries: Add missing of_node_put() in ibmebus powerpc/embedded6xx/ls_uart: Add missing of_node_put() powerpc/sysdev: Add missing of_node_put()s powerpc/sysdev/fsl_msi: Add missing of_node_put() powerpc/powermac: Add missing of_node_put() in smp_core99_setup() powerpc/512x: Add missing of_node_put() in clock-commonclk.c powerpc/83xx: Add missing of_node_put() in mpc832x_spi_init()
macintosh: Add missing of_node_get() in do_attach() powerpc/pseries: Add missing of_node_put()s in hotplug-cpu.c powerpc/pci_dn: Add missing of_node_put()
powerpc/44x: Add of_node_put() when break out from for_each powerpc/85xx: Add missing of_node_get/put() in ge_imp3a_pci_assign_primary() powerpc/fsl_pci: Remove of_node_put() when reference escaped out powerpc/powernv: Add missing of_node_put()s
powerpc/pci-common: Fix refcount bug for 'phb->dn' powerpc/powermac/feature: Add missing of_node_put() powerpc/powermac/low_i2c: Add missing of_node_put() in kw_i2c_probe() powerpc/powermac/pfunc_base: Add missing of_node_put() in macio_gpio_init_one() powerpc/powermac/udbg_scc: Add missing of_node_put()s in udbg_scc_init()

Lukas Bulwahn (1):
powerpc/configs: Update config files for removed/renamed symbols

Michael Ellerman (30):
powerpc/boot: Convert more files to use SPDX tags powerpc/boot: Drop unused dummy.c
powerpc: Move patch sites out of asm-prototypes.h
powerpc: Update ISA versions to mention e5500/e6500 powerpc/configs: Properly enable PAPR_SCM in pseries_defconfig selftests/powerpc: Skip 4PB test on 4K PAGE_SIZE systems powerpc/pasemi: Use of_root in pas_pci_init()
Merge branch 'fixes' into next
powerpc/64: Remove unused prom_init_toc symbols powerpc/vmlinux.lds: Ensure STRICT_ALIGN_SIZE is at least page aligned powerpc/vmlinux.lds: Add an explicit symbol for the SRWX boundary powerpc/64: Remove unused SYS_CALL_TABLE symbol powerpc/microwatt: Remove unused early debug code powerpc/mm/64s: Drop pgd_huge()
powerpc/mm/64s: Drop p4d_leaf()
powerpc: Always select HAVE_EFFICIENT_UNALIGNED_ACCESS
powerpc: Make stack frame marker upper case
powerpc: Reverse stack frame marker on little endian
Merge branch 'topic/ppc-kvm' into next
powerpc/64s: Remove old STAB comment
powerpc/64s: Remove lost/old comment
powerpc: Drops STABS_DEBUG from linker scripts powerpc/configs: Enable PPC_UV in powernv_defconfig
powerpc: Add hardware description string
powerpc: Add PVR & CPU name to hardware description powerpc/64: Add logical PVR to the hardware description
powerpc: Add device-tree model to the hardware description powerpc/powernv: Add opal details to the hardware description powerpc/pseries: Add firmware details to the hardware description
powerpc: Don't add __powerpc_ prefix to syscall entry points

Nathan Chancellor (1):
powerpc/math_emu/efp: Include module.h

Nathan Lynch (4):
Revert "powerpc/rtas: Implement reentrant rtas call" powerpc/pseries: block untrusted device tree changes when locked down powerpc/rtas: block error injection when locked down powerpc/smp: poll cpu_callin_map more aggressively in __cpu_up()

Nicholas Miehlbradt (3):
selftests/powerpc: Add a test for execute-only memory powerpc/64s: Add DEBUG_PAGEALLOC for radix powerpc/64s: Enable KFENCE on book3s64

Nicholas Piggin (46):
powerpc/pseries: Add wait interval counter definitions to struct lppaca powerpc/pseries: Implement CONFIG_PARAVIRT_TIME_ACCOUNTING
powerpc/64: Remove PPC64 special case for cputime accounting default powerpc/pseries: Move dtl scanning and steal time accounting to pseries platform powerpc/64s: add pte_needs_flush and huge_pmd_needs_flush powerpc/pseries: move hcall_tracepoint_refcount out of .toc
powerpc: move __end_rodata to cover arch read-only sections powerpc/32/build: move got1/got2 sections out of text
powerpc/build: move got, toc, plt, branch_lt sections to read-only powerpc/build: move .data.rel.ro, .sdata2 to read-only powerpc/64/build: only include .opd with ELFv1
powerpc/64/build: merge .got and .toc input sections
powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE
KVM: PPC: Book3S HV P9: Clear vcpu cpu fields before enabling host irqs
KVM: PPC: Book3S HV P9: Fix irq disabling in tick accounting
KVM: PPC: Book3S HV: Update guest state entry/exit accounting to new API
KVM: PPC: Book3S HV P9: Restore stolen time logging in dtl powerpc/time: avoid programming DEC at the start of the timer interrupt
powerpc: add ISA v3.0 / v3.1 wait opcode macro
powerpc/64s: Make POWER10 and later use pause_short in cpu_relax loops powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5
powerpc/64s: update cpu selection options
powerpc/64/interrupt: Fix false warning in context tracking due to idle state powerpc/64: mark irqs hard disabled in boot paca
powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending powerpc/64s: Fix irq state management in runlatch functions powerpc/64s/interrupt: masked handler debug check for previous hard disable powerpc/64/interrupt: avoid BUG/WARN recursion in interrupt entry powerpc/64/irq: tidy soft-masked irq replay and improve documentation powerpc/64s: POWER10 CPU Kconfig build option
powerpc/64: use 32-bit immediate for STACK_FRAME_REGS_MARKER powerpc/64: asm use consistent global variable declaration and access powerpc/64: switch asm helpers from GOT to TOC relative addressing powerpc/64: provide a helper macro to load r2 with the kernel TOC powerpc/64e: provide an addressing macro for use with TOC in alternate register powerpc/64s/interrupt: move early boot ILE fixup into a macro powerpc/64s: early boot machine check handler
powerpc/64: avoid using r13 in relocate
powerpc/64: don't set boot CPU's r13 to paca until the structure is set up powerpc/64s/interrupt: halt early boot interrupts if paca is not set up
KVM: PPC: Book3S HV: Implement scheduling wait interval counters in the VPA
powerpc: remove orphan systbl_chk.sh
powerpc/64s/interrupt: Change must-hard-mask interrupt check from BUG to WARN powerpc/64: Fix msr_check_and_set/clear MSR[EE] race powerpc/64s/interrupt: Fix stack frame regs marker
KVM: PPC: Book3S HV: Fix stack frame regs marker

Pali Rohár (7):
powerpc: dts: turris1x.dts: Fix NOR partitions labels
powerpc: dts: turris1x.dts: Fix labels in DSA cpu port nodes
powerpc: Add support for early debugging via Serial 16550 console
powerpc: Fix SPE Power ISA properties for e500v1 platforms
powerpc: Include e500v1_power_isa.dtsi for remaining e500v1 platforms powerpc/boot: Explicitly disable usage of SPE instructions powerpc/udbg: Remove extern function prototypes

Rohan McLure (20):
powerpc: Remove asmlinkage from syscall handler definitions
powerpc: Save caller r3 prior to system_call_exception
powerpc: Add ZEROIZE_GPRS macros for register clears powerpc/64s: Use {ZEROIZE,SAVE,REST}_GPRS macros in sc, scv 0 handlers powerpc/32: Clarify interrupt restores with REST_GPR macro in entry_32.S powerpc/64e: Clarify register saves and clears with {SAVE,ZEROIZE}_GPRS powerpc/64s: Fix comment on interrupt handler prologue
powerpc: Fix fallocate and fadvise64_64 compat parameter combination
asm-generic: compat: Support BE for long long args in 32-bit ABIs
powerpc: Use generic fallocate compatibility syscall powerpc/32: Remove powerpc select specialisation
powerpc: Remove direct call to personality syscall handler
powerpc: Remove direct call to mmap2 syscall handlers
powerpc: Provide do_ppc64_personality helper
powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers
powerpc: Include all arch-specific syscall prototypes
powerpc: Enable compile-time check for syscall handlers
powerpc: Use common syscall handler type
powerpc: Change system_call_exception calling convention
powerpc: Provide syscall wrapper

Russell Currey (2):
powerpc/mm: Support execute-only memory on the Radix MMU powerpc/pasemi: Use strscpy instead of strlcpy

Wolfram Sang (3):
powerpc: move from strlcpy with unused retval to strscpy
macintosh: move from strlcpy with unused retval to strscpy powerpc/82xx: remove spidev node from mgcoge

Zheng Yongjun (1):
powerpc/powernv: add missing of_node_put() in opal_export_attrs()

ye xingchen (3):
powerpc/selftests: Use timersub() for gettimeofday() powerpc/pseries/vas: Remove the unneeded result variable
ocxl: Remove the unneeded result variable

 Documentation/admin-guide/kernel-parameters.txt                           |    8 +-
 Documentation/powerpc/isa-versions.rst                                    |   22 +
 arch/powerpc/Kconfig                                                      |   35 +-
 arch/powerpc/Kconfig.debug                                                |   15 +
 arch/powerpc/Makefile                                                     |   18 +-
 arch/powerpc/boot/44x.h                                                   |    5 +-
 arch/powerpc/boot/4xx.h                                                   |    5 +-
 arch/powerpc/boot/Makefile                                                |    1 +
 arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi                           |   51 +
 arch/powerpc/boot/dts/fsl/mpc8540ads.dts                                  |    2 +-
 arch/powerpc/boot/dts/fsl/mpc8541cds.dts                                  |    2 +-
 arch/powerpc/boot/dts/fsl/mpc8555cds.dts                                  |    2 +-
 arch/powerpc/boot/dts/fsl/mpc8560ads.dts                                  |    2 +-
 arch/powerpc/boot/dts/ksi8560.dts                                         |    2 +
 arch/powerpc/boot/dts/mgcoge.dts                                          |    7 -
 arch/powerpc/boot/dts/stx_gp3_8560.dts                                    |    2 +
 arch/powerpc/boot/dts/stxssa8555.dts                                      |    2 +
 arch/powerpc/boot/dts/tqm8540.dts                                         |    2 +
 arch/powerpc/boot/dts/tqm8541.dts                                         |    2 +
 arch/powerpc/boot/dts/tqm8555.dts                                         |    2 +
 arch/powerpc/boot/dts/tqm8560.dts                                         |    2 +
 arch/powerpc/boot/dts/turris1x.dts                                        |   14 +-
 arch/powerpc/boot/dummy.c                                                 |    4 -
 arch/powerpc/boot/opal-calls.S                                            |    6 +-
 arch/powerpc/boot/ops.h                                                   |    6 +-
 arch/powerpc/boot/ppc_asm.h                                               |   10 +
 arch/powerpc/boot/serial.c                                                |    6 +-
 arch/powerpc/boot/simple_alloc.c                                          |    6 +-
 arch/powerpc/configs/83xx/mpc837x_rdb_defconfig                           |    1 -
 arch/powerpc/configs/85xx/ge_imp3a_defconfig                              |    1 -
 arch/powerpc/configs/85xx/ppa8548_defconfig                               |    2 -
 arch/powerpc/configs/cell_defconfig                                       |    1 -
 arch/powerpc/configs/g5_defconfig                                         |    1 -
 arch/powerpc/configs/microwatt_defconfig                                  |    5 +
 arch/powerpc/configs/mpc512x_defconfig                                    |    1 -
 arch/powerpc/configs/mpc885_ads_defconfig                                 |    2 +-
 arch/powerpc/configs/pasemi_defconfig                                     |    1 -
 arch/powerpc/configs/pmac32_defconfig                                     |    1 -
 arch/powerpc/configs/powernv_defconfig                                    |    6 +-
 arch/powerpc/configs/ppc64_defconfig                                      |    5 +-
 arch/powerpc/configs/ppc64e_defconfig                                     |    3 -
 arch/powerpc/configs/ppc6xx_defconfig                                     |    7 -
 arch/powerpc/configs/ps3_defconfig                                        |    1 -
 arch/powerpc/configs/pseries_defconfig                                    |    6 +-
 arch/powerpc/configs/skiroot_defconfig                                    |    2 -
 arch/powerpc/configs/storcenter_defconfig                                 |    1 -
 arch/powerpc/include/asm/asm-prototypes.h                                 |   14 +-
 arch/powerpc/include/asm/barrier.h                                        |    2 +-
 arch/powerpc/include/asm/book3s/32/pgtable.h                              |   22 +-
 arch/powerpc/include/asm/book3s/64/pgalloc.h                              |    6 +-
 arch/powerpc/include/asm/book3s/64/pgtable-4k.h                           |   10 -
 arch/powerpc/include/asm/book3s/64/pgtable-64k.h                          |    9 -
 arch/powerpc/include/asm/book3s/64/pgtable.h                              |   42 +-
 arch/powerpc/include/asm/book3s/64/tlbflush-hash.h                        |    4 +-
 arch/powerpc/include/asm/book3s/64/tlbflush.h                             |   56 +
 arch/powerpc/include/asm/book3s/pgtable.h                                 |   15 +-
 arch/powerpc/include/asm/cpu_setup.h                                      |   49 +
 arch/powerpc/include/asm/cpu_setup_power.h                                |   12 -
 arch/powerpc/include/asm/cputable.h                                       |    8 +-
 arch/powerpc/include/asm/cputime.h                                        |    2 +-
 arch/powerpc/include/asm/dtl.h                                            |    8 -
 arch/powerpc/include/asm/hugetlb.h                                        |    4 +-
 arch/powerpc/include/asm/hw_irq.h                                         |   50 +-
 arch/powerpc/include/asm/interrupt.h                                      |   41 +-
 arch/powerpc/include/asm/kexec.h                                          |    2 +-
 arch/powerpc/include/asm/kfence.h                                         |   15 +
 arch/powerpc/include/asm/kgdb.h                                           |    2 +-
 arch/powerpc/include/asm/kvm_host.h                                       |    2 +-
 arch/powerpc/include/asm/kvm_ppc.h                                        |    4 -
 arch/powerpc/include/asm/lppaca.h                                         |   10 +-
 arch/powerpc/include/asm/machdep.h                                        |    1 -
 arch/powerpc/include/asm/mmu.h                                            |   11 +-
 arch/powerpc/include/asm/mmu_context.h                                    |    2 -
 arch/powerpc/include/asm/nohash/32/pgtable.h                              |    8 +-
 arch/powerpc/include/asm/nohash/32/{pte-fsl-booke.h => pte-85xx.h}        |    6 +-
 arch/powerpc/include/asm/nohash/64/pgtable.h                              |    2 +-
 arch/powerpc/include/asm/nohash/{hugetlb-book3e.h => hugetlb-e500.h}      |    8 +-
 arch/powerpc/include/asm/nohash/{mmu-book3e.h => mmu-e500.h}              |    0
 arch/powerpc/include/asm/nohash/mmu.h                                     |    4 +-
 arch/powerpc/include/asm/nohash/pgalloc.h                                 |    2 +-
 arch/powerpc/include/asm/nohash/pgtable.h                                 |   30 +-
 arch/powerpc/include/asm/nohash/{pte-book3e.h => pte-e500.h}              |    6 +-
 arch/powerpc/include/asm/nohash/tlbflush.h                                |    2 +-
 arch/powerpc/include/asm/opal.h                                           |    6 -
 arch/powerpc/include/asm/paca.h                                           |    9 +-
 arch/powerpc/include/asm/page.h                                           |    8 +-
 arch/powerpc/include/asm/paravirt.h                                       |   12 +
 arch/powerpc/include/asm/paravirt_api_clock.h                             |    2 +
 arch/powerpc/include/asm/pgtable-be-types.h                               |    2 +
 arch/powerpc/include/asm/pgtable-types.h                                  |    2 +
 arch/powerpc/include/asm/pgtable.h                                        |   19 +
 arch/powerpc/include/asm/ppc-opcode.h                                     |    7 +-
 arch/powerpc/include/asm/ppc_asm.h                                        |   52 +-
 arch/powerpc/include/asm/processor.h                                      |   24 +-
 arch/powerpc/include/asm/ps3av.h                                          |    2 -
 arch/powerpc/include/asm/ptrace.h                                         |    9 +-
 arch/powerpc/include/asm/reg_booke.h                                      |    6 +-
 arch/powerpc/include/asm/rtas.h                                           |    1 -
 arch/powerpc/include/asm/runlatch.h                                       |    6 +-
 arch/powerpc/include/asm/sections.h                                       |   17 +-
 arch/powerpc/include/asm/setup.h                                          |    5 +-
 arch/powerpc/include/asm/synch.h                                          |    2 +-
 arch/powerpc/include/asm/syscall.h                                        |   11 +-
 arch/powerpc/include/asm/syscall_wrapper.h                                |   49 +
 arch/powerpc/include/asm/syscalls.h                                       |  142 +-
 arch/powerpc/{kernel/ppc32.h => include/asm/syscalls_32.h}                |    6 +-
 arch/powerpc/include/asm/time.h                                           |    5 +-
 arch/powerpc/include/asm/udbg.h                                           |   54 +-
 arch/powerpc/include/asm/unistd.h                                         |    1 +
 arch/powerpc/include/asm/vdso.h                                           |    3 -
 arch/powerpc/include/asm/vdso/processor.h                                 |    8 +-
 arch/powerpc/include/asm/vdso/timebase.h                                  |    2 +-
 arch/powerpc/include/asm/xics.h                                           |    1 -
 arch/powerpc/kernel/{fsl_booke_entry_mapping.S => 85xx_entry_mapping.S}   |    0
 arch/powerpc/kernel/Makefile                                              |   14 +-
 arch/powerpc/kernel/asm-offsets.c                                         |   10 +-
 arch/powerpc/kernel/{cpu_setup_fsl_booke.S => cpu_setup_e500.S}           |    6 +-
 arch/powerpc/kernel/cpu_setup_power.c                                     |    2 +-
 arch/powerpc/kernel/cpu_specs.h                                           |   29 +
 arch/powerpc/kernel/cpu_specs_40x.h                                       |  280 +++
 arch/powerpc/kernel/cpu_specs_44x.h                                       |  304 ++++
 arch/powerpc/kernel/cpu_specs_47x.h                                       |   74 +
 arch/powerpc/kernel/cpu_specs_85xx.h                                      |   57 +
 arch/powerpc/kernel/cpu_specs_8xx.h                                       |   23 +
 arch/powerpc/kernel/cpu_specs_book3s_32.h                                 |  605 ++++++
 arch/powerpc/kernel/cpu_specs_book3s_64.h                                 |  481 +++++
 arch/powerpc/kernel/cpu_specs_e500mc.h                                    |   75 +
 arch/powerpc/kernel/cputable.c                                            | 1920 +-------------------
 arch/powerpc/kernel/dt_cpu_ftrs.c                                         |    2 +-
 arch/powerpc/kernel/entry_32.S                                            |   52 +-
 arch/powerpc/kernel/entry_64.S                                            |    6 +-
 arch/powerpc/kernel/exceptions-64e.S                                      |   70 +-
 arch/powerpc/kernel/exceptions-64s.S                                      |  159 +-
 arch/powerpc/kernel/head_64.S                                             |   54 +-
 arch/powerpc/kernel/{head_fsl_booke.S => head_85xx.S}                     |    8 +-
 arch/powerpc/kernel/head_booke.h                                          |    8 +-
 arch/powerpc/kernel/{idle_book3e.S => idle_64e.S}                         |   10 +-
 arch/powerpc/kernel/{idle_e500.S => idle_85xx.S}                          |    0
 arch/powerpc/kernel/interrupt.c                                           |   10 -
 arch/powerpc/kernel/interrupt_64.S                                        |  129 +-
 arch/powerpc/kernel/irq_64.c                                              |   93 +-
 arch/powerpc/kernel/kgdb.c                                                |   12 +-
 arch/powerpc/kernel/kprobes.c                                             |    8 +-
 arch/powerpc/kernel/kvm.c                                                 |    8 +-
 arch/powerpc/kernel/legacy_serial.c                                       |    2 +
 arch/powerpc/kernel/misc_64.S                                             |    6 +-
 arch/powerpc/kernel/optprobes_head.S                                      |    2 +-
 arch/powerpc/kernel/paca.c                                                |   38 +-
 arch/powerpc/kernel/pci-common.c                                          |    4 +-
 arch/powerpc/kernel/pci_dn.c                                              |    1 +
 arch/powerpc/kernel/process.c                                             |    4 +-
 arch/powerpc/kernel/prom.c                                                |   63 +-
 arch/powerpc/kernel/prom_init.c                                           |    6 -
 arch/powerpc/kernel/prom_init_check.sh                                    |    3 +-
 arch/powerpc/kernel/reloc_64.S                                            |   14 +-
 arch/powerpc/kernel/rtas.c                                                |   79 +-
 arch/powerpc/kernel/security.c                                            |   11 +-
 arch/powerpc/kernel/setup-common.c                                        |   19 +-
 arch/powerpc/kernel/setup.h                                               |    2 +-
 arch/powerpc/kernel/setup_32.c                                            |    2 +-
 arch/powerpc/kernel/setup_64.c                                            |   43 +-
 arch/powerpc/kernel/signal.h                                              |    3 -
 arch/powerpc/kernel/signal_32.c                                           |    2 +-
 arch/powerpc/kernel/smp.c                                                 |   40 +-
 arch/powerpc/kernel/{swsusp_booke.S => swsusp_85xx.S}                     |    0
 arch/powerpc/kernel/swsusp_asm64.S                                        |   16 +-
 arch/powerpc/kernel/sys_ppc32.c                                           |   66 +-
 arch/powerpc/kernel/syscall.c                                             |   39 +-
 arch/powerpc/kernel/syscalls.c                                            |   60 +-
 arch/powerpc/kernel/syscalls/syscall.tbl                                  |   24 +-
 arch/powerpc/kernel/sysfs.c                                               |    6 +-
 arch/powerpc/kernel/{systbl.S => systbl.c}                                |   33 +-
 arch/powerpc/kernel/systbl_chk.sh                                         |   30 -
 arch/powerpc/kernel/time.c                                                |  121 +-
 arch/powerpc/kernel/trace/ftrace_low.S                                    |    2 +-
 arch/powerpc/kernel/trace/ftrace_mprofile.S                               |    6 +-
 arch/powerpc/kernel/traps.c                                               |   22 +-
 arch/powerpc/kernel/udbg.c                                                |    2 +
 arch/powerpc/kernel/udbg_16550.c                                          |   52 +-
 arch/powerpc/kernel/vdso.c                                                |   19 +-
 arch/powerpc/kernel/vdso/Makefile                                         |    4 +-
 arch/powerpc/kernel/vdso/vdso32.lds.S                                     |    1 -
 arch/powerpc/kernel/vdso/vdso64.lds.S                                     |    1 -
 arch/powerpc/kernel/vector.S                                              |   15 +-
 arch/powerpc/kernel/vmlinux.lds.S                                         |   97 +-
 arch/powerpc/kexec/core.c                                                 |    6 +-
 arch/powerpc/kexec/core_32.c                                              |    2 +-
 arch/powerpc/kexec/core_64.c                                              |    2 +-
 arch/powerpc/kexec/relocate_32.S                                          |    4 +-
 arch/powerpc/kvm/Kconfig                                                  |    4 +-
 arch/powerpc/kvm/book3s_64_entry.S                                        |    2 +-
 arch/powerpc/kvm/book3s_hv.c                                              |  146 +-
 arch/powerpc/kvm/book3s_hv_rmhandlers.S                                   |    6 +-
 arch/powerpc/kvm/booke_interrupts.S                                       |    4 +-
 arch/powerpc/kvm/e500.h                                                   |    2 +-
 arch/powerpc/kvm/powerpc.c                                                |    1 -
 arch/powerpc/kvm/tm.S                                                     |    2 +-
 arch/powerpc/lib/code-patching.c                                          |   30 +-
 arch/powerpc/lib/copypage_64.S                                            |    7 +-
 arch/powerpc/lib/feature-fixups.c                                         |    4 +-
 arch/powerpc/lib/string_64.S                                              |    7 +-
 arch/powerpc/math-emu/Makefile                                            |    7 +-
 arch/powerpc/math-emu/math.c                                              |   18 +-
 arch/powerpc/math-emu/math_efp.c                                          |   60 +-
 arch/powerpc/mm/book3s32/mmu.c                                            |    8 +-
 arch/powerpc/mm/book3s64/hash_pgtable.c                                   |    4 +-
 arch/powerpc/mm/book3s64/hash_tlb.c                                       |    2 +-
 arch/powerpc/mm/book3s64/hash_utils.c                                     |   32 +-
 arch/powerpc/mm/book3s64/pgtable.c                                        |   11 +-
 arch/powerpc/mm/book3s64/radix_pgtable.c                                  |   28 +-
 arch/powerpc/mm/fault.c                                                   |   23 +-
 arch/powerpc/mm/hugetlbpage.c                                             |    8 +-
 arch/powerpc/mm/init_32.c                                                 |   17 +-
 arch/powerpc/mm/mem.c                                                     |    4 +-
 arch/powerpc/mm/mmu_decl.h                                                |   28 +-
 arch/powerpc/mm/nohash/Makefile                                           |    6 +-
 arch/powerpc/mm/nohash/{fsl_book3e.c => e500.c}                           |    6 +-
 arch/powerpc/mm/nohash/{book3e_hugetlbpage.c => e500_hugetlbpage.c}       |    0
 arch/powerpc/mm/nohash/tlb.c                                              |   80 +-
 arch/powerpc/mm/nohash/tlb_low.S                                          |    6 +-
 arch/powerpc/mm/nohash/tlb_low_64e.S                                      |   10 +-
 arch/powerpc/mm/numa.c                                                    |    6 +-
 arch/powerpc/mm/pgtable_32.c                                              |    7 +-
 arch/powerpc/mm/ptdump/Makefile                                           |    2 +-
 arch/powerpc/perf/bhrb.S                                                  |    2 +-
 arch/powerpc/perf/callchain_32.c                                          |    2 +-
 arch/powerpc/perf/core-book3s.c                                           |   17 +
 arch/powerpc/perf/imc-pmu.c                                               |   10 +-
 arch/powerpc/platforms/44x/ppc476.c                                       |    2 +
 arch/powerpc/platforms/512x/clock-commonclk.c                             |    8 +-
 arch/powerpc/platforms/52xx/media5200.c                                   |    3 +
 arch/powerpc/platforms/83xx/mpc832x_rdb.c                                 |    6 +-
 arch/powerpc/platforms/85xx/Kconfig                                       |    5 +-
 arch/powerpc/platforms/85xx/corenet_generic.c                             |    4 -
 arch/powerpc/platforms/85xx/ge_imp3a.c                                    |    6 +-
 arch/powerpc/platforms/85xx/ksi8560.c                                     |    2 +
 arch/powerpc/platforms/85xx/mpc85xx_cds.c                                 |    1 +
 arch/powerpc/platforms/85xx/qemu_e500.c                                   |    4 -
 arch/powerpc/platforms/85xx/sgy_cts1000.c                                 |   35 +-
 arch/powerpc/platforms/8xx/tqm8xx_setup.c                                 |    3 +
 arch/powerpc/platforms/Kconfig.cputype                                    |   71 +-
 arch/powerpc/platforms/book3s/vas-api.c                                   |    2 +-
 arch/powerpc/platforms/cell/cbe_regs.c                                    |   37 +-
 arch/powerpc/platforms/cell/iommu.c                                       |    4 +-
 arch/powerpc/platforms/cell/setup.c                                       |    2 +
 arch/powerpc/platforms/cell/spu_callbacks.c                               |    6 +-
 arch/powerpc/platforms/cell/spu_manage.c                                  |    2 +
 arch/powerpc/platforms/cell/spufs/spufs.h                                 |    2 -
 arch/powerpc/platforms/chrp/chrp.h                                        |    1 -
 arch/powerpc/platforms/embedded6xx/holly.c                                |    6 +
 arch/powerpc/platforms/embedded6xx/ls_uart.c                              |    2 +
 arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c                         |    3 +
 arch/powerpc/platforms/embedded6xx/wii.c                                  |   15 -
 arch/powerpc/platforms/maple/time.c                                       |    1 +
 arch/powerpc/platforms/pasemi/misc.c                                      |    3 +-
 arch/powerpc/platforms/pasemi/pci.c                                       |   10 +-
 arch/powerpc/platforms/powermac/feature.c                                 |   15 +-
 arch/powerpc/platforms/powermac/low_i2c.c                                 |    1 +
 arch/powerpc/platforms/powermac/pfunc_base.c                              |    2 +
 arch/powerpc/platforms/powermac/smp.c                                     |    1 +
 arch/powerpc/platforms/powermac/udbg_scc.c                                |    8 +-
 arch/powerpc/platforms/powernv/idle.c                                     |    3 +-
 arch/powerpc/platforms/powernv/ocxl.c                                     |    4 +-
 arch/powerpc/platforms/powernv/opal-core.c                                |    2 +
 arch/powerpc/platforms/powernv/opal-powercap.c                            |    6 +-
 arch/powerpc/platforms/powernv/opal-psr.c                                 |    6 +-
 arch/powerpc/platforms/powernv/opal-sensor-groups.c                       |    6 +-
 arch/powerpc/platforms/powernv/opal-wrappers.S                            |    2 +-
 arch/powerpc/platforms/powernv/opal.c                                     |    3 +
 arch/powerpc/platforms/powernv/pci-ioda.c                                 |    2 +-
 arch/powerpc/platforms/powernv/setup.c                                    |   22 +
 arch/powerpc/platforms/pseries/Kconfig                                    |    8 +
 arch/powerpc/platforms/pseries/dtl.c                                      |   81 +
 arch/powerpc/platforms/pseries/hotplug-cpu.c                              |   15 +-
 arch/powerpc/platforms/pseries/hvCall.S                                   |    4 +-
 arch/powerpc/platforms/pseries/hvcserver.c                                |    2 +-
 arch/powerpc/platforms/pseries/ibmebus.c                                  |    6 +-
 arch/powerpc/platforms/pseries/lpar.c                                     |   11 +
 arch/powerpc/platforms/pseries/mobility.c                                 |   17 +-
 arch/powerpc/platforms/pseries/reconfig.c                                 |    5 +
 arch/powerpc/platforms/pseries/setup.c                                    |   49 +
 arch/powerpc/platforms/pseries/vas.c                                      |    8 +-
 arch/powerpc/sysdev/fsl_msi.c                                             |    2 +
 arch/powerpc/sysdev/fsl_pci.c                                             |    9 +-
 arch/powerpc/sysdev/fsl_rio.c                                             |    2 +-
 arch/powerpc/sysdev/mpic_msgr.c                                           |    9 +-
 arch/powerpc/sysdev/xics/ics-rtas.c                                       |   22 +-
 arch/powerpc/sysdev/xive/common.c                                         |    2 +-
 arch/powerpc/sysdev/xive/native.c                                         |   15 +-
 arch/powerpc/xmon/ppc.h                                                   |    2 -
 arch/powerpc/xmon/spr_access.S                                            |    4 +-
 arch/powerpc/xmon/xmon.c                                                  |   16 +-
 drivers/macintosh/therm_windtunnel.c                                      |    6 +-
 drivers/watchdog/Kconfig                                                  |    8 +-
 drivers/watchdog/booke_wdt.c                                              |    8 +-
 include/asm-generic/compat.h                                              |    9 +-
 include/linux/hugetlb.h                                                   |    2 +-
 include/linux/security.h                                                  |    2 +
 include/math-emu/op-common.h                                              |    3 +
 init/Kconfig                                                              |    3 +-
 security/security.c                                                       |    2 +
 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl                        |   24 +-
 tools/testing/selftests/powerpc/benchmarks/gettimeofday.c                 |    6 +-
 tools/testing/selftests/powerpc/mm/Makefile                               |    3 +-
 tools/testing/selftests/powerpc/mm/exec_prot.c                            |  231 +++
 tools/testing/selftests/powerpc/mm/large_vm_gpr_corruption.c              |    2 +
 tools/testing/selftests/powerpc/pmu/sampling_tests/bhrb_filter_map_test.c |    9 +
 307 files changed, 4550 insertions(+), 3720 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi
 delete mode 100644 arch/powerpc/boot/dummy.c
 create mode 100644 arch/powerpc/include/asm/cpu_setup.h
 delete mode 100644 arch/powerpc/include/asm/cpu_setup_power.h
 rename arch/powerpc/include/asm/nohash/32/{pte-fsl-booke.h => pte-85xx.h} (94%)
 rename arch/powerpc/include/asm/nohash/{hugetlb-book3e.h => hugetlb-e500.h} (84%)
 rename arch/powerpc/include/asm/nohash/{mmu-book3e.h => mmu-e500.h} (100%)
 rename arch/powerpc/include/asm/nohash/{pte-book3e.h => pte-e500.h} (96%)
 create mode 100644 arch/powerpc/include/asm/paravirt_api_clock.h
 create mode 100644 arch/powerpc/include/asm/syscall_wrapper.h
 rename arch/powerpc/{kernel/ppc32.h => include/asm/syscalls_32.h} (93%)
 rename arch/powerpc/kernel/{fsl_booke_entry_mapping.S => 85xx_entry_mapping.S} (100%)
 rename arch/powerpc/kernel/{cpu_setup_fsl_booke.S => cpu_setup_e500.S} (98%)
 create mode 100644 arch/powerpc/kernel/cpu_specs.h
 create mode 100644 arch/powerpc/kernel/cpu_specs_40x.h
 create mode 100644 arch/powerpc/kernel/cpu_specs_44x.h
 create mode 100644 arch/powerpc/kernel/cpu_specs_47x.h
 create mode 100644 arch/powerpc/kernel/cpu_specs_85xx.h
 create mode 100644 arch/powerpc/kernel/cpu_specs_8xx.h
 create mode 100644 arch/powerpc/kernel/cpu_specs_book3s_32.h
 create mode 100644 arch/powerpc/kernel/cpu_specs_book3s_64.h
 create mode 100644 arch/powerpc/kernel/cpu_specs_e500mc.h
 rename arch/powerpc/kernel/{head_fsl_booke.S => head_85xx.S} (99%)
 rename arch/powerpc/kernel/{idle_book3e.S => idle_64e.S} (93%)
 rename arch/powerpc/kernel/{idle_e500.S => idle_85xx.S} (100%)
 rename arch/powerpc/kernel/{swsusp_booke.S => swsusp_85xx.S} (100%)
 rename arch/powerpc/kernel/{systbl.S => systbl.c} (52%)
 delete mode 100644 arch/powerpc/kernel/systbl_chk.sh
 rename arch/powerpc/mm/nohash/{fsl_book3e.c => e500.c} (98%)
 rename arch/powerpc/mm/nohash/{book3e_hugetlbpage.c => e500_hugetlbpage.c} (100%)
 create mode 100644 tools/testing/selftests/powerpc/mm/exec_prot.c

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmNCqSwACgkQUevqPMjh pYBYUw//Ul2eM4UBiuMvRRyVCy1jFnreUAaqnYmTXkleA3f8sJnu/yL/dS+eI6ok rI0rgbG+Q1IFBdVny5OShEVyY+uNfZz1Q/XnGSX9S2LzYbNp0dM2KNaMNztIIn/s Rx4wu7zO5HC6UVtKt5tLtkatyOE3c2Dwkz0T+tBYBlQp98JwnII2awiC26Fo9w1j HKBij2cPeVgrKUsMIzlsbFAlExKGIJEDP45Bl0KB0o35X9FWc4JbBviijNZYqAEx fioYGnSTX0dsi8VWpwcc0Tft09gfdG9mOvISbiXmKx2NWEtMB9gf43t7hISZRQsh PflEdIu3AjDDel7pF2w0JRp011DjJialTm5qkF3n+gN81S3RzFSVo+tgqJIt//gv Xk17EkV/vbLQkMDWQ68g6HXN8yfXAHMxRRe6vIONDDWTDDQ4u/qqlZTKEIA5Yuje 3i2t+YNbqtWBwrsTmmeNaXMf6X4xtBcRwfFlHQxddyuQJ2LI6LeyFdkM7VzUMA2+ +lBvqzCUrp+4Fo2vYCefNJwny4S3dh7nqM5j7kWGo8tqlD7JIF+oGAL5vaF1939g O7pJGro8VpxbxuRwMoYbfTsBthDFYLiIrxz7gnmxzjH0pDHHsG72J8iL1Rn/+QX1 AWYINpL/wx/lznJ7a2/aunRG2mbU62Wbo8KES5fmHS5gXT8L+Mg= =L2a+
-----END PGP SIGNATURE-----

merge bot Merged
#1 lore raw
The pull request you sent on Sun, 09 Oct 2022 22:01:39 +1100:

The pull request you sent on Sun, 09 Oct 2022 22:01:39 +1100:

Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-6.1-1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/4899a36f91a9f9b06878471096bd143e7253006d

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
#2 lore raw
In reply to Michael Ellerman

Hi Michael,

Quoted 14 lines · Michael Ellerman

powerpc updates for 6.1

- Remove our now never-true definitions for pgd_huge() and p4d_leaf().

- Add pte_needs_flush() and huge_pmd_needs_flush() for 64-bit.

- Add support for syscall wrappers.

- Add support for KFENCE on 64-bit.

- Update 64-bit HV KVM to use the new guest state entry/exit accounting API.

- Support execute-only memory when using the Radix MMU (P9 or later).

Quoted 7 lines

- Implement CONFIG_PARAVIRT_TIME_ACCOUNTING for pseries guests.

- Updates to our linker script to move more data into read-only sections.

- Allow the VDSO to be randomised on 32-bit.

- Many other small features and fixes.

FYI, something in here broke the wireguard test suite, which runs the iperf3 networking utility. The full log is here [1], but the relevant part is:

[+] NS1: iperf3 -Z -t 3 -c 192.168.241.2 Connecting to host 192.168.241.2, port 5201
iperf3: error - failed to read /dev/urandom: Bad address

I'll see if I can narrow it down a bit more and bisect. But just FYI, in case you have an intuition.

Jason

[1] https://build.wireguard.com/linux/4de65c5830233e7a4adf2e679510089ec4e210c7/powerpc.log

#3 lore raw
Quoted 29 lines · Jason A. Donenfeld

Hi Michael,

Quoted 14 lines · Michael Ellerman

powerpc updates for 6.1

- Remove our now never-true definitions for pgd_huge() and p4d_leaf().

- Add pte_needs_flush() and huge_pmd_needs_flush() for 64-bit.

- Add support for syscall wrappers.

- Add support for KFENCE on 64-bit.

- Update 64-bit HV KVM to use the new guest state entry/exit accounting API.

- Support execute-only memory when using the Radix MMU (P9 or later).

Quoted 7 lines

- Implement CONFIG_PARAVIRT_TIME_ACCOUNTING for pseries guests.

- Updates to our linker script to move more data into read-only sections.

- Allow the VDSO to be randomised on 32-bit.

- Many other small features and fixes.

FYI, something in here broke the wireguard test suite, which runs the iperf3 networking utility. The full log is here [1], but the relevant part is:

Quoted 6 lines

[+] NS1: iperf3 -Z -t 3 -c 192.168.241.2 Connecting to host 192.168.241.2, port 5201
iperf3: error - failed to read /dev/urandom: Bad address

I'll see if I can narrow it down a bit more and bisect. But just FYI, in case you have an intuition.

Huh. From iov_iter.c:

static int copyout(void __user *to, const void *from, size_t n)

{
        size_t before = n;
        if (should_fail_usercopy())
                return n;
        if (access_ok(to, n)) {
                instrument_copy_to_user(to, from, n);
                n = raw_copy_to_user(to, from, n);
                if (n == before)
                        pr_err("SARU n still %zu pointer is %lx\n", n, (unsigned long)to);
        }
        return n;
}

I added the pr_err() there to catch the failure:

[    3.443506] SARU n still 64 pointer is b78db000

Also I managed to extract the failing portion of iperf3 into something smaller:

        int temp;
        char *x;
        ssize_t l;
        FILE *f;
        char template[] = "/blah-XXXXXX";

        temp = mkstemp(template);
        if (temp < 0)
                panic("mkstemp");
        if (unlink(template) < 0)
                panic("unlink");
        if (ftruncate(temp, 0x20000) < 0)
                panic("ftruncate");
        x = mmap(NULL, 0x20000, PROT_READ|PROT_WRITE, MAP_PRIVATE, temp, 0);
        if (x == MAP_FAILED)
                panic("mmap");
        f = fopen("/dev/urandom", "rb");
        if (!f)
                panic("fopen");
        setbuf(f, NULL);
        if (fread(x, 1, 0x20000, f) != 0x20000)
                panic("fread");

Jason

maintainer Reviewed-by Nicholas Piggin
#4 lore raw
Quoted 82 lines · Jason A. Donenfeld
Quoted 29 lines · Jason A. Donenfeld

Hi Michael,

Quoted 14 lines · Michael Ellerman

powerpc updates for 6.1

- Remove our now never-true definitions for pgd_huge() and p4d_leaf().

- Add pte_needs_flush() and huge_pmd_needs_flush() for 64-bit.

- Add support for syscall wrappers.

- Add support for KFENCE on 64-bit.

- Update 64-bit HV KVM to use the new guest state entry/exit accounting API.

- Support execute-only memory when using the Radix MMU (P9 or later).

Quoted 7 lines

- Implement CONFIG_PARAVIRT_TIME_ACCOUNTING for pseries guests.

- Updates to our linker script to move more data into read-only sections.

- Allow the VDSO to be randomised on 32-bit.

- Many other small features and fixes.

FYI, something in here broke the wireguard test suite, which runs the iperf3 networking utility. The full log is here [1], but the relevant part is:

Quoted 6 lines

[+] NS1: iperf3 -Z -t 3 -c 192.168.241.2 Connecting to host 192.168.241.2, port 5201
iperf3: error - failed to read /dev/urandom: Bad address

I'll see if I can narrow it down a bit more and bisect. But just FYI, in case you have an intuition.

Huh. From iov_iter.c:

static int copyout(void __user *to, const void *from, size_t n)

{
        size_t before = n;
        if (should_fail_usercopy())
                return n;
        if (access_ok(to, n)) {
                instrument_copy_to_user(to, from, n);
                n = raw_copy_to_user(to, from, n);
                if (n == before)
                        pr_err("SARU n still %zu pointer is %lx\n", n, (unsigned long)to);
        }
        return n;
}

I added the pr_err() there to catch the failure:

[    3.443506] SARU n still 64 pointer is b78db000

Also I managed to extract the failing portion of iperf3 into something smaller:

        int temp;
        char *x;
        ssize_t l;
        FILE *f;
        char template[] = "/blah-XXXXXX";

        temp = mkstemp(template);
        if (temp < 0)
                panic("mkstemp");
        if (unlink(template) < 0)
                panic("unlink");
        if (ftruncate(temp, 0x20000) < 0)
                panic("ftruncate");
        x = mmap(NULL, 0x20000, PROT_READ|PROT_WRITE, MAP_PRIVATE, temp, 0);
        if (x == MAP_FAILED)
                panic("mmap");
        f = fopen("/dev/urandom", "rb");
        if (!f)
                panic("fopen");
        setbuf(f, NULL);
        if (fread(x, 1, 0x20000, f) != 0x20000)
                panic("fread");
Quoted 1 line

Jason

Bisected:

7e92e01b724526b98cbc7f03dd4afa0295780d56 is the first bad commit commit 7e92e01b724526b98cbc7f03dd4afa0295780d56

Author: Rohan McLure <[email protected]>
Date:   Wed Sep 21 16:56:01 2022 +1000

powerpc: Provide syscall wrapper

Implement syscall wrapper as per s390, x86, arm64. When enabled cause handlers to accept parameters from a stack frame rather than from user scratch register state. This allows for user registers to be safely cleared in order to reduce caller influence on speculation within syscall routine. The wrapper is a macro that emits syscall handler symbols that call into the target handler, obtaining its parameters from a struct pt_regs on the stack.

As registers are already saved to the stack prior to calling system_call_exception, it appears that this function is executed more efficiently with the new stack-pointer convention than with parameters passed by registers, avoiding the allocation of a stack frame for this method. On a 32-bit system, we see >20% performance increases on the null_syscall microbenchmark, and on a Power 8 the performance gains amortise the cost of clearing and restoring registers which is implemented at the end of this series, seeing final result of ~5.6% performance improvement on null_syscall.

Syscalls are wrapped in this fashion on all platforms except for the Cell processor as this commit does not provide SPU support. This can be quickly fixed in a successive patch, but requires spu_sys_callback to allocate a pt_regs structure to satisfy the wrapped calling convention.

 arch/powerpc/Kconfig                       |  1 +
 arch/powerpc/include/asm/syscall.h         |  4 +++
 arch/powerpc/include/asm/syscall_wrapper.h | 51 ++++++++++++++++++++++++++++++
 arch/powerpc/include/asm/syscalls.h        | 24 ++++++++++++--
 arch/powerpc/kernel/syscall.c              | 34 ++++++++++----------
 arch/powerpc/kernel/systbl.c               |  7 ++++
 arch/powerpc/kernel/vdso.c                 |  2 ++
 7 files changed, 105 insertions(+), 18 deletions(-)
 create mode 100644 arch/powerpc/include/asm/syscall_wrapper.h
#5 lore raw
Quoted 49 lines · Jason A. Donenfeld

Bisected:

7e92e01b724526b98cbc7f03dd4afa0295780d56 is the first bad commit commit 7e92e01b724526b98cbc7f03dd4afa0295780d56
Author: Rohan McLure <[email protected]>
Date:   Wed Sep 21 16:56:01 2022 +1000

    powerpc: Provide syscall wrapper

    Implement syscall wrapper as per s390, x86, arm64. When enabled cause handlers to accept parameters from a stack frame rather than
    from user scratch register state. This allows for user registers to be
    safely cleared in order to reduce caller influence on speculation within syscall routine. The wrapper is a macro that emits syscall handler symbols that call into the target handler, obtaining its parameters from a struct pt_regs on the stack.

    As registers are already saved to the stack prior to calling system_call_exception, it appears that this function is executed more
    efficiently with the new stack-pointer convention than with parameters
    passed by registers, avoiding the allocation of a stack frame for this
    method. On a 32-bit system, we see >20% performance increases on the
    null_syscall microbenchmark, and on a Power 8 the performance gains
    amortise the cost of clearing and restoring registers which is implemented at the end of this series, seeing final result of ~5.6%
    performance improvement on null_syscall.

    Syscalls are wrapped in this fashion on all platforms except for the
    Cell processor as this commit does not provide SPU support. This can be
    quickly fixed in a successive patch, but requires spu_sys_callback to
    allocate a pt_regs structure to satisfy the wrapped calling convention.

Quoted 5 lines

    [mpe: Make incompatible with COMPAT to retain clearing of high bits of args]

    Link:
https://lore.kernel.org/r/[email protected]

Thanks for bisecting, this is interesting! Could you provide your .config and the environment you're running in? Your reproducer doesn't seem to trigger it on my baremetal POWER8 pseries_le_defconfig.

Signature · 2 lines
Andrew Donnellan    OzLabs, ADL Canberra
[email protected]   IBM Australia Limited
#6 lore raw

Hi Andrew,

Quoted 3 lines · Andrew Donnellan

Thanks for bisecting, this is interesting! Could you provide your .config and the environment you're running in? Your reproducer doesn't seem to trigger it on my baremetal POWER8 pseries_le_defconfig.

Sure.

.config: https://xn--4db.cc/NemFt2Vs (change CONFIG_INITRAMFS_SOURCE)
Toolchain: https://download.wireguard.com/qemu-test/toolchains/20211123/powerpc-linux-musl-cross.tgz

You can also just run:

  ARCH=powerpc make -C tools/testing/selftests/wireguard/qemu -j$(nproc)

And that'll assemble the whole thing.

Jason

author reviewer
#7 lore raw
Quoted 9 lines · Jason A. Donenfeld

Hi Andrew,

Quoted 3 lines · Andrew Donnellan

Thanks for bisecting, this is interesting! Could you provide your .config and the environment you're running in? Your reproducer doesn't seem to trigger it on my baremetal POWER8 pseries_le_defconfig.

Sure.

Quoted 8 lines

.config: https://xn--4db.cc/NemFt2Vs (change CONFIG_INITRAMFS_SOURCE)
Toolchain: https://download.wireguard.com/qemu-test/toolchains/20211123/powerpc-linux-musl-cross.tgz

You can also just run:

  ARCH=powerpc make -C tools/testing/selftests/wireguard/qemu -j$(nproc)

And that'll assemble the whole thing.

I tried that :)

What host OS are you running that on?

I get:

mkdir -p /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc
powerpc-linux-musl-gcc -o /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/init -O3 -pipe -std=gnu11 init.c /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find Scrt1.o: No such file or directory /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find crti.o: No such file or directory /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find crtbeginS.o: No such file or directory /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find -lgcc /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status

cheers

author reviewer
#10 lore raw
In reply to Jason A. Donenfeld
Quoted 73 lines · Jason A. Donenfeld
Quoted 29 lines · Jason A. Donenfeld

Hi Michael,

Quoted 14 lines · Michael Ellerman

powerpc updates for 6.1

- Remove our now never-true definitions for pgd_huge() and p4d_leaf().

- Add pte_needs_flush() and huge_pmd_needs_flush() for 64-bit.

- Add support for syscall wrappers.

- Add support for KFENCE on 64-bit.

- Update 64-bit HV KVM to use the new guest state entry/exit accounting API.

- Support execute-only memory when using the Radix MMU (P9 or later).

Quoted 7 lines

- Implement CONFIG_PARAVIRT_TIME_ACCOUNTING for pseries guests.

- Updates to our linker script to move more data into read-only sections.

- Allow the VDSO to be randomised on 32-bit.

- Many other small features and fixes.

FYI, something in here broke the wireguard test suite, which runs the iperf3 networking utility. The full log is here [1], but the relevant part is:

Quoted 6 lines

[+] NS1: iperf3 -Z -t 3 -c 192.168.241.2 Connecting to host 192.168.241.2, port 5201
iperf3: error - failed to read /dev/urandom: Bad address

I'll see if I can narrow it down a bit more and bisect. But just FYI, in case you have an intuition.

Huh. From iov_iter.c:

static int copyout(void __user *to, const void *from, size_t n)

{
        size_t before = n;
        if (should_fail_usercopy())
                return n;
        if (access_ok(to, n)) {
                instrument_copy_to_user(to, from, n);
                n = raw_copy_to_user(to, from, n);
                if (n == before)
                        pr_err("SARU n still %zu pointer is %lx\n", n, (unsigned long)to);
        }
        return n;
}

I added the pr_err() there to catch the failure:

[    3.443506] SARU n still 64 pointer is b78db000

Also I managed to extract the failing portion of iperf3 into something smaller:

        int temp;
        char *x;
        ssize_t l;
        FILE *f;
        char template[] = "/blah-XXXXXX";

        temp = mkstemp(template);
        if (temp < 0)
                panic("mkstemp");
        if (unlink(template) < 0)
                panic("unlink");
        if (ftruncate(temp, 0x20000) < 0)
                panic("ftruncate");
        x = mmap(NULL, 0x20000, PROT_READ|PROT_WRITE, MAP_PRIVATE, temp, 0);
Quoted 8 lines
        if (x == MAP_FAILED)
                panic("mmap");
        f = fopen("/dev/urandom", "rb");
        if (!f)
                panic("fopen");
        setbuf(f, NULL);
        if (fread(x, 1, 0x20000, f) != 0x20000)
                panic("fread");

Does that fail for you reliably?

It succeeds for me running under qemu ppce500, though I'm not using your kernel config yet.

cheers

#8 lore raw
In reply to Michael Ellerman
Quoted 25 lines · Michael Ellerman
Quoted 9 lines · Jason A. Donenfeld

Hi Andrew,

Quoted 3 lines · Andrew Donnellan

Thanks for bisecting, this is interesting! Could you provide your .config and the environment you're running in? Your reproducer doesn't seem to trigger it on my baremetal POWER8 pseries_le_defconfig.

Sure.

Quoted 8 lines

.config: https://xn--4db.cc/NemFt2Vs (change CONFIG_INITRAMFS_SOURCE)
Toolchain: https://download.wireguard.com/qemu-test/toolchains/20211123/powerpc-linux-musl-cross.tgz

You can also just run:

  ARCH=powerpc make -C tools/testing/selftests/wireguard/qemu -j$(nproc)

And that'll assemble the whole thing.

I tried that :)

What host OS are you running that on?

I get:

Quoted 8 lines

mkdir -p /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc
powerpc-linux-musl-gcc -o /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/init -O3 -pipe -std=gnu11 init.c /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find Scrt1.o: No such file or directory /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find crti.o: No such file or directory /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find crtbeginS.o: No such file or directory /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find -lgcc /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status

Here's what happened:

- You started the thing and the kernel compile complained about an unclean tree.
- You ran mrproper.
- You tried to run the thing again.

amirite?

If so, what happened is that mrproper deleted the .o files from the toolchain. Solution:

  ARCH=powerpc make -C tools/testing/selftests/wireguard/qemu -j$(nproc) clean
  ARCH=powerpc make -C tools/testing/selftests/wireguard/qemu -j$(nproc)

Let me know how that goes.

Jason

#11 lore raw
In reply to Michael Ellerman
Quoted 83 lines · Michael Ellerman
Quoted 73 lines · Jason A. Donenfeld
Quoted 29 lines · Jason A. Donenfeld

Hi Michael,

Quoted 14 lines · Michael Ellerman

powerpc updates for 6.1

- Remove our now never-true definitions for pgd_huge() and p4d_leaf().

- Add pte_needs_flush() and huge_pmd_needs_flush() for 64-bit.

- Add support for syscall wrappers.

- Add support for KFENCE on 64-bit.

- Update 64-bit HV KVM to use the new guest state entry/exit accounting API.

- Support execute-only memory when using the Radix MMU (P9 or later).

Quoted 7 lines

- Implement CONFIG_PARAVIRT_TIME_ACCOUNTING for pseries guests.

- Updates to our linker script to move more data into read-only sections.

- Allow the VDSO to be randomised on 32-bit.

- Many other small features and fixes.

FYI, something in here broke the wireguard test suite, which runs the iperf3 networking utility. The full log is here [1], but the relevant part is:

Quoted 6 lines

[+] NS1: iperf3 -Z -t 3 -c 192.168.241.2 Connecting to host 192.168.241.2, port 5201
iperf3: error - failed to read /dev/urandom: Bad address

I'll see if I can narrow it down a bit more and bisect. But just FYI, in case you have an intuition.

Huh. From iov_iter.c:

static int copyout(void __user *to, const void *from, size_t n)

{
        size_t before = n;
        if (should_fail_usercopy())
                return n;
        if (access_ok(to, n)) {
                instrument_copy_to_user(to, from, n);
                n = raw_copy_to_user(to, from, n);
                if (n == before)
                        pr_err("SARU n still %zu pointer is %lx\n", n, (unsigned long)to);
        }
        return n;
}

I added the pr_err() there to catch the failure:

[    3.443506] SARU n still 64 pointer is b78db000

Also I managed to extract the failing portion of iperf3 into something smaller:

        int temp;
        char *x;
        ssize_t l;
        FILE *f;
        char template[] = "/blah-XXXXXX";

        temp = mkstemp(template);
        if (temp < 0)
                panic("mkstemp");
        if (unlink(template) < 0)
                panic("unlink");
        if (ftruncate(temp, 0x20000) < 0)
                panic("ftruncate");
        x = mmap(NULL, 0x20000, PROT_READ|PROT_WRITE, MAP_PRIVATE, temp, 0);
Quoted 8 lines
        if (x == MAP_FAILED)
                panic("mmap");
        f = fopen("/dev/urandom", "rb");
        if (!f)
                panic("fopen");
        setbuf(f, NULL);
        if (fread(x, 1, 0x20000, f) != 0x20000)
                panic("fread");
Quoted 4 lines

Does that fail for you reliably?

It succeeds for me running under qemu ppce500, though I'm not using your kernel config yet.

Yes, every time without fail, across two systems and two qemu builds.

Jason

author reviewer
#9 lore raw
In reply to Jason A. Donenfeld
Quoted 35 lines · Jason A. Donenfeld
Quoted 25 lines · Michael Ellerman
Quoted 9 lines · Jason A. Donenfeld

Hi Andrew,

Quoted 3 lines · Andrew Donnellan

Thanks for bisecting, this is interesting! Could you provide your .config and the environment you're running in? Your reproducer doesn't seem to trigger it on my baremetal POWER8 pseries_le_defconfig.

Sure.

Quoted 8 lines

.config: https://xn--4db.cc/NemFt2Vs (change CONFIG_INITRAMFS_SOURCE)
Toolchain: https://download.wireguard.com/qemu-test/toolchains/20211123/powerpc-linux-musl-cross.tgz

You can also just run:

  ARCH=powerpc make -C tools/testing/selftests/wireguard/qemu -j$(nproc)

And that'll assemble the whole thing.

I tried that :)

What host OS are you running that on?

I get:

Quoted 8 lines

mkdir -p /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc
powerpc-linux-musl-gcc -o /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/init -O3 -pipe -std=gnu11 init.c /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find Scrt1.o: No such file or directory /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find crti.o: No such file or directory /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find crtbeginS.o: No such file or directory /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find -lgcc /scratch/michael/linus/tools/testing/selftests/wireguard/qemu/build/powerpc/powerpc-linux-musl-cross/bin/../lib/gcc/powerpc-linux-musl/11.2.1/../../../../powerpc-linux-musl/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status

Quoted 8 lines

Here's what happened:

- You started the thing and the kernel compile complained about an unclean tree.
- You ran mrproper.
- You tried to run the thing again.

amirite?

I think so yeah. I tried it on 3 different machines so I'm not sure exactly what I did where, but I definitely ran mrproper on one of them.

Quoted 7 lines

If so, what happened is that mrproper deleted the .o files from the toolchain. Solution:

  ARCH=powerpc make -C tools/testing/selftests/wireguard/qemu -j$(nproc) clean
  ARCH=powerpc make -C tools/testing/selftests/wireguard/qemu -j$(nproc)

Let me know how that goes.

Yep that works thanks.

And I see the iperf failure. Though I still can't see what the bug is, but hopefully if I stare at it longer I'll work it out.

cheers

author reviewer
#12 lore raw
In reply to Jason A. Donenfeld
Quoted 84 lines · Jason A. Donenfeld
Quoted 83 lines · Michael Ellerman
Quoted 81 lines · Jason A. Donenfeld
Quoted 29 lines · Jason A. Donenfeld

Hi Michael,

Quoted 14 lines · Michael Ellerman

powerpc updates for 6.1

- Remove our now never-true definitions for pgd_huge() and p4d_leaf().

- Add pte_needs_flush() and huge_pmd_needs_flush() for 64-bit.

- Add support for syscall wrappers.

- Add support for KFENCE on 64-bit.

- Update 64-bit HV KVM to use the new guest state entry/exit accounting API.

- Support execute-only memory when using the Radix MMU (P9 or later).

Quoted 7 lines

- Implement CONFIG_PARAVIRT_TIME_ACCOUNTING for pseries guests.

- Updates to our linker script to move more data into read-only sections.

- Allow the VDSO to be randomised on 32-bit.

- Many other small features and fixes.

FYI, something in here broke the wireguard test suite, which runs the iperf3 networking utility. The full log is here [1], but the relevant part is:

Quoted 6 lines

[+] NS1: iperf3 -Z -t 3 -c 192.168.241.2 Connecting to host 192.168.241.2, port 5201
iperf3: error - failed to read /dev/urandom: Bad address

I'll see if I can narrow it down a bit more and bisect. But just FYI, in case you have an intuition.

Huh. From iov_iter.c:

static int copyout(void __user *to, const void *from, size_t n)

{
        size_t before = n;
        if (should_fail_usercopy())
                return n;
        if (access_ok(to, n)) {
                instrument_copy_to_user(to, from, n);
                n = raw_copy_to_user(to, from, n);
                if (n == before)
                        pr_err("SARU n still %zu pointer is %lx\n", n, (unsigned long)to);
        }
        return n;
}

I added the pr_err() there to catch the failure:

[    3.443506] SARU n still 64 pointer is b78db000

Also I managed to extract the failing portion of iperf3 into something smaller:

        int temp;
        char *x;
        ssize_t l;
        FILE *f;
        char template[] = "/blah-XXXXXX";

        temp = mkstemp(template);
        if (temp < 0)
                panic("mkstemp");
        if (unlink(template) < 0)
                panic("unlink");
        if (ftruncate(temp, 0x20000) < 0)
                panic("ftruncate");
        x = mmap(NULL, 0x20000, PROT_READ|PROT_WRITE, MAP_PRIVATE, temp, 0);
        if (x == MAP_FAILED)
                panic("mmap");
        f = fopen("/dev/urandom", "rb");
        if (!f)
                panic("fopen");
        setbuf(f, NULL);
        if (fread(x, 1, 0x20000, f) != 0x20000)
                panic("fread");
Quoted 6 lines
Quoted 4 lines

Does that fail for you reliably?

It succeeds for me running under qemu ppce500, though I'm not using your kernel config yet.

Yes, every time without fail, across two systems and two qemu builds.

OK. Joel worked out that it only fails when built with musl, so that's why it's succeeding for me (built with glibc).

cheers

#13 lore raw
Quoted 87 lines · Michael Ellerman
Quoted 86 lines · Jason A. Donenfeld
Quoted 85 lines · Michael Ellerman
Quoted 73 lines · Jason A. Donenfeld
Quoted 29 lines · Jason A. Donenfeld

Hi Michael,

Quoted 14 lines · Michael Ellerman

powerpc updates for 6.1

- Remove our now never-true definitions for pgd_huge() and p4d_leaf().

- Add pte_needs_flush() and huge_pmd_needs_flush() for 64-bit.

- Add support for syscall wrappers.

- Add support for KFENCE on 64-bit.

- Update 64-bit HV KVM to use the new guest state entry/exit accounting API.

- Support execute-only memory when using the Radix MMU (P9 or later).

Quoted 7 lines

- Implement CONFIG_PARAVIRT_TIME_ACCOUNTING for pseries guests.

- Updates to our linker script to move more data into read-only sections.

- Allow the VDSO to be randomised on 32-bit.

- Many other small features and fixes.

FYI, something in here broke the wireguard test suite, which runs the iperf3 networking utility. The full log is here [1], but the relevant part is:

Quoted 6 lines

[+] NS1: iperf3 -Z -t 3 -c 192.168.241.2 Connecting to host 192.168.241.2, port 5201
iperf3: error - failed to read /dev/urandom: Bad address

I'll see if I can narrow it down a bit more and bisect. But just FYI, in case you have an intuition.

Huh. From iov_iter.c:

static int copyout(void __user *to, const void *from, size_t n)

{
        size_t before = n;
        if (should_fail_usercopy())
                return n;
        if (access_ok(to, n)) {
                instrument_copy_to_user(to, from, n);
                n = raw_copy_to_user(to, from, n);
                if (n == before)
                        pr_err("SARU n still %zu pointer is %lx\n", n, (unsigned long)to);
        }
        return n;
}

I added the pr_err() there to catch the failure:

[    3.443506] SARU n still 64 pointer is b78db000

Also I managed to extract the failing portion of iperf3 into something smaller:

        int temp;
        char *x;
        ssize_t l;
        FILE *f;
        char template[] = "/blah-XXXXXX";

        temp = mkstemp(template);
        if (temp < 0)
                panic("mkstemp");
        if (unlink(template) < 0)
                panic("unlink");
        if (ftruncate(temp, 0x20000) < 0)
                panic("ftruncate");
        x = mmap(NULL, 0x20000, PROT_READ|PROT_WRITE, MAP_PRIVATE, temp, 0);
Quoted 8 lines
        if (x == MAP_FAILED)
                panic("mmap");
        f = fopen("/dev/urandom", "rb");
        if (!f)
                panic("fopen");
        setbuf(f, NULL);
        if (fread(x, 1, 0x20000, f) != 0x20000)
                panic("fread");

Does that fail for you reliably?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It succeeds for me running under qemu ppce500, though I'm not using your kernel config yet.

Yes, every time without fail, across two systems and two qemu builds.

OK. Joel worked out that it only fails when built with musl, so that's why it's succeeding for me (built with glibc).

This was independently discovered by several, but we worked out it's because musl uses ftruncate64 here, while glibc doesn't seem to. And ftruncate64 got broken by the syscall wrappers patch on ppc32. The kernel is seeing a 0 length ftruncate call, so the user access sigbuses and can't copy anything.

This quick hack gets the test program working again. Only very lightly tested so far...

Thanks,
Nick

---

arch/powerpc/include/asm/syscalls.h +21 -0
index 9840d572da55..9578cc5e4f84 100644
@@ -89,6 +89,27 @@ long compat_sys_rt_sigreturn(void);
  * responsible for combining parameter pairs.
  */
 
+#ifdef CONFIG_PPC32
+long sys_ppc_pread64(unsigned int fd,
+		     char __user *ubuf, compat_size_t count,
+		     u32 reg6, u32 pos1, u32 pos2);
+long sys_ppc_pwrite64(unsigned int fd,
+		      const char __user *ubuf, compat_size_t count,
+		      u32 reg6, u32 pos1, u32 pos2);
+long sys_ppc_readahead(int fd, u32 r4,
+		       u32 offset1, u32 offset2, u32 count);
+long sys_ppc_truncate64(const char __user *path, u32 reg4,
+		        unsigned long len1, unsigned long len2);
+long sys_ppc_ftruncate64(unsigned int fd, u32 reg4,
+			 unsigned long len1, unsigned long len2);
+long sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2,
+			 size_t len, int advice);
+long sys_ppc_sync_file_range2(int fd, unsigned int flags,
+			      unsigned int offset1,
+			      unsigned int offset2,
+			      unsigned int nbytes1,
+			      unsigned int nbytes2);
+#endif
 #ifdef CONFIG_COMPAT
 long compat_sys_mmap2(unsigned long addr, size_t len,
 		      unsigned long prot, unsigned long flags,
arch/powerpc/kernel/Makefile +1 -0
index 1f121c188805..d382564034a7 100644
@@ -73,6 +73,7 @@ obj-y				:= cputable.o syscalls.o \
 obj-y				+= ptrace/
 obj-$(CONFIG_PPC64)		+= setup_64.o irq_64.o\
 				   paca.o nvram_64.o note.o
+obj-$(CONFIG_PPC32)		+= sys_ppc32.o
 obj-$(CONFIG_COMPAT)		+= sys_ppc32.o signal_32.o
 obj-$(CONFIG_VDSO32)		+= vdso32_wrapper.o
 obj-$(CONFIG_PPC_WATCHDOG)	+= watchdog.o
arch/powerpc/kernel/sys_ppc32.c +18 -7
index dcc3c9fd4cfd..f9ce13e6c5eb 100644
@@ -47,7 +47,17 @@
 #include <asm/syscalls.h>
 #include <asm/switch_to.h>
 
-COMPAT_SYSCALL_DEFINE6(ppc_pread64,
+#ifdef CONFIG_PPC32
+#define PPC32_SYSCALL_DEFINE4	SYSCALL_DEFINE4
+#define PPC32_SYSCALL_DEFINE5	SYSCALL_DEFINE5
+#define PPC32_SYSCALL_DEFINE6	SYSCALL_DEFINE6
+#else
+#define PPC32_SYSCALL_DEFINE4	COMPAT_SYSCALL_DEFINE4
+#define PPC32_SYSCALL_DEFINE5	COMPAT_SYSCALL_DEFINE5
+#define PPC32_SYSCALL_DEFINE6	COMPAT_SYSCALL_DEFINE6
+#endif
+
+PPC32_SYSCALL_DEFINE6(ppc_pread64,
 		       unsigned int, fd,
 		       char __user *, ubuf, compat_size_t, count,
 		       u32, reg6, u32, pos1, u32, pos2)
@@ -55,7 +65,7 @@ COMPAT_SYSCALL_DEFINE6(ppc_pread64,
 	return ksys_pread64(fd, ubuf, count, merge_64(pos1, pos2));
 }
 
-COMPAT_SYSCALL_DEFINE6(ppc_pwrite64,
+PPC32_SYSCALL_DEFINE6(ppc_pwrite64,
 		       unsigned int, fd,
 		       const char __user *, ubuf, compat_size_t, count,
 		       u32, reg6, u32, pos1, u32, pos2)
@@ -63,28 +73,29 @@ COMPAT_SYSCALL_DEFINE6(ppc_pwrite64,
 	return ksys_pwrite64(fd, ubuf, count, merge_64(pos1, pos2));
 }
 
-COMPAT_SYSCALL_DEFINE5(ppc_readahead,
+PPC32_SYSCALL_DEFINE5(ppc_readahead,
 		       int, fd, u32, r4,
 		       u32, offset1, u32, offset2, u32, count)
 {
 	return ksys_readahead(fd, merge_64(offset1, offset2), count);
 }
 
-COMPAT_SYSCALL_DEFINE4(ppc_truncate64,
+PPC32_SYSCALL_DEFINE4(ppc_truncate64,
 		       const char __user *, path, u32, reg4,
 		       unsigned long, len1, unsigned long, len2)
 {
 	return ksys_truncate(path, merge_64(len1, len2));
 }
 
-COMPAT_SYSCALL_DEFINE4(ppc_ftruncate64,
+PPC32_SYSCALL_DEFINE4(ppc_ftruncate64,
 		       unsigned int, fd, u32, reg4,
 		       unsigned long, len1, unsigned long, len2)
 {
+	printk("ppc_ftruncate64 len1=%lx len2=%lx\n", len1, len2);
 	return ksys_ftruncate(fd, merge_64(len1, len2));
 }
 
-COMPAT_SYSCALL_DEFINE6(ppc32_fadvise64,
+PPC32_SYSCALL_DEFINE6(ppc32_fadvise64,
 		       int, fd, u32, unused, u32, offset1, u32, offset2,
 		       size_t, len, int, advice)
 {
@@ -92,7 +103,7 @@ COMPAT_SYSCALL_DEFINE6(ppc32_fadvise64,
 				 advice);
 }
 
-COMPAT_SYSCALL_DEFINE6(ppc_sync_file_range2,
+PPC32_SYSCALL_DEFINE6(ppc_sync_file_range2,
 		       int, fd, unsigned int, flags,
 		       unsigned int, offset1, unsigned int, offset2,
 		       unsigned int, nbytes1, unsigned int, nbytes2)
arch/powerpc/kernel/syscalls/syscall.tbl +7 -7
index 2bca64f96164..71d6e38e5a3a 100644
@@ -228,8 +228,8 @@
 176	64	rt_sigtimedwait			sys_rt_sigtimedwait
 177	nospu 	rt_sigqueueinfo			sys_rt_sigqueueinfo		compat_sys_rt_sigqueueinfo
 178	nospu 	rt_sigsuspend			sys_rt_sigsuspend		compat_sys_rt_sigsuspend
-179	common	pread64				sys_pread64			compat_sys_ppc_pread64
-180	common	pwrite64			sys_pwrite64			compat_sys_ppc_pwrite64
+179	common	pread64				sys_ppc_pread64			compat_sys_ppc_pread64
+180	common	pwrite64			sys_ppc_pwrite64		compat_sys_ppc_pwrite64
 181	common	chown				sys_chown
 182	common	getcwd				sys_getcwd
 183	common	capget				sys_capget
@@ -242,10 +242,10 @@
 188	common 	putpmsg				sys_ni_syscall
 189	nospu	vfork				sys_vfork
 190	common	ugetrlimit			sys_getrlimit			compat_sys_getrlimit
-191	common	readahead			sys_readahead			compat_sys_ppc_readahead
+191	common	readahead			sys_ppc_readahead		compat_sys_ppc_readahead
 192	32	mmap2				sys_mmap2			compat_sys_mmap2
-193	32	truncate64			sys_truncate64			compat_sys_ppc_truncate64
-194	32	ftruncate64			sys_ftruncate64			compat_sys_ppc_ftruncate64
+193	32	truncate64			sys_ppc_truncate64		compat_sys_ppc_truncate64
+194	32	ftruncate64			sys_ppc_ftruncate64		compat_sys_ppc_ftruncate64
 195	32	stat64				sys_stat64
 196	32	lstat64				sys_lstat64
 197	32	fstat64				sys_fstat64
@@ -288,7 +288,7 @@
 230	common	io_submit			sys_io_submit			compat_sys_io_submit
 231	common	io_cancel			sys_io_cancel
 232	nospu	set_tid_address			sys_set_tid_address
-233	common	fadvise64			sys_fadvise64			compat_sys_ppc32_fadvise64
+233	common	fadvise64			sys_ppc32_fadvise64		compat_sys_ppc32_fadvise64
 234	nospu	exit_group			sys_exit_group
 235	nospu	lookup_dcookie			sys_lookup_dcookie		compat_sys_lookup_dcookie
 236	common	epoll_create			sys_epoll_create
@@ -390,7 +390,7 @@
 305	common	signalfd			sys_signalfd			compat_sys_signalfd
 306	common	timerfd_create			sys_timerfd_create
 307	common	eventfd				sys_eventfd
-308	common	sync_file_range2		sys_sync_file_range2		compat_sys_ppc_sync_file_range2
+308	common	sync_file_range2		sys_ppc_sync_file_range2	compat_sys_ppc_sync_file_range2
 309	nospu	fallocate			sys_fallocate			compat_sys_fallocate
 310	nospu	subpage_prot			sys_subpage_prot
 311	32	timerfd_settime			sys_timerfd_settime32
#14 lore raw
In reply to Michael Ellerman
Quoted 11 lines · Michael Ellerman

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Linus,

Please pull powerpc updates for 6.1.

No conflicts with your tree. There will be a conflict when you merge the kbuild tree, due to us renaming head_fsl_booke.S to head_85xx.S. The resolution is mostly trivial, linux-next has the correct result if it's unclear.

Post-merge problems are much more exciting when trying to run mac99 emulations in qemu.

Enabling KFENCE results in log messages such as

================================
WARNING: inconsistent lock state
6.0.0-rc2-00163-ga5edf9815dd7 #1 Tainted: G N
--------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
swapper/0/1 [HC0[0]:SC0[0]:HE1:SE1] takes:
c000000002734d68 (native_tlbie_lock){+.?.}-{2:2}, at: .native_hpte_updateboltedpp+0x1a4/0x600 {IN-SOFTIRQ-W} state was registered at:

  .lock_acquire+0x20c/0x520
  ._raw_spin_lock+0x4c/0x70
  .native_hpte_invalidate+0x62c/0x840
  .hash__kernel_map_pages+0x450/0x640
  .kfence_protect+0x58/0xc0
  .kfence_guarded_free+0x374/0x5a0
  .__slab_free+0x340/0x670
  .__d_free+0x2c/0x50
  .rcu_core+0x3f4/0x1750
  .__do_softirq+0x1dc/0x7dc
  .do_softirq_own_stack+0x40/0x60
  0xc00000000775bca0
  .irq_exit+0x1e8/0x220
  .timer_interrupt+0x284/0x700
  decrementer_common_virt+0x208/0x210
irq event stamp: 243607
hardirqs last  enabled at (243607): [<c0000000003bd424>] .__slab_free+0x324/0x670
hardirqs last disabled at (243606): [<c0000000003bd2f4>] .__slab_free+0x1f4/0x670
softirqs last  enabled at (242982): [<c0000000010a387c>] .__do_softirq+0x7ac/0x7dc
softirqs last disabled at (242973): [<c000000000014b20>] .do_softirq_own_stack+0x40/0x60

other info that might help us debug this:

 Possible unsafe locking scenario:
       CPU0
       ----
  lock(native_tlbie_lock);
  <Interrupt>
    lock(native_tlbie_lock);

*** DEADLOCK ***

and, indeed, there appear to be various deadlocks.

I had to disable KFENCE to be able to test further (or maybe KFENCE works and points out the soft lockup problem observed below - hard for me to determine).

Quoted 1 line

powerpc/pseries: Move dtl scanning and steal time accounting to pseries platform

With this patch, CONFIG_DTL must be enabled if CONFIG_PPC_SPLPAR is enabled. CONFIG_PPC_SPLPAR=y and CONFIG_DTL=n results in build failures due to

irq.c:(.text+0x2798): undefined reference to `.pseries_accumulate_stolen_time'

and many similar errors.

I had to enable CONFIG_DTL explicitly to be able to build my test images. CONFIG_PPC_SPLPAR now depends on or requires CONFIG_DTL which in turn depends on CONFIG_DEBUG_FS. That seems odd.

With all this worked around, I still get soft lockup problems when trying to boot from SDHCI. I have not been able to bisect this problem.

BUG: soft lockup - CPU#0 stuck for 23s! [dd:111]
Modules linked in:
CPU: 0 PID: 111 Comm: dd Not tainted 6.0.0-10822-g60bb8154d1d7 #1
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
NIP:  c000000000031630 LR: c000000000031964 CTR: 0000000000000000
REGS: c000000007df36a8 TRAP: 0900   Not tainted  (6.0.0-10822-g60bb8154d1d7)
MSR:  800000000000b032 <SF,EE,FP,ME,IR,DR,RI>  CR: 28002228  XER: 00000000

IRQMASK: 0
GPR00: c000000000031964 c000000007df3870 c0000000013e5500 c000000007df36a8
GPR04: c00000000125dd80 0000000000000000 c000000007df3814 c00000000291d018
GPR08: c000000002d4bbb8 0000000000000000 c000000007365100 c000000002d21098
GPR12: 0000000028002222 c000000002e20000 00000000100d32e0 00000000100d32b4
GPR16: 00000000100d3301 00000000100d32b9 00000000100d3358 00000000100d32bf
GPR20: 0000000000002000 00000000100d3372 00000000100d331e c000000007365918
GPR24: 0000000000000000 0000000000000e60 0000000000000900 0000000000000500
GPR28: 0000000000000a00 0000000000000f00 0000000000000002 0000000000000003 NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300
LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258
--- interrupt: c00 at 0x7fff829fd49c
NIP:  00007fff829fd49c LR: 000000001000da90 CTR: 0000000000000000
REGS: c000000007df3e80 TRAP: 0c00   Not tainted  (6.0.0-10822-g60bb8154d1d7)
MSR:  800000000000f032 <SF,EE,PR,FP,ME,IR,DR,RI>  CR: 22002422  XER: 00000000
IRQMASK: 0
GPR00: 0000000000000003 00007ffff138df70 00007fff82af7300 0000000000000000
GPR04: 00000000101102a0 0000000000000020 0000000000000000 0000000000000000
GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR12: 0000000000000000 00007fff82bcaac0 00000000100d32e0 00000000100d32b4
GPR16: 00000000100d3301 00000000100d32b9 00000000100d3358 00000000100d32bf
GPR20: 0000000000002000 00000000100d3372 00000000100d331e 0000000000000000
GPR24: 7fffffffffffffff 00000000100b3a9c 00000000101102a0 0000000000000020
GPR28: 00000000101025c0 0000000000000020 0000000000000000 0000000000000000

NIP [00007fff829fd49c] 0x7fff829fd49c
LR [000000001000da90] 0x1000da90
--- interrupt: c00
Instruction dump:
3b600500 3b800a00 3ba00f00 f8010010 f821fdc1 60000000 60000000 38610078 e92d0af8 f92101f8 39200000 48039745 <60000000> 39000000 e9410180 892d0933

Kernel panic - not syncing: softlockup: hung tasks
CPU: 0 PID: 111 Comm: dd Tainted: G             L     6.0.0-10822-g60bb8154d1d7 #1
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
Call Trace:
[c000000007df3180] [c000000000f584c0] .dump_stack_lvl+0x7c/0xc4 (unreliable)
[c000000007df3210] [c0000000000d5b58] .panic+0x174/0x42c
[c000000007df32c0] [c000000000231054] .watchdog_timer_fn+0x3a4/0x3e0
[c000000007df3380] [c0000000001cc65c] .__hrtimer_run_queues+0x1fc/0x650
[c000000007df3490] [c0000000001cd5cc] .hrtimer_interrupt+0x11c/0x320
[c000000007df3550] [c000000000021f5c] .timer_interrupt+0x1cc/0x600
[c000000007df3630] [c0000000000316c8] .replay_soft_interrupts+0xf8/0x300
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258
--- interrupt: c00 at 0x7fff829fd49c
NIP:  00007fff829fd49c LR: 000000001000da90 CTR: 0000000000000000
REGS: c000000007df3e80 TRAP: 0c00   Tainted: G             L      (6.0.0-10822-g60bb8154d1d7)
MSR:  800000000000f032 <SF,EE,PR,FP,ME,IR,DR,RI>  CR: 22002422  XER: 00000000
IRQMASK: 0
GPR00: 0000000000000003 00007ffff138df70 00007fff82af7300 0000000000000000
GPR04: 00000000101102a0 0000000000000020 0000000000000000 0000000000000000
GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR12: 0000000000000000 00007fff82bcaac0 00000000100d32e0 00000000100d32b4
GPR16: 00000000100d3301 00000000100d32b9 00000000100d3358 00000000100d32bf
GPR20: 0000000000002000 00000000100d3372 00000000100d331e 0000000000000000
GPR24: 7fffffffffffffff 00000000100b3a9c 00000000101102a0 0000000000000020
GPR28: 00000000101025c0 0000000000000020 0000000000000000 0000000000000000

NIP [00007fff829fd49c] 0x7fff829fd49c
LR [000000001000da90] 0x1000da90
--- interrupt: c00

Guenter

#15 lore raw
Quoted 12 lines · Guenter Roeck

NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300 LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258

Obviously the first couple lines of this concern me a bit. But I think actually this might just be a catalyst for another bug. You could view that function as basically just:

    while (something)
    	schedule();

And I guess in the process of calling the scheduler a lot, which toggles interrupts a lot, something got wedged.

Curious, though, I did try to reproduce this, to no avail. My .config is
https://xn--4db.cc/rBvHWfDZ . What's yours?

Jason

#16 lore raw
Quoted 18 lines · Jason A. Donenfeld
Quoted 12 lines · Guenter Roeck

NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300 LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258

Obviously the first couple lines of this concern me a bit. But I think actually this might just be a catalyst for another bug. You could view that function as basically just:

Quoted 9 lines
    while (something)
    	schedule();

And I guess in the process of calling the scheduler a lot, which toggles interrupts a lot, something got wedged.

Curious, though, I did try to reproduce this, to no avail. My .config is
https://xn--4db.cc/rBvHWfDZ . What's yours?

Attached. My qemu command line is

qemu-system-ppc64 -M mac99 -cpu ppc64 \
     -m 1G -kernel vmlinux -snapshot -device e1000,netdev=net0 \
     -netdev user,id=net0 -device sdhci-pci -device sd-card,drive=d0 \
     -drive file=/var/cache/buildbot/ppc64/rootfs.ext2,format=raw,if=none,id=d0 \
     -nographic -vga none -monitor null -no-reboot \
     --append "root=/dev/mmcblk0 rootwait console=tty console=ttyS0"

Qemu version is 7.0. The root file system is from
https://github.com/groeck/linux-build-test/tree/master/rootfs/ppc64

I used to have self tests enabled, but with that (specifically, with CONFIG_STRING_SELFTEST=y) I now get a different hang, so I disabled that for the time being.

Guenter

CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_PREEMPT=y
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_CGROUPS=y
CONFIG_MEMCG=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_SCHED=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_DEBUG=y
CONFIG_NAMESPACES=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EMBEDDED=y
CONFIG_PROFILING=y
CONFIG_PPC64=y
# CONFIG_PPC_POWERNV is not set
CONFIG_DTL=y
# CONFIG_CPU_IDLE is not set
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_BINFMT_MISC=m
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_XFRM_USER=m
CONFIG_XFRM_SUB_POLICY=y
CONFIG_NET_KEY=m
CONFIG_NET_KEY_MIGRATE=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NET_IPIP=m
CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_SYN_COOKIES=y
CONFIG_INET_AH=m
CONFIG_INET_ESP=m
CONFIG_INET_IPCOMP=m
CONFIG_IPV6_ROUTER_PREF=y
CONFIG_INET6_AH=y
CONFIG_INET6_ESP=y
CONFIG_INET6_IPCOMP=m
CONFIG_IPV6_TUNNEL=m
CONFIG_NETFILTER=y
CONFIG_NF_CONNTRACK=m
CONFIG_NF_CONNTRACK_AMANDA=m
CONFIG_NF_CONNTRACK_FTP=m
CONFIG_NF_CONNTRACK_H323=m
CONFIG_NF_CONNTRACK_IRC=m
CONFIG_NF_CONNTRACK_NETBIOS_NS=m
CONFIG_NF_CONNTRACK_PPTP=m
CONFIG_NF_CONNTRACK_SANE=m
CONFIG_NF_CONNTRACK_SIP=m
CONFIG_NF_CONNTRACK_TFTP=m
CONFIG_NF_CT_NETLINK=m
CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
CONFIG_NETFILTER_XT_TARGET_DSCP=m
CONFIG_NETFILTER_XT_TARGET_MARK=m
CONFIG_NETFILTER_XT_TARGET_NFLOG=m
CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
CONFIG_NETFILTER_XT_TARGET_TRACE=m
CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
CONFIG_NETFILTER_XT_MATCH_COMMENT=m
CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
CONFIG_NETFILTER_XT_MATCH_DCCP=m
CONFIG_NETFILTER_XT_MATCH_DSCP=m
CONFIG_NETFILTER_XT_MATCH_ESP=m
CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
CONFIG_NETFILTER_XT_MATCH_HELPER=m
CONFIG_NETFILTER_XT_MATCH_LENGTH=m
CONFIG_NETFILTER_XT_MATCH_LIMIT=m
CONFIG_NETFILTER_XT_MATCH_MAC=m
CONFIG_NETFILTER_XT_MATCH_MARK=m
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
CONFIG_NETFILTER_XT_MATCH_POLICY=m
CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
CONFIG_NETFILTER_XT_MATCH_QUOTA=m
CONFIG_NETFILTER_XT_MATCH_REALM=m
CONFIG_NETFILTER_XT_MATCH_STATE=m
CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
CONFIG_NETFILTER_XT_MATCH_STRING=m
CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
CONFIG_NETFILTER_XT_MATCH_U32=m
CONFIG_IP_NF_IPTABLES=m
CONFIG_IP_NF_MATCH_AH=m
CONFIG_IP_NF_MATCH_ECN=m
CONFIG_IP_NF_MATCH_TTL=m
CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_MANGLE=m
CONFIG_IP_NF_TARGET_CLUSTERIP=m
CONFIG_IP_NF_TARGET_ECN=m
CONFIG_IP_NF_TARGET_TTL=m
CONFIG_IP_NF_RAW=m
CONFIG_IP_NF_ARPTABLES=m
CONFIG_IP_NF_ARPFILTER=m
CONFIG_IP_NF_ARP_MANGLE=m
CONFIG_IP6_NF_IPTABLES=m
CONFIG_IP6_NF_MATCH_EUI64=m
CONFIG_IP6_NF_MATCH_FRAG=m
CONFIG_IP6_NF_MATCH_OPTS=m
CONFIG_IP6_NF_MATCH_HL=m
CONFIG_IP6_NF_MATCH_IPV6HEADER=m
CONFIG_IP6_NF_MATCH_RT=m
CONFIG_IP6_NF_FILTER=m
CONFIG_IP6_NF_MANGLE=m
CONFIG_IP6_NF_RAW=m
CONFIG_IP_SCTP=m
CONFIG_TIPC=m
CONFIG_BRIDGE=m
CONFIG_VLAN_8021Q=m
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_CBQ=m
CONFIG_NET_SCH_HTB=m
CONFIG_NET_SCH_HFSC=m
CONFIG_NET_SCH_PRIO=m
CONFIG_NET_SCH_RED=m
CONFIG_NET_SCH_SFQ=m
CONFIG_NET_SCH_TEQL=m
CONFIG_NET_SCH_TBF=m
CONFIG_NET_SCH_GRED=m
CONFIG_NET_SCH_DSMARK=m
CONFIG_NET_SCH_NETEM=m
CONFIG_NET_SCH_CODEL=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_CLS_BASIC=y
CONFIG_NET_CLS_U32=y
CONFIG_NET_CLS_CGROUP=y
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_MIRRED=m
CONFIG_NET_PKTGEN=m
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_FW_LOADER is not set
CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=y
CONFIG_VIRTIO_BLK=y
CONFIG_BLK_DEV_NVME=y
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_DEV_SR=y
CONFIG_MEGARAID_SAS=y
CONFIG_SCSI_SYM53C8XX_2=y
CONFIG_SCSI_DC395x=y
CONFIG_SCSI_AM53C974=y
CONFIG_SCSI_VIRTIO=y
CONFIG_ATA=y
CONFIG_SATA_SIL=y
CONFIG_PATA_MACIO=y
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_LINEAR=y
CONFIG_MD_RAID0=y
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
CONFIG_MD_MULTIPATH=y
CONFIG_MD_FAULTY=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_CRYPT=y
CONFIG_DM_SNAPSHOT=y
CONFIG_DM_MIRROR=y
CONFIG_DM_ZERO=y
CONFIG_FUSION=y
CONFIG_FUSION_SAS=y
CONFIG_NETDEVICES=y
CONFIG_BONDING=m
CONFIG_DUMMY=m
CONFIG_NETCONSOLE=y
CONFIG_TUN=m
CONFIG_VIRTIO_NET=y
CONFIG_PCNET32=y
CONFIG_NET_TULIP=y
CONFIG_TULIP=y
CONFIG_E100=y
CONFIG_E1000=y
CONFIG_E1000E=y
CONFIG_NE2K_PCI=y
CONFIG_8139CP=y
CONFIG_PPP=m
CONFIG_PPP_BSDCOMP=m
CONFIG_PPP_DEFLATE=m
CONFIG_PPP_FILTER=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPPOE=m
CONFIG_PPP_ASYNC=m
CONFIG_PPP_SYNC_TTY=m
CONFIG_SLIP=m
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLIP_SMART=y
CONFIG_SLIP_MODE_SLIP6=y
CONFIG_USB_USBNET=y
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_TABLET=y
CONFIG_INPUT_MISC=y
# CONFIG_SERIO_SERPORT is not set
CONFIG_SERIAL_PMACZILOG=y
CONFIG_SERIAL_PMACZILOG_TTYS=y
CONFIG_SERIAL_PMACZILOG_CONSOLE=y
CONFIG_POWER_SUPPLY=y
CONFIG_WATCHDOG=y
CONFIG_SOFT_WATCHDOG=m
# CONFIG_DRM_DEBUG_MODESET_LOCK is not set
CONFIG_FB=y
CONFIG_FB_OF=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_USB=y
CONFIG_USB_MON=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_STORAGE=y
CONFIG_USB_UAS=y
CONFIG_MMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PCI=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MMIO=y
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT3_FS=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_REISERFS_FS=m
CONFIG_REISERFS_FS_XATTR=y
CONFIG_REISERFS_FS_POSIX_ACL=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_AUTOFS4_FS=y
CONFIG_FUSE_FS=m
CONFIG_CUSE=m
CONFIG_ISO9660_FS=y
CONFIG_PROC_KCORE=y
CONFIG_TMPFS=y
CONFIG_CONFIGFS_FS=m
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_XATTR=y
CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y
CONFIG_MINIX_FS=m
CONFIG_ROMFS_FS=m
CONFIG_NFS_FS=y
CONFIG_NFS_V4=y
CONFIG_ROOT_NFS=y
CONFIG_NFSD=m
CONFIG_NFSD_V4=y
CONFIG_CIFS=m
CONFIG_CIFS_XATTR=y
CONFIG_CIFS_POSIX=y
CONFIG_NLS_CODEPAGE_437=m
CONFIG_NLS_CODEPAGE_737=m
CONFIG_NLS_CODEPAGE_775=m
CONFIG_NLS_CODEPAGE_850=m
CONFIG_NLS_CODEPAGE_852=m
CONFIG_NLS_CODEPAGE_855=m
CONFIG_NLS_CODEPAGE_857=m
CONFIG_NLS_CODEPAGE_860=m
CONFIG_NLS_CODEPAGE_861=m
CONFIG_NLS_CODEPAGE_862=m
CONFIG_NLS_CODEPAGE_863=m
CONFIG_NLS_CODEPAGE_864=m
CONFIG_NLS_CODEPAGE_865=m
CONFIG_NLS_CODEPAGE_866=m
CONFIG_NLS_CODEPAGE_869=m
CONFIG_NLS_CODEPAGE_936=m
CONFIG_NLS_CODEPAGE_950=m
CONFIG_NLS_CODEPAGE_932=m
CONFIG_NLS_CODEPAGE_949=m
CONFIG_NLS_CODEPAGE_874=m
CONFIG_NLS_ISO8859_8=m
CONFIG_NLS_CODEPAGE_1250=m
CONFIG_NLS_CODEPAGE_1251=m
CONFIG_NLS_ASCII=m
CONFIG_NLS_ISO8859_1=m
CONFIG_NLS_ISO8859_2=m
CONFIG_NLS_ISO8859_3=m
CONFIG_NLS_ISO8859_4=m
CONFIG_NLS_ISO8859_5=m
CONFIG_NLS_ISO8859_6=m
CONFIG_NLS_ISO8859_7=m
CONFIG_NLS_ISO8859_9=m
CONFIG_NLS_ISO8859_13=m
CONFIG_NLS_ISO8859_14=m
CONFIG_NLS_ISO8859_15=m
CONFIG_NLS_KOI8_R=m
CONFIG_NLS_KOI8_U=m
CONFIG_NLS_UTF8=m
CONFIG_SECURITY=y
CONFIG_CRYPTO_TEST=m
CONFIG_CRYPTO_BLOWFISH=m
CONFIG_CRYPTO_CAMELLIA=m
CONFIG_CRYPTO_CAST5=m
CONFIG_CRYPTO_CAST6=m
CONFIG_CRYPTO_SERPENT=m
CONFIG_CRYPTO_TWOFISH=m
CONFIG_CRYPTO_MICHAEL_MIC=m
CONFIG_CRYPTO_WP512=m
CONFIG_CRYPTO_XCBC=m
CONFIG_DEBUG_INFO_DWARF5=y
CONFIG_KGDB=y
CONFIG_KGDB_KDB=y
CONFIG_PANIC_ON_OOPS=y
CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=30
CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y
CONFIG_DEBUG_LOCKDEP=y
CONFIG_DEBUG_ATOMIC_SLEEP=y
CONFIG_DEBUG_LIST=y
CONFIG_LATENCYTOP=y
CONFIG_FUNCTION_TRACER=y
CONFIG_FTRACE_SYSCALLS=y
CONFIG_BLK_DEV_IO_TRACE=y

#31 lore raw
In reply to Jason A. Donenfeld
Quoted 18 lines · Jason A. Donenfeld
Quoted 12 lines · Guenter Roeck

NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300 LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258

Obviously the first couple lines of this concern me a bit. But I think actually this might just be a catalyst for another bug. You could view that function as basically just:

Quoted 8 lines
    while (something)
    	schedule();

And I guess in the process of calling the scheduler a lot, which toggles interrupts a lot, something got wedged.

Curious, though, I did try to reproduce this, to no avail. My .config is
https://xn--4db.cc/rBvHWfDZ . What's yours?

I also just tried using your github linux-build-test scripts as a guide for construction a config -- https://xn--4db.cc/B0HpEQDQ -- and loaded up your rootfs over sdhci and such, and still couldn't manage to reproduce. I tried commenting out the line "if (!bits)" in _credit_init_bits(), so that the rng would never initialize, so that the schedule() loop would just keep on running indefinitely, but still no dice.

But also, I'm running Linus' tree. From your log, I see "6.0.0-rc2-00163-ga5edf9815dd7". So maybe these bugs got fixed elsewhere?

Jason

#32 lore raw
Quoted 36 lines · Jason A. Donenfeld
Quoted 18 lines · Jason A. Donenfeld
Quoted 12 lines · Guenter Roeck

NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300 LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258

Obviously the first couple lines of this concern me a bit. But I think actually this might just be a catalyst for another bug. You could view that function as basically just:

Quoted 8 lines
    while (something)
    	schedule();

And I guess in the process of calling the scheduler a lot, which toggles interrupts a lot, something got wedged.

Curious, though, I did try to reproduce this, to no avail. My .config is
https://xn--4db.cc/rBvHWfDZ . What's yours?

I also just tried using your github linux-build-test scripts as a guide for construction a config -- https://xn--4db.cc/B0HpEQDQ -- and loaded up your rootfs over sdhci and such, and still couldn't manage to reproduce. I tried commenting out the line "if (!bits)" in _credit_init_bits(), so that the rng would never initialize, so that the schedule() loop would just keep on running indefinitely, but still no dice.

Quoted 4 lines

But also, I'm running Linus' tree. From your log, I see "6.0.0-rc2-00163-ga5edf9815dd7". So maybe these bugs got fixed elsewhere?

Blame me for not attaching the latest crash report.

Guenter

---

BUG: soft lockup - CPU#0 stuck for 23s! [dd:111]
Modules linked in:
CPU: 0 PID: 111 Comm: dd Not tainted 6.0.0-11414-g49da07006239 #1
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
NIP:  c000000000031630 LR: c000000000031964 CTR: 0000000000000000
REGS: c000000007d5b6a8 TRAP: 0900   Not tainted  (6.0.0-11414-g49da07006239)
MSR:  8000000000009032 <SF,EE,ME,IR,DR,RI>  CR: 28002228  XER: 00000000

IRQMASK: 0
GPR00: c000000000031964 c000000007d5b870 c0000000013e5500 c000000007d5b6a8
GPR04: c00000000125e1c0 0000000000000000 c000000007d5b814 c00000000291d018
GPR08: c000000002d4bbb8 0000000000000000 c000000007356400 c000000002d21098
GPR12: 0000000028002222 c000000002e20000 00000000100d32e0 00000000100d32b4
GPR16: 00000000100d3301 00000000100d32b9 00000000100d3358 00000000100d32bf
GPR20: 0000000000002000 00000000100d3372 00000000100d331e c000000007356c18
GPR24: 0000000000000000 0000000000000e60 0000000000000900 0000000000000500
GPR28: 0000000000000a00 0000000000000f00 0000000000000002 0000000000000003 NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300
LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007d5b870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007d5b8f0] [c000000000f8bac4] .__schedule+0x664/0xa50
[c000000007d5b9d0] [c000000000f8bf30] .schedule+0x80/0x140
[c000000007d5ba50] [c00000000093085c] .try_to_generate_entropy+0x118/0x174
[c000000007d5bb40] [c00000000092fa64] .urandom_read_iter+0x74/0x140
[c000000007d5bbc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007d5bcd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007d5bd80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007d5be10] [c00000000000c1d4] system_call_common+0xf4/0x258
--- interrupt: c00 at 0x7fffb5c9d49c
NIP:  00007fffb5c9d49c LR: 000000001000da90 CTR: 0000000000000000
REGS: c000000007d5be80 TRAP: 0c00   Not tainted  (6.0.0-11414-g49da07006239)
MSR:  800000000000f032 <SF,EE,PR,FP,ME,IR,DR,RI>  CR: 22002422  XER: 00000000
IRQMASK: 0
GPR00: 0000000000000003 00007ffff6dcc220 00007fffb5d97300 0000000000000000
GPR04: 00000000101102a0 0000000000000020 0000000000000000 0000000000000000
GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR12: 0000000000000000 00007fffb5e6aac0 00000000100d32e0 00000000100d32b4
GPR16: 00000000100d3301 00000000100d32b9 00000000100d3358 00000000100d32bf
GPR20: 0000000000002000 00000000100d3372 00000000100d331e 0000000000000000
GPR24: 7fffffffffffffff 00000000100b3a9c 00000000101102a0 0000000000000020
GPR28: 00000000101025c0 0000000000000020 0000000000000000 0000000000000000

NIP [00007fffb5c9d49c] 0x7fffb5c9d49c
LR [000000001000da90] 0x1000da90
--- interrupt: c00
Instruction dump:
3b600500 3b800a00 3ba00f00 f8010010 f821fdc1 60000000 60000000 38610078 e92d0af8 f92101f8 39200000 48039745 <60000000> 39000000 e9410180 892d0933

Kernel panic - not syncing: softlockup: hung tasks
CPU: 0 PID: 111 Comm: dd Tainted: G             L     6.0.0-11414-g49da07006239 #1
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
Call Trace:
[c000000007d5b180] [c000000000f59b40] .dump_stack_lvl+0x7c/0xc4 (unreliable)
[c000000007d5b210] [c0000000000d5b58] .panic+0x174/0x42c
[c000000007d5b2c0] [c000000000231054] .watchdog_timer_fn+0x3a4/0x3e0
[c000000007d5b380] [c0000000001cc65c] .__hrtimer_run_queues+0x1fc/0x650
[c000000007d5b490] [c0000000001cd5cc] .hrtimer_interrupt+0x11c/0x320
[c000000007d5b550] [c000000000021f5c] .timer_interrupt+0x1cc/0x600
[c000000007d5b630] [c0000000000316c8] .replay_soft_interrupts+0xf8/0x300
[c000000007d5b870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0
[c000000007d5b8f0] [c000000000f8bac4] .__schedule+0x664/0xa50
[c000000007d5b9d0] [c000000000f8bf30] .schedule+0x80/0x140
[c000000007d5ba50] [c00000000093085c] .try_to_generate_entropy+0x118/0x174
[c000000007d5bb40] [c00000000092fa64] .urandom_read_iter+0x74/0x140
[c000000007d5bbc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007d5bcd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007d5bd80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007d5be10] [c00000000000c1d4] system_call_common+0xf4/0x258
--- interrupt: c00 at 0x7fffb5c9d49c
NIP:  00007fffb5c9d49c LR: 000000001000da90 CTR: 0000000000000000
REGS: c000000007d5be80 TRAP: 0c00   Tainted: G             L      (6.0.0-11414-g49da07006239)
MSR:  800000000000f032 <SF,EE,PR,FP,ME,IR,DR,RI>  CR: 22002422  XER: 00000000
IRQMASK: 0
GPR00: 0000000000000003 00007ffff6dcc220 00007fffb5d97300 0000000000000000
GPR04: 00000000101102a0 0000000000000020 0000000000000000 0000000000000000
GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR12: 0000000000000000 00007fffb5e6aac0 00000000100d32e0 00000000100d32b4
GPR16: 00000000100d3301 00000000100d32b9 00000000100d3358 00000000100d32bf
GPR20: 0000000000002000 00000000100d3372 00000000100d331e 0000000000000000
GPR24: 7fffffffffffffff 00000000100b3a9c 00000000101102a0 0000000000000020
GPR28: 00000000101025c0 0000000000000020 0000000000000000 0000000000000000

NIP [00007fffb5c9d49c] 0x7fffb5c9d49c
LR [000000001000da90] 0x1000da90
--- interrupt: c00

#17 lore raw
In reply to Guenter Roeck
Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Jason A. Donenfeld
Quoted 12 lines · Guenter Roeck

NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300 LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258

Obviously the first couple lines of this concern me a bit. But I think actually this might just be a catalyst for another bug. You could view that function as basically just:

    while (something)
    	schedule();
Quoted 8 lines
Quoted 6 lines

And I guess in the process of calling the scheduler a lot, which toggles interrupts a lot, something got wedged.

Curious, though, I did try to reproduce this, to no avail. My .config is
https://xn--4db.cc/rBvHWfDZ . What's yours?

Attached. My qemu command line is

Okay, thanks, I reproduced it. In this case, I suspect try_to_generate_entropy() is just the messenger. There's an earlier problem:

BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
caller is .__flush_tlb_pending+0x40/0xf0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.0.0-28380-gde492c83cae0-dirty #4
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
Call Trace:
[c0000000044c3540] [c000000000f93ef0] .dump_stack_lvl+0x7c/0xc4 (unreliable)
[c0000000044c35d0] [c000000000fc9550] .check_preemption_disabled+0x140/0x150
[c0000000044c3660] [c000000000073dd0] .__flush_tlb_pending+0x40/0xf0
[c0000000044c36f0] [c000000000334434] .__apply_to_page_range+0x764/0xa30
[c0000000044c3840] [c00000000006cad0] .change_memory_attr+0xf0/0x160
[c0000000044c38d0] [c0000000002a1d70] .bpf_prog_select_runtime+0x150/0x230
[c0000000044c3970] [c000000000d405d4] .bpf_prepare_filter+0x504/0x6f0
[c0000000044c3a30] [c000000000d4085c] .bpf_prog_create+0x9c/0x140
[c0000000044c3ac0] [c000000002051d9c] .ptp_classifier_init+0x44/0x78
[c0000000044c3b50] [c000000002050f3c] .sock_init+0xe0/0x100
[c0000000044c3bd0] [c000000000010bd4] .do_one_initcall+0xa4/0x438
[c0000000044c3cc0] [c000000002005008] .kernel_init_freeable+0x378/0x428
[c0000000044c3da0] [c0000000000113d8] .kernel_init+0x28/0x1a0
[c0000000044c3e10] [c00000000000ca3c] .ret_from_kernel_thread+0x58/0x60

This in turn is because __flush_tlb_pending() calls:

static inline int mm_is_thread_local(struct mm_struct *mm)

{
        return cpumask_equal(mm_cpumask(mm),
                              cpumask_of(smp_processor_id()));
}

__flush_tlb_pending() has a comment about this:

* Must be called from within some kind of spinlock/non-preempt region... */
void __flush_tlb_pending(struct ppc64_tlb_batch *batch)

So I guess that didn't happen for some reason? Maybe this is indicative of some lock imbalance that then gets hit later?

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

Jason

#18 lore raw
Quoted 30 lines · Jason A. Donenfeld
Quoted 29 lines · Guenter Roeck
Quoted 27 lines · Jason A. Donenfeld
Quoted 12 lines · Guenter Roeck

NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300 LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258

Obviously the first couple lines of this concern me a bit. But I think actually this might just be a catalyst for another bug. You could view that function as basically just:

    while (something)
    	schedule();

And I guess in the process of calling the scheduler a lot, which toggles interrupts a lot, something got wedged.

Curious, though, I did try to reproduce this, to no avail. My .config is
https://xn--4db.cc/rBvHWfDZ . What's yours?

Quoted 6 lines
Quoted 1 line

Attached. My qemu command line is

Okay, thanks, I reproduced it. In this case, I suspect try_to_generate_entropy() is just the messenger. There's an earlier problem:

That problem is not new but has existed for a couple of releases, and has never caused a hang until now.

Quoted 34 lines
BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
caller is .__flush_tlb_pending+0x40/0xf0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.0.0-28380-gde492c83cae0-dirty #4
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
Call Trace:
[c0000000044c3540] [c000000000f93ef0] .dump_stack_lvl+0x7c/0xc4 (unreliable)
[c0000000044c35d0] [c000000000fc9550] .check_preemption_disabled+0x140/0x150
[c0000000044c3660] [c000000000073dd0] .__flush_tlb_pending+0x40/0xf0
[c0000000044c36f0] [c000000000334434] .__apply_to_page_range+0x764/0xa30
[c0000000044c3840] [c00000000006cad0] .change_memory_attr+0xf0/0x160
[c0000000044c38d0] [c0000000002a1d70] .bpf_prog_select_runtime+0x150/0x230
[c0000000044c3970] [c000000000d405d4] .bpf_prepare_filter+0x504/0x6f0
[c0000000044c3a30] [c000000000d4085c] .bpf_prog_create+0x9c/0x140
[c0000000044c3ac0] [c000000002051d9c] .ptp_classifier_init+0x44/0x78
[c0000000044c3b50] [c000000002050f3c] .sock_init+0xe0/0x100
[c0000000044c3bd0] [c000000000010bd4] .do_one_initcall+0xa4/0x438
[c0000000044c3cc0] [c000000002005008] .kernel_init_freeable+0x378/0x428
[c0000000044c3da0] [c0000000000113d8] .kernel_init+0x28/0x1a0
[c0000000044c3e10] [c00000000000ca3c] .ret_from_kernel_thread+0x58/0x60

This in turn is because __flush_tlb_pending() calls:

static inline int mm_is_thread_local(struct mm_struct *mm)

{
        return cpumask_equal(mm_cpumask(mm),
                              cpumask_of(smp_processor_id()));
}

__flush_tlb_pending() has a comment about this:

* Must be called from within some kind of spinlock/non-preempt region... */
void __flush_tlb_pending(struct ppc64_tlb_batch *batch)

Quoted 9 lines

So I guess that didn't happen for some reason? Maybe this is indicative of some lock imbalance that then gets hit later?

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

That probably explains why my attempts to bisect the problem were unsuccessful.

Thanks,
Guenter

#19 lore raw
Quoted 9 lines · Guenter Roeck
Quoted 6 lines

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

That probably explains why my attempts to bisect the problem were unsuccessful.

So I just did this:

drivers/char/random.c +1 -0
index 2fe28eeb2f38..2d70bc09db7e 100644
@@ -1212,6 +1212,7 @@ static void __cold try_to_generate_entropy(void)
        struct entropy_timer_state stack;
        unsigned int i, num_different = 0;
        unsigned long last = random_get_entropy();
+       return;
 
        for (i = 0; i < NUM_TRIAL_SAMPLES - 1; ++i) {
                stack.entropy = random_get_entropy();

And then ran it, and now we get the lockup from the idle process:

udhcpc: started, v1.33.0
udhcpc: sending discover

watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [swapper/0:0]
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.0.0-28380-gde492c83cae0-dirty #10
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
NIP:  c0000000000300f8 LR: c0000000000304e8 CTR: c00000000001a410
REGS: c0000000028c79a8 TRAP: 0900   Not tainted  (6.0.0-28380-gde492c83cae0-dirty)
MSR:  800000000000b032 <SF,EE,FP,ME,IR,DR,RI>  CR: 24088442  XER: 00000000

IRQMASK: 0
GPR00: c0000000000304e8 c0000000028c7b30 c000000001435500 c0000000028c79a8
GPR04: c0000000013366c0 0000000000000000 000000000010029c 0000000000000000
GPR08: c000000002d3bbb0 0000000000000000 c000000002883d00 c000000002915500
GPR12: 0000000044088442 c000000002e00000 0000000000000007 0000000002295698
GPR16: 00000000039400e8 0000000002295258 0000000002295660 00000000022953d0
GPR20: 0000000002295b10 00000000022b34d0 0000000002295b38 0000000003945500
GPR24: 0000000003945500 0000000000080000 c000000002883d80 c000000002883d00
GPR28: c00000000290d0c0 0000000000000001 c00000000290d018 c00000000290cc78 NIP [c0000000000300f8] .replay_soft_interrupts+0x28/0x2d0
LR [c0000000000304e8] .arch_local_irq_restore+0x148/0x1a0

Call Trace:
[c0000000028c7b30] [c0000000000304e8] .arch_local_irq_restore+0x148/0x1a0 (unreliable)
[c0000000028c7bb0] [c00000000001a388] .arch_cpu_idle+0xb8/0x140
[c0000000028c7c30] [c000000000fd4940] .default_idle_call+0x80/0xc8
[c0000000028c7ca0] [c000000000148480] .do_idle+0x150/0x1a0
[c0000000028c7d50] [c000000000148748] .cpu_startup_entry+0x38/0x40
[c0000000028c7dd0] [c0000000000113a8] .rest_init+0x168/0x170
[c0000000028c7e60] [c000000002004224] .arch_post_acpi_subsys_init+0x0/0x24
[c0000000028c7ed0] [c000000002004ba8] .start_kernel+0x8d0/0x924
[c0000000028c7f90] [c00000000000d4ac] start_here_common+0x1c/0x20
Instruction dump:
60000000 60000000 7c0802a6 f8010010 f821fe01 60000000 60000000 38610078
e92d0af8 f92101f8 39200000 4803a491 <60000000> 39200000 e9410180 f92101b0
Kernel panic - not syncing: softlockup: hung tasks
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G             L     6.0.0-28380-gde492c83cae0-dirty #10
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
Call Trace:
[c0000000028c74a0] [c000000000f93b90] .dump_stack_lvl+0x7c/0xc4 (unreliable)
[c0000000028c7530] [c0000000000d2a58] .panic+0x180/0x438
[c0000000028c75e0] [c000000000232424] .watchdog_timer_fn+0x3a4/0x410
[c0000000028c76a0] [c0000000001cb964] .__hrtimer_run_queues+0x1f4/0x590
[c0000000028c77a0] [c0000000001cc354] .hrtimer_interrupt+0x134/0x300
[c0000000028c7860] [c000000000021cd4] .timer_interrupt+0x1c4/0x5d0
[c0000000028c7930] [c0000000000302f8] .replay_soft_interrupts+0x228/0x2d0
[c0000000028c7b30] [c0000000000304e8] .arch_local_irq_restore+0x148/0x1a0
[c0000000028c7bb0] [c00000000001a388] .arch_cpu_idle+0xb8/0x140
[c0000000028c7c30] [c000000000fd4940] .default_idle_call+0x80/0xc8
[c0000000028c7ca0] [c000000000148480] .do_idle+0x150/0x1a0
[c0000000028c7d50] [c000000000148748] .cpu_startup_entry+0x38/0x40
[c0000000028c7dd0] [c0000000000113a8] .rest_init+0x168/0x170
[c0000000028c7e60] [c000000002004224] .arch_post_acpi_subsys_init+0x0/0x24
[c0000000028c7ed0] [c000000002004ba8] .start_kernel+0x8d0/0x924

[c0000000028c7f90] [c00000

#21 lore raw
In reply to Jason A. Donenfeld
Quoted 7 lines · Jason A. Donenfeld

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

I managed to bisect the problem. See below for results. Reverting the offending patch fixes the problem for me.

Guenter

---
# bad: [1440f576022887004f719883acb094e7e0dd4944] Merge tag 'mm-hotfixes-stable-2022-10-11' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
# good: [4fe89d07dcc2804c8b562f6c7896a45643d34b2f] Linux 6.0
git bisect start 'HEAD' 'v6.0'
# good: [7171a8da00035e7913c3013ca5fb5beb5b8b22f0] Merge tag 'arm-dt-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
git bisect good 7171a8da00035e7913c3013ca5fb5beb5b8b22f0
# good: [f01603979a4afaad7504a728918b678d572cda9e] Merge tag 'gpio-updates-for-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
git bisect good f01603979a4afaad7504a728918b678d572cda9e
# bad: [8aeab132e05fefc3a1a5277878629586bd7a3547] Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
git bisect bad 8aeab132e05fefc3a1a5277878629586bd7a3547
# bad: [493ffd6605b2d3d4dc7008ab927dba319f36671f] Merge tag 'ucount-rlimits-cleanups-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
git bisect bad 493ffd6605b2d3d4dc7008ab927dba319f36671f
# good: [0e470763d84dcad27284067647dfb4b1a94dfce0] Merge tag 'efi-next-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi
git bisect good 0e470763d84dcad27284067647dfb4b1a94dfce0
# bad: [110a58b9f91c66f743c01a2c217243d94c899c23] powerpc/boot: Explicitly disable usage of SPE instructions
git bisect bad 110a58b9f91c66f743c01a2c217243d94c899c23
# good: [fdfdcfd504933ed06eb6b4c9df21eede0e213c3e] powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE
git bisect good fdfdcfd504933ed06eb6b4c9df21eede0e213c3e
# good: [c2e7a19827eec443a7cbe85e8d959052412d6dc3] powerpc: Use generic fallocate compatibility syscall
git bisect good c2e7a19827eec443a7cbe85e8d959052412d6dc3
# good: [56adbb7a8b6cc7fc9b940829c38494e53c9e57d1] powerpc/64/interrupt: Fix false warning in context tracking due to idle state
git bisect good 56adbb7a8b6cc7fc9b940829c38494e53c9e57d1
# bad: [754f611774e4b9357a944f5b703dd291c85161cf] powerpc/64: switch asm helpers from GOT to TOC relative addressing
git bisect bad 754f611774e4b9357a944f5b703dd291c85161cf
# bad: [f7bff6e7759b1abb59334f6448f9ef3172c4c04a] powerpc/64/interrupt: avoid BUG/WARN recursion in interrupt entry
git bisect bad f7bff6e7759b1abb59334f6448f9ef3172c4c04a
# bad: [e485f6c751e0a969327336c635ca602feea117f0] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
git bisect bad e485f6c751e0a969327336c635ca602feea117f0
# good: [799f7063c7645f9a751d17f5dfd73b952f962cd2] powerpc/64: mark irqs hard disabled in boot paca
git bisect good 799f7063c7645f9a751d17f5dfd73b952f962cd2

# first bad commit: [e485f6c751e0a969327336c635ca602feea117f0] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
author reviewer
#22 lore raw
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Jason A. Donenfeld

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

I managed to bisect the problem. See below for results. Reverting the offending patch fixes the problem for me.

Thanks.

This is probably down to me/us not testing with PREEMPT enabled enough.

cheers

Quoted 31 lines

---
# bad: [1440f576022887004f719883acb094e7e0dd4944] Merge tag 'mm-hotfixes-stable-2022-10-11' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
# good: [4fe89d07dcc2804c8b562f6c7896a45643d34b2f] Linux 6.0
git bisect start 'HEAD' 'v6.0'
# good: [7171a8da00035e7913c3013ca5fb5beb5b8b22f0] Merge tag 'arm-dt-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
git bisect good 7171a8da00035e7913c3013ca5fb5beb5b8b22f0
# good: [f01603979a4afaad7504a728918b678d572cda9e] Merge tag 'gpio-updates-for-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
git bisect good f01603979a4afaad7504a728918b678d572cda9e
# bad: [8aeab132e05fefc3a1a5277878629586bd7a3547] Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
git bisect bad 8aeab132e05fefc3a1a5277878629586bd7a3547
# bad: [493ffd6605b2d3d4dc7008ab927dba319f36671f] Merge tag 'ucount-rlimits-cleanups-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
git bisect bad 493ffd6605b2d3d4dc7008ab927dba319f36671f
# good: [0e470763d84dcad27284067647dfb4b1a94dfce0] Merge tag 'efi-next-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi
git bisect good 0e470763d84dcad27284067647dfb4b1a94dfce0
# bad: [110a58b9f91c66f743c01a2c217243d94c899c23] powerpc/boot: Explicitly disable usage of SPE instructions
git bisect bad 110a58b9f91c66f743c01a2c217243d94c899c23
# good: [fdfdcfd504933ed06eb6b4c9df21eede0e213c3e] powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE
git bisect good fdfdcfd504933ed06eb6b4c9df21eede0e213c3e
# good: [c2e7a19827eec443a7cbe85e8d959052412d6dc3] powerpc: Use generic fallocate compatibility syscall
git bisect good c2e7a19827eec443a7cbe85e8d959052412d6dc3
# good: [56adbb7a8b6cc7fc9b940829c38494e53c9e57d1] powerpc/64/interrupt: Fix false warning in context tracking due to idle state
git bisect good 56adbb7a8b6cc7fc9b940829c38494e53c9e57d1
# bad: [754f611774e4b9357a944f5b703dd291c85161cf] powerpc/64: switch asm helpers from GOT to TOC relative addressing
git bisect bad 754f611774e4b9357a944f5b703dd291c85161cf
# bad: [f7bff6e7759b1abb59334f6448f9ef3172c4c04a] powerpc/64/interrupt: avoid BUG/WARN recursion in interrupt entry
git bisect bad f7bff6e7759b1abb59334f6448f9ef3172c4c04a
# bad: [e485f6c751e0a969327336c635ca602feea117f0] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
git bisect bad e485f6c751e0a969327336c635ca602feea117f0
# good: [799f7063c7645f9a751d17f5dfd73b952f962cd2] powerpc/64: mark irqs hard disabled in boot paca
git bisect good 799f7063c7645f9a751d17f5dfd73b952f962cd2

# first bad commit: [e485f6c751e0a969327336c635ca602feea117f0] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
#23 lore raw
Quoted 10 lines · Michael Ellerman
Quoted 9 lines · Guenter Roeck
Quoted 7 lines · Jason A. Donenfeld

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

Quoted 7 lines
Quoted 2 lines

I managed to bisect the problem. See below for results. Reverting the offending patch fixes the problem for me.

Thanks.

This is probably down to me/us not testing with PREEMPT enabled enough.

Not sure. My configuration has

CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set

Guenter

Quoted 33 lines

cheers

Quoted 31 lines

---
# bad: [1440f576022887004f719883acb094e7e0dd4944] Merge tag 'mm-hotfixes-stable-2022-10-11' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
# good: [4fe89d07dcc2804c8b562f6c7896a45643d34b2f] Linux 6.0
git bisect start 'HEAD' 'v6.0'
# good: [7171a8da00035e7913c3013ca5fb5beb5b8b22f0] Merge tag 'arm-dt-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
git bisect good 7171a8da00035e7913c3013ca5fb5beb5b8b22f0
# good: [f01603979a4afaad7504a728918b678d572cda9e] Merge tag 'gpio-updates-for-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
git bisect good f01603979a4afaad7504a728918b678d572cda9e
# bad: [8aeab132e05fefc3a1a5277878629586bd7a3547] Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
git bisect bad 8aeab132e05fefc3a1a5277878629586bd7a3547
# bad: [493ffd6605b2d3d4dc7008ab927dba319f36671f] Merge tag 'ucount-rlimits-cleanups-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
git bisect bad 493ffd6605b2d3d4dc7008ab927dba319f36671f
# good: [0e470763d84dcad27284067647dfb4b1a94dfce0] Merge tag 'efi-next-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi
git bisect good 0e470763d84dcad27284067647dfb4b1a94dfce0
# bad: [110a58b9f91c66f743c01a2c217243d94c899c23] powerpc/boot: Explicitly disable usage of SPE instructions
git bisect bad 110a58b9f91c66f743c01a2c217243d94c899c23
# good: [fdfdcfd504933ed06eb6b4c9df21eede0e213c3e] powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE
git bisect good fdfdcfd504933ed06eb6b4c9df21eede0e213c3e
# good: [c2e7a19827eec443a7cbe85e8d959052412d6dc3] powerpc: Use generic fallocate compatibility syscall
git bisect good c2e7a19827eec443a7cbe85e8d959052412d6dc3
# good: [56adbb7a8b6cc7fc9b940829c38494e53c9e57d1] powerpc/64/interrupt: Fix false warning in context tracking due to idle state
git bisect good 56adbb7a8b6cc7fc9b940829c38494e53c9e57d1
# bad: [754f611774e4b9357a944f5b703dd291c85161cf] powerpc/64: switch asm helpers from GOT to TOC relative addressing
git bisect bad 754f611774e4b9357a944f5b703dd291c85161cf
# bad: [f7bff6e7759b1abb59334f6448f9ef3172c4c04a] powerpc/64/interrupt: avoid BUG/WARN recursion in interrupt entry
git bisect bad f7bff6e7759b1abb59334f6448f9ef3172c4c04a
# bad: [e485f6c751e0a969327336c635ca602feea117f0] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
git bisect bad e485f6c751e0a969327336c635ca602feea117f0
# good: [799f7063c7645f9a751d17f5dfd73b952f962cd2] powerpc/64: mark irqs hard disabled in boot paca
git bisect good 799f7063c7645f9a751d17f5dfd73b952f962cd2

# first bad commit: [e485f6c751e0a969327336c635ca602feea117f0] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
#28 lore raw
In reply to Jason A. Donenfeld
Quoted 64 lines · Jason A. Donenfeld
Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Jason A. Donenfeld
Quoted 12 lines · Guenter Roeck

NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300 LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258

Obviously the first couple lines of this concern me a bit. But I think actually this might just be a catalyst for another bug. You could view that function as basically just:

     while (something)
     	schedule();
Quoted 8 lines
Quoted 6 lines

And I guess in the process of calling the scheduler a lot, which toggles interrupts a lot, something got wedged.

Curious, though, I did try to reproduce this, to no avail. My .config is
https://xn--4db.cc/rBvHWfDZ . What's yours?

Attached. My qemu command line is

Okay, thanks, I reproduced it. In this case, I suspect try_to_generate_entropy() is just the messenger. There's an earlier problem:

BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
caller is .__flush_tlb_pending+0x40/0xf0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.0.0-28380-gde492c83cae0-dirty #4
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
Call Trace:
[c0000000044c3540] [c000000000f93ef0] .dump_stack_lvl+0x7c/0xc4 (unreliable)
[c0000000044c35d0] [c000000000fc9550] .check_preemption_disabled+0x140/0x150
[c0000000044c3660] [c000000000073dd0] .__flush_tlb_pending+0x40/0xf0
[c0000000044c36f0] [c000000000334434] .__apply_to_page_range+0x764/0xa30
[c0000000044c3840] [c00000000006cad0] .change_memory_attr+0xf0/0x160
[c0000000044c38d0] [c0000000002a1d70] .bpf_prog_select_runtime+0x150/0x230
[c0000000044c3970] [c000000000d405d4] .bpf_prepare_filter+0x504/0x6f0
[c0000000044c3a30] [c000000000d4085c] .bpf_prog_create+0x9c/0x140
[c0000000044c3ac0] [c000000002051d9c] .ptp_classifier_init+0x44/0x78
[c0000000044c3b50] [c000000002050f3c] .sock_init+0xe0/0x100
[c0000000044c3bd0] [c000000000010bd4] .do_one_initcall+0xa4/0x438
[c0000000044c3cc0] [c000000002005008] .kernel_init_freeable+0x378/0x428
[c0000000044c3da0] [c0000000000113d8] .kernel_init+0x28/0x1a0
[c0000000044c3e10] [c00000000000ca3c] .ret_from_kernel_thread+0x58/0x60

This in turn is because __flush_tlb_pending() calls:

static inline int mm_is_thread_local(struct mm_struct *mm)

{
         return cpumask_equal(mm_cpumask(mm),
                               cpumask_of(smp_processor_id()));
}
Quoted 8 lines

__flush_tlb_pending() has a comment about this:

* Must be called from within some kind of spinlock/non-preempt region... */
void __flush_tlb_pending(struct ppc64_tlb_batch *batch)

So I guess that didn't happen for some reason? Maybe this is indicative of some lock imbalance that then gets hit later?

I managed to bisect that problem. Unfortunately it points to the scheduler merge. No idea what to do about that. Any idea ? I am copying Peter and Ingo for comments.

Guenter

---
# bad: [1440f576022887004f719883acb094e7e0dd4944] Merge tag 'mm-hotfixes-stable-2022-10-11' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
# good: [4fe89d07dcc2804c8b562f6c7896a45643d34b2f] Linux 6.0
git bisect start 'HEAD' 'v6.0'
# good: [7171a8da00035e7913c3013ca5fb5beb5b8b22f0] Merge tag 'arm-dt-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
git bisect good 7171a8da00035e7913c3013ca5fb5beb5b8b22f0
# good: [f01603979a4afaad7504a728918b678d572cda9e] Merge tag 'gpio-updates-for-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
git bisect good f01603979a4afaad7504a728918b678d572cda9e
# bad: [8aeab132e05fefc3a1a5277878629586bd7a3547] Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
git bisect bad 8aeab132e05fefc3a1a5277878629586bd7a3547
# good: [493ffd6605b2d3d4dc7008ab927dba319f36671f] Merge tag 'ucount-rlimits-cleanups-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
git bisect good 493ffd6605b2d3d4dc7008ab927dba319f36671f
# bad: [cdf072acb5baa18e5b05bdf3f13d6481f62396fc] Merge tag 'trace-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
git bisect bad cdf072acb5baa18e5b05bdf3f13d6481f62396fc
# bad: [55be6084c8e0e0ada9278c2ab60b7a584378efda] Merge tag 'timers-core-2022-10-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect bad 55be6084c8e0e0ada9278c2ab60b7a584378efda
# good: [82aad7ff7ac25c8cf09d491ae23b9823f1901486] perf/hw_breakpoint: Annotate tsk->perf_event_mutex vs ctx->mutex
git bisect good 82aad7ff7ac25c8cf09d491ae23b9823f1901486
# bad: [3871d93b82a4a6c1f4308064f046a544f16ada21] Merge tag 'perf-core-2022-10-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect bad 3871d93b82a4a6c1f4308064f046a544f16ada21
# good: [33f93525799fa3c841b2ba93a56b2bb32ab11dc9] sched/deadline: Move __dl_clear_params out of dl_bw lock
git bisect good 33f93525799fa3c841b2ba93a56b2bb32ab11dc9
# good: [929659acea03db6411a32de9037abab9f856f586] sched/completion: Add wait_for_completion_state()
git bisect good 929659acea03db6411a32de9037abab9f856f586
# good: [b0defa7ae03ecf91b8bfd10ede430cff12fcbd06] sched/fair: Make sure to try to detach at least one movable task
git bisect good b0defa7ae03ecf91b8bfd10ede430cff12fcbd06
# good: [5aec788aeb8eb74282b75ac1b317beb0fbb69a42] sched: Fix TASK_state comparisons
git bisect good 5aec788aeb8eb74282b75ac1b317beb0fbb69a42
# bad: [30c999937f69abf935b0228b8411713737377d9e] Merge tag 'sched-core-2022-10-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect bad 30c999937f69abf935b0228b8411713737377d9e
# good: [fdf756f7127185eeffe00e918e66dfee797f3625] sched: Fix more TASK_state comparisons
git bisect good fdf756f7127185eeffe00e918e66dfee797f3625

# first bad commit: [30c999937f69abf935b0228b8411713737377d9e] Merge tag 'sched-core-2022-10-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
#24 lore raw
In reply to Guenter Roeck
Quoted 16 lines · Guenter Roeck
Quoted 15 lines · Michael Ellerman
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Jason A. Donenfeld

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

I managed to bisect the problem. See below for results. Reverting the offending patch fixes the problem for me.

Thanks.

Quoted 7 lines
Quoted 2 lines

This is probably down to me/us not testing with PREEMPT enabled enough.

Not sure. My configuration has

CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set

Thanks very much for helping with this. The config snippet you posted here
https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-October/249758.html
has CONFIG_PREEMPT=y. How do you turn that into a .config, olddefconfig?

I can't reproduce this so far using your config and qemu command line, but the patch you've bisected it to definitely could cause this. I'll keep trying...

Thanks,
Nick

[...]

Quoted 1 line
Quoted 1 line
Quoted 1 line
# first bad commit: [e485f6c751e0a969327336c635ca602feea117f0] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
#29 lore raw
In reply to Guenter Roeck
Quoted 74 lines · Guenter Roeck
Quoted 64 lines · Jason A. Donenfeld
Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Jason A. Donenfeld
Quoted 12 lines · Guenter Roeck

NIP [c000000000031630] .replay_soft_interrupts+0x60/0x300 LR [c000000000031964] .arch_local_irq_restore+0x94/0x1c0

Call Trace:
[c000000007df3870] [c000000000031964] .arch_local_irq_restore+0x94/0x1c0 (unreliable)
[c000000007df38f0] [c000000000f8a444] .__schedule+0x664/0xa50
[c000000007df39d0] [c000000000f8a8b0] .schedule+0x80/0x140
[c000000007df3a50] [c00000000092f0dc] .try_to_generate_entropy+0x118/0x174
[c000000007df3b40] [c00000000092e2e4] .urandom_read_iter+0x74/0x140
[c000000007df3bc0] [c0000000003b0044] .vfs_read+0x284/0x2d0
[c000000007df3cd0] [c0000000003b0d2c] .ksys_read+0xdc/0x130
[c000000007df3d80] [c00000000002a88c] .system_call_exception+0x19c/0x330
[c000000007df3e10] [c00000000000c1d4] system_call_common+0xf4/0x258

Obviously the first couple lines of this concern me a bit. But I think actually this might just be a catalyst for another bug. You could view that function as basically just:

     while (something)
     	schedule();
Quoted 8 lines
Quoted 6 lines

And I guess in the process of calling the scheduler a lot, which toggles interrupts a lot, something got wedged.

Curious, though, I did try to reproduce this, to no avail. My .config is
https://xn--4db.cc/rBvHWfDZ . What's yours?

Attached. My qemu command line is

Okay, thanks, I reproduced it. In this case, I suspect try_to_generate_entropy() is just the messenger. There's an earlier problem:

BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
caller is .__flush_tlb_pending+0x40/0xf0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.0.0-28380-gde492c83cae0-dirty #4
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
Call Trace:
[c0000000044c3540] [c000000000f93ef0] .dump_stack_lvl+0x7c/0xc4 (unreliable)
[c0000000044c35d0] [c000000000fc9550] .check_preemption_disabled+0x140/0x150
[c0000000044c3660] [c000000000073dd0] .__flush_tlb_pending+0x40/0xf0
[c0000000044c36f0] [c000000000334434] .__apply_to_page_range+0x764/0xa30
[c0000000044c3840] [c00000000006cad0] .change_memory_attr+0xf0/0x160
[c0000000044c38d0] [c0000000002a1d70] .bpf_prog_select_runtime+0x150/0x230
[c0000000044c3970] [c000000000d405d4] .bpf_prepare_filter+0x504/0x6f0
[c0000000044c3a30] [c000000000d4085c] .bpf_prog_create+0x9c/0x140
[c0000000044c3ac0] [c000000002051d9c] .ptp_classifier_init+0x44/0x78
[c0000000044c3b50] [c000000002050f3c] .sock_init+0xe0/0x100
[c0000000044c3bd0] [c000000000010bd4] .do_one_initcall+0xa4/0x438
[c0000000044c3cc0] [c000000002005008] .kernel_init_freeable+0x378/0x428
[c0000000044c3da0] [c0000000000113d8] .kernel_init+0x28/0x1a0
[c0000000044c3e10] [c00000000000ca3c] .ret_from_kernel_thread+0x58/0x60

This in turn is because __flush_tlb_pending() calls:

static inline int mm_is_thread_local(struct mm_struct *mm)

{
         return cpumask_equal(mm_cpumask(mm),
                               cpumask_of(smp_processor_id()));
}
Quoted 8 lines

__flush_tlb_pending() has a comment about this:

* Must be called from within some kind of spinlock/non-preempt region... */
void __flush_tlb_pending(struct ppc64_tlb_batch *batch)

So I guess that didn't happen for some reason? Maybe this is indicative of some lock imbalance that then gets hit later?

Quoted 6 lines

I managed to bisect that problem. Unfortunately it points to the scheduler merge. No idea what to do about that. Any idea ? I am copying Peter and Ingo for comments.

# first bad commit: [30c999937f69abf935b0228b8411713737377d9e] Merge tag 'sched-core-2022-10-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

This might be a red herring because I can reproduce without it. I think we can fix this with some preempt critical sections, they don't look too much of a problem.

I don't know why it's not showing up earlier than this release, I'll look into it a bit more.

Thanks,
Nick

#20 lore raw
In reply to Jason A. Donenfeld
Quoted 26 lines · Jason A. Donenfeld
Quoted 9 lines · Guenter Roeck
Quoted 6 lines

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

That probably explains why my attempts to bisect the problem were unsuccessful.

So I just did this:

drivers/char/random.c +1 -0
index 2fe28eeb2f38..2d70bc09db7e 100644
@@ -1212,6 +1212,7 @@ static void __cold try_to_generate_entropy(void)
        struct entropy_timer_state stack;
        unsigned int i, num_different = 0;
        unsigned long last = random_get_entropy();
+       return;
 
        for (i = 0; i < NUM_TRIAL_SAMPLES - 1; ++i) {
                stack.entropy = random_get_entropy();
Quoted 1 line

And then ran it, and now we get the lockup from the idle process:

Yep that rules out the random code. And really if it was calling schedule() it shouldn't be getting a softlockup anyway.

Thanks,
Nick

#25 lore raw
In reply to Nicholas Piggin
Quoted 25 lines · Nicholas Piggin
Quoted 16 lines · Guenter Roeck
Quoted 15 lines · Michael Ellerman
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Jason A. Donenfeld

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

I managed to bisect the problem. See below for results. Reverting the offending patch fixes the problem for me.

Thanks.

Quoted 7 lines
Quoted 2 lines

This is probably down to me/us not testing with PREEMPT enabled enough.

Not sure. My configuration has

CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set

Quoted 7 lines

Thanks very much for helping with this. The config snippet you posted here
https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-October/249758.html
has CONFIG_PREEMPT=y. How do you turn that into a .config, olddefconfig?

I can't reproduce this so far using your config and qemu command line, but the patch you've bisected it to definitely could cause this. I'll keep trying...

Voila https://xn--4db.cc/dt00j0mt this repros it for me.

Quoted 7 lines

Thanks,
Nick

[...]

Quoted 1 line
Quoted 1 line
Quoted 1 line
# first bad commit: [e485f6c751e0a969327336c635ca602feea117f0] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
#26 lore raw
In reply to Nicholas Piggin
Quoted 25 lines · Nicholas Piggin
Quoted 16 lines · Guenter Roeck
Quoted 15 lines · Michael Ellerman
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Jason A. Donenfeld

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

I managed to bisect the problem. See below for results. Reverting the offending patch fixes the problem for me.

Thanks.

Quoted 7 lines
Quoted 2 lines

This is probably down to me/us not testing with PREEMPT enabled enough.

Not sure. My configuration has

CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set

Quoted 8 lines

Thanks very much for helping with this. The config snippet you posted here
https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-October/249758.html
has CONFIG_PREEMPT=y. How do you turn that into a .config, olddefconfig?

I can't reproduce this so far using your config and qemu command line, but the patch you've bisected it to definitely could cause this. I'll keep trying...

Uuh, sorry, I think I got confused with running multiple bisects on the same branch, and took the above from a different bisect run. You are correct, PREEMPT is enabled in the configuration.

Timing is definitely involved; I see the problem more often on a loaded system. To bisect it, I had to repeat the test for each bisect step several times (I set the limit to 20 retries; that gave me reliable results).

Guenter

#27 lore raw
In reply to Guenter Roeck
Quoted 16 lines · Guenter Roeck
Quoted 15 lines · Michael Ellerman
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Jason A. Donenfeld

I've also managed to not hit this bug a few times. When it triggers, after "kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.", there's a long hang - tens seconds before it continues. When it doesn't trigger, there's no hang at that point in the boot process.

I managed to bisect the problem. See below for results. Reverting the offending patch fixes the problem for me.

Thanks.

Quoted 7 lines
Quoted 2 lines

This is probably down to me/us not testing with PREEMPT enabled enough.

Not sure. My configuration has

CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set

Okay I reproduced it, just takes a while to hit.

Thanks,
Nick

#30 lore raw
In reply to Nicholas Piggin
Quoted 43 lines · Nicholas Piggin
Quoted 42 lines
Quoted 29 lines
BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
caller is .__flush_tlb_pending+0x40/0xf0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.0.0-28380-gde492c83cae0-dirty #4
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
Call Trace:
[c0000000044c3540] [c000000000f93ef0] .dump_stack_lvl+0x7c/0xc4 (unreliable)
[c0000000044c35d0] [c000000000fc9550] .check_preemption_disabled+0x140/0x150
[c0000000044c3660] [c000000000073dd0] .__flush_tlb_pending+0x40/0xf0
[c0000000044c36f0] [c000000000334434] .__apply_to_page_range+0x764/0xa30
[c0000000044c3840] [c00000000006cad0] .change_memory_attr+0xf0/0x160
[c0000000044c38d0] [c0000000002a1d70] .bpf_prog_select_runtime+0x150/0x230
[c0000000044c3970] [c000000000d405d4] .bpf_prepare_filter+0x504/0x6f0
[c0000000044c3a30] [c000000000d4085c] .bpf_prog_create+0x9c/0x140
[c0000000044c3ac0] [c000000002051d9c] .ptp_classifier_init+0x44/0x78
[c0000000044c3b50] [c000000002050f3c] .sock_init+0xe0/0x100
[c0000000044c3bd0] [c000000000010bd4] .do_one_initcall+0xa4/0x438
[c0000000044c3cc0] [c000000002005008] .kernel_init_freeable+0x378/0x428
[c0000000044c3da0] [c0000000000113d8] .kernel_init+0x28/0x1a0
[c0000000044c3e10] [c00000000000ca3c] .ret_from_kernel_thread+0x58/0x60

This in turn is because __flush_tlb_pending() calls:

static inline int mm_is_thread_local(struct mm_struct *mm)

{
         return cpumask_equal(mm_cpumask(mm),
                               cpumask_of(smp_processor_id()));
}
Quoted 8 lines

__flush_tlb_pending() has a comment about this:

* Must be called from within some kind of spinlock/non-preempt region... */
void __flush_tlb_pending(struct ppc64_tlb_batch *batch)

So I guess that didn't happen for some reason? Maybe this is indicative of some lock imbalance that then gets hit later?

I managed to bisect that problem. Unfortunately it points to the scheduler merge. No idea what to do about that. Any idea ? I am copying Peter and Ingo for comments.

Quoted 6 lines
Quoted 1 line
# first bad commit: [30c999937f69abf935b0228b8411713737377d9e] Merge tag 'sched-core-2022-10-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

This might be a red herring because I can reproduce without it. I think we can fix this with some preempt critical sections, they don't look too much of a problem.

Do you refer to the bisect of the BUG: message above, or to the other problem ? I can try to repeat the bisect with some retries if you think that 30c999937f69a isn't responsible for "BUG: using smp_processor_id() in preemptible [00000000] code".

Thanks,
Guenter