# git rev-parse -q --verify 8a96efd384e6d0797a06a34503ebf21f133c74cb^{commit} 8a96efd384e6d0797a06a34503ebf21f133c74cb already have revision, skipping fetch # git checkout -q -f -B kisskb 8a96efd384e6d0797a06a34503ebf21f133c74cb # git clean -qxdf # < git log -1 # commit 8a96efd384e6d0797a06a34503ebf21f133c74cb # Author: Madhavan Srinivasan # Date: Tue Aug 27 15:46:35 2019 +0530 # # powerpc/imc: Dont create debugfs files for cpu-less nodes # # Commit <684d984038aa> ('powerpc/powernv: Add debugfs interface for # imc-mode and imc') added debugfs interface for the nest imc pmu # devices to support changing of different ucode modes. Primarily adding # this capability for debug. But when doing so, the code did not # consider the case of cpu-less nodes. So when reading the _cmd_ or # _mode_ file of a cpu-less node will create this crash. # # Faulting instruction address: 0xc0000000000d0d58 # Oops: Kernel access of bad area, sig: 11 [#1] # ... # CPU: 67 PID: 5301 Comm: cat Not tainted 5.2.0-rc6-next-20190627+ #19 # NIP: c0000000000d0d58 LR: c00000000049aa18 CTR:c0000000000d0d50 # REGS: c00020194548f9e0 TRAP: 0300 Not tainted (5.2.0-rc6-next-20190627+) # MSR: 9000000000009033 CR:28022822 XER: 00000000 # CFAR: c00000000049aa14 DAR: 000000000003fc08 DSISR:40000000 IRQMASK: 0 # ... # NIP imc_mem_get+0x8/0x20 # LR simple_attr_read+0x118/0x170 # Call Trace: # simple_attr_read+0x70/0x170 (unreliable) # debugfs_attr_read+0x6c/0xb0 # __vfs_read+0x3c/0x70 # vfs_read+0xbc/0x1a0 # ksys_read+0x7c/0x140 # system_call+0x5c/0x70 # # Patch fixes the issue with a more robust check for vbase to NULL. # # Before patch, ls output for the debugfs imc directory # # # ls /sys/kernel/debug/powerpc/imc/ # imc_cmd_0 imc_cmd_251 imc_cmd_253 imc_cmd_255 imc_mode_0 imc_mode_251 imc_mode_253 imc_mode_255 # imc_cmd_250 imc_cmd_252 imc_cmd_254 imc_cmd_8 imc_mode_250 imc_mode_252 imc_mode_254 imc_mode_8 # # After patch, ls output for the debugfs imc directory # # # ls /sys/kernel/debug/powerpc/imc/ # imc_cmd_0 imc_cmd_8 imc_mode_0 imc_mode_8 # # Actual bug here is that, we have two loops with potentially different # loop counts. That is, in imc_get_mem_addr_nest(), loop count is # obtained from the dt entries. But in case of export_imc_mode_and_cmd(), # loop was based on for_each_nid() count. Patch fixes the loop count in # latter based on the struct mem_info. Ideally it would be better to # have array size in struct imc_pmu. # # Fixes: 684d984038aa ('powerpc/powernv: Add debugfs interface for imc-mode and imc') # Reported-by: Qian Cai # Suggested-by: Michael Ellerman # Signed-off-by: Madhavan Srinivasan # Signed-off-by: Michael Ellerman # Link: https://lore.kernel.org/r/20190827101635.6942-1-maddy@linux.vnet.ibm.com # < /opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux-gcc --version # < /opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux-ld --version # < git log --format=%s --max-count=1 8a96efd384e6d0797a06a34503ebf21f133c74cb # < make -s -j 120 ARCH=mips O=/kisskb/build/powerpc-next_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- defconfig # make -s -j 120 ARCH=mips O=/kisskb/build/powerpc-next_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- :1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] :1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] FIT description: Linux 5.3.0-rc2-g8a96efd384e6 Created: Wed Sep 4 21:48:22 2019 Image 0 (kernel@0) Description: Linux 5.3.0-rc2-g8a96efd384e6 Created: Wed Sep 4 21:48:22 2019 Type: Kernel Image Compression: gzip compressed Data Size: 4707216 Bytes = 4596.89 KiB = 4.49 MiB Architecture: MIPS OS: Linux Load Address: 0x80100000 Entry Point: 0x808ae3b0 Hash algo: sha1 Hash value: 5028b1ba0747e6daccd797abb0e22f0fab8ee060 Image 1 (fdt@boston) Description: img,boston Device Tree Created: Wed Sep 4 21:48:22 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: Wed Sep 4 21:48:22 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: Wed Sep 4 21:48:22 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: Wed Sep 4 21:48:22 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: Wed Sep 4 21:48:22 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-next_mips-defconfig_mipsel # Build took: 0:01:03.118261