# git rev-parse -q --verify 4d202c8c8ed3822327285747db1765967110b274^{commit} 4d202c8c8ed3822327285747db1765967110b274 already have revision, skipping fetch # git checkout -q -f -B kisskb 4d202c8c8ed3822327285747db1765967110b274 # git clean -qxdf # < git log -1 # commit 4d202c8c8ed3822327285747db1765967110b274 # Author: Gautham R. Shenoy # Date: Wed Jul 17 16:05:24 2019 +0530 # # powerpc/xive: Fix loop exit-condition in xive_find_target_in_mask() # # xive_find_target_in_mask() has the following for(;;) loop which has a # bug when @first == cpumask_first(@mask) and condition 1 fails to hold # for every CPU in @mask. In this case we loop forever in the for-loop. # # first = cpu; # for (;;) { # if (cpu_online(cpu) && xive_try_pick_target(cpu)) // condition 1 # return cpu; # cpu = cpumask_next(cpu, mask); # if (cpu == first) // condition 2 # break; # # if (cpu >= nr_cpu_ids) // condition 3 # cpu = cpumask_first(mask); # } # # This is because, when @first == cpumask_first(@mask), we never hit the # condition 2 (cpu == first) since prior to this check, we would have # executed "cpu = cpumask_next(cpu, mask)" which will set the value of # @cpu to a value greater than @first or to nr_cpus_ids. When this is # coupled with the fact that condition 1 is not met, we will never exit # this loop. # # This was discovered by the hard-lockup detector while running LTP test # concurrently with SMT switch tests. # # watchdog: CPU 12 detected hard LOCKUP on other CPUs 68 # watchdog: CPU 12 TB:85587019220796, last SMP heartbeat TB:85578827223399 (15999ms ago) # watchdog: CPU 68 Hard LOCKUP # watchdog: CPU 68 TB:85587019361273, last heartbeat TB:85576815065016 (19930ms ago) # CPU: 68 PID: 45050 Comm: hxediag Kdump: loaded Not tainted 4.18.0-100.el8.ppc64le #1 # NIP: c0000000006f5578 LR: c000000000cba9ec CTR: 0000000000000000 # REGS: c000201fff3c7d80 TRAP: 0100 Not tainted (4.18.0-100.el8.ppc64le) # MSR: 9000000002883033 CR: 24028424 XER: 00000000 # CFAR: c0000000006f558c IRQMASK: 1 # GPR00: c0000000000afc58 c000201c01c43400 c0000000015ce500 c000201cae26ec18 # GPR04: 0000000000000800 0000000000000540 0000000000000800 00000000000000f8 # GPR08: 0000000000000020 00000000000000a8 0000000080000000 c00800001a1beed8 # GPR12: c0000000000b1410 c000201fff7f4c00 0000000000000000 0000000000000000 # GPR16: 0000000000000000 0000000000000000 0000000000000540 0000000000000001 # GPR20: 0000000000000048 0000000010110000 c00800001a1e3780 c000201cae26ed18 # GPR24: 0000000000000000 c000201cae26ed8c 0000000000000001 c000000001116bc0 # GPR28: c000000001601ee8 c000000001602494 c000201cae26ec18 000000000000001f # NIP [c0000000006f5578] find_next_bit+0x38/0x90 # LR [c000000000cba9ec] cpumask_next+0x2c/0x50 # Call Trace: # [c000201c01c43400] [c000201cae26ec18] 0xc000201cae26ec18 (unreliable) # [c000201c01c43420] [c0000000000afc58] xive_find_target_in_mask+0x1b8/0x240 # [c000201c01c43470] [c0000000000b0228] xive_pick_irq_target.isra.3+0x168/0x1f0 # [c000201c01c435c0] [c0000000000b1470] xive_irq_startup+0x60/0x260 # [c000201c01c43640] [c0000000001d8328] __irq_startup+0x58/0xf0 # [c000201c01c43670] [c0000000001d844c] irq_startup+0x8c/0x1a0 # [c000201c01c436b0] [c0000000001d57b0] __setup_irq+0x9f0/0xa90 # [c000201c01c43760] [c0000000001d5aa0] request_threaded_irq+0x140/0x220 # [c000201c01c437d0] [c00800001a17b3d4] bnx2x_nic_load+0x188c/0x3040 [bnx2x] # [c000201c01c43950] [c00800001a187c44] bnx2x_self_test+0x1fc/0x1f70 [bnx2x] # [c000201c01c43a90] [c000000000adc748] dev_ethtool+0x11d8/0x2cb0 # [c000201c01c43b60] [c000000000b0b61c] dev_ioctl+0x5ac/0xa50 # [c000201c01c43bf0] [c000000000a8d4ec] sock_do_ioctl+0xbc/0x1b0 # [c000201c01c43c60] [c000000000a8dfb8] sock_ioctl+0x258/0x4f0 # [c000201c01c43d20] [c0000000004c9704] do_vfs_ioctl+0xd4/0xa70 # [c000201c01c43de0] [c0000000004ca274] sys_ioctl+0xc4/0x160 # [c000201c01c43e30] [c00000000000b388] system_call+0x5c/0x70 # Instruction dump: # 78aad182 54a806be 3920ffff 78a50664 794a1f24 7d294036 7d43502a 7d295039 # 4182001c 48000034 78a9d182 79291f24 <7d23482a> 2fa90000 409e0020 38a50040 # # To fix this, move the check for condition 2 after the check for # condition 3, so that we are able to break out of the loop soon after # iterating through all the CPUs in the @mask in the problem case. Use # do..while() to achieve this. # # Fixes: 243e25112d06 ("powerpc/xive: Native exploitation of the XIVE interrupt controller") # Cc: stable@vger.kernel.org # v4.12+ # Reported-by: Indira P. Joga # Signed-off-by: Gautham R. Shenoy # Signed-off-by: Michael Ellerman # Link: https://lore.kernel.org/r/1563359724-13931-1-git-send-email-ego@linux.vnet.ibm.com # < /opt/cross/kisskb/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux-gcc --version # < /opt/cross/kisskb/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux-ld --version # < git log --format=%s --max-count=1 4d202c8c8ed3822327285747db1765967110b274 # < make -s -j 48 ARCH=mips O=/kisskb/build/powerpc-fixes_mips-defconfig_mips CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux- defconfig # make -s -j 48 ARCH=mips O=/kisskb/build/powerpc-fixes_mips-defconfig_mips CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux- /kisskb/src/arch/mips/vdso/Makefile:39: MIPS VDSO requires binutils >= 2.25 :1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] /kisskb/src/arch/mips/vdso/Makefile:39: MIPS VDSO requires binutils >= 2.25 /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:194:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/rcu/srcutree.c: In function 'init_srcu_struct_fields': /kisskb/src/kernel/rcu/srcutree.c:140:32: warning: 'levelspread[]' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/rcu/srcutree.c:88:6: note: 'levelspread[]' was declared here /kisskb/src/drivers/base/regmap/regmap.c: In function '_regmap_raw_write': /kisskb/src/drivers/base/regmap/regmap.c:1852:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function 'regmap_raw_read': /kisskb/src/drivers/base/regmap/regmap.c:2591:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/net/bridge/br_netlink.c: In function 'br_afspec.isra.20': /kisskb/src/net/bridge/br_netlink.c:648:7: warning: 'err' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/net/core/devlink.c: In function 'devlink_fmsg_prepare_skb': /kisskb/src/net/core/devlink.c:4443:6: warning: 'err' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c: In function 'univ8250_release_irq': /kisskb/src/drivers/tty/serial/8250/8250_core.c:248:18: warning: 'i' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c:228:19: note: 'i' was declared here /kisskb/src/fs/proc/inode.c: In function 'proc_reg_open': /kisskb/src/include/linux/list.h:65:12: warning: 'pdeo' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c:331:21: note: 'pdeo' was declared here /kisskb/src/drivers/usb/core/devio.c: In function 'async_completed': /kisskb/src/drivers/usb/core/devio.c:613:23: warning: 'errno' may be used uninitialized in this function [-Wuninitialized] :1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] /kisskb/src/arch/mips/vdso/Makefile:39: MIPS VDSO requires binutils >= 2.25 /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:194:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] FIT description: Linux 5.2.0-g4d202c8c8ed3 Created: Fri Jul 19 02:46:44 2019 Image 0 (kernel@0) Description: Linux 5.2.0-g4d202c8c8ed3 Created: Fri Jul 19 02:46:44 2019 Type: Kernel Image Compression: gzip compressed Data Size: 4520569 Bytes = 4414.62 KiB = 4.31 MiB Architecture: MIPS OS: Linux Load Address: 0x80100000 Entry Point: 0x8085f270 Hash algo: sha1 Hash value: 416867fc75c88ec3d994092aeb0547d6c3f222a4 Image 1 (fdt@boston) Description: img,boston Device Tree Created: Fri Jul 19 02:46:44 2019 Type: Flat Device Tree Compression: uncompressed Data Size: 3793 Bytes = 3.70 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 4799f50d688573234da6e9d7701234d394759ef4 Image 2 (fdt@ni169445) Description: NI 169445 device tree Created: Fri Jul 19 02:46:44 2019 Type: Flat Device Tree Compression: uncompressed Data Size: 1871 Bytes = 1.83 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 51b89b31605ee62038c8468c429af091dfc75ec7 Image 3 (fdt@ocelot_pcb123) Description: MSCC Ocelot PCB123 Device Tree Created: Fri Jul 19 02:46:44 2019 Type: Flat Device Tree Compression: uncompressed Data Size: 4615 Bytes = 4.51 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 8754eadee600cac22c9c34884cd901aac7e95e8a Image 4 (fdt@ocelot_pcb120) Description: MSCC Ocelot PCB120 Device Tree Created: Fri Jul 19 02:46:44 2019 Type: Flat Device Tree Compression: uncompressed Data Size: 5174 Bytes = 5.05 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 1ab7d0871c0a9345c6269fb491bf028224da8256 Image 5 (fdt@xilfpga) Description: MIPSfpga (xilfpga) Device Tree Created: Fri Jul 19 02:46:44 2019 Type: Flat Device Tree Compression: uncompressed Data Size: 2708 Bytes = 2.64 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 63d058b780f65e22da30f0a183433765f1807f1d Default Configuration: 'conf@default' Configuration 0 (conf@default) Description: Generic Linux kernel Kernel: kernel@0 Configuration 1 (conf@boston) Description: Boston Linux kernel Kernel: kernel@0 FDT: fdt@boston Configuration 2 (conf@ni169445) Description: NI 169445 Linux Kernel Kernel: kernel@0 FDT: fdt@ni169445 Configuration 3 (conf@ocelot_pcb123) Description: Ocelot Linux kernel Kernel: kernel@0 FDT: fdt@ocelot_pcb123 Configuration 4 (conf@ocelot_pcb120) Description: Ocelot Linux kernel Kernel: kernel@0 FDT: fdt@ocelot_pcb120 Configuration 5 (conf@xilfpga) Description: MIPSfpga Linux kernel Kernel: kernel@0 FDT: fdt@xilfpga Completed OK # rm -rf /kisskb/build/powerpc-fixes_mips-defconfig_mips # Build took: 0:01:22.361741