Stress-ng cause kernel crash

Hi
I’ve booted HiFive Unleashed with Debian OS, and now I’m trying to run stress-ng to test the CPU performance, but the kernel will crash when I run stress-ng. I’m not sure if it’s caused by CPU itself or the kernel, the software(stress-ng). Can anyone give me some suggestions to solve it?
PS: I tried “swapoff -a”, but it’s helpless.

root@HiFiveU:~# stress-ng --cpu 4 -t 1
stress-ng: info: [532] dispatching hogs: 4 cpu
stress-ng: info: [532] cache allocate: using built-in defaults as no suitable cache found
stress-ng: info:[ 1535.610000] swap_info_get: Bad swap file entry 2000000001335079
[ 1535.620000] BUG: Bad page map in process stress-ng pte:99a83cc0 pmd:9d1e3c01
[ 1535.630000] addr:000000004c1f2abe vm_flags:000000f8 anon_vma: (null) mapping:000000009c7f3d4c index:21b
[ 1535.640000] file:dev/zero fault:shmem_fault mmap:shmem_mmap readpage: (null)
[ 1535.640000] CPU: 0 PID: 532 Comm: stress-ng Tainted: G B 4.19.0-sifive-1+ #1
[ 1535.640000] Call Trace:
[ 1535.640000] [] walk_stackframe+0x0/0xa0
[ 1535.640000] [] show_stack+0x2a/0x34
[ 1535.640000] [] dump_stack+0x62/0x7c
[ 1535.640000] [] print_bad_pte+0x14a/0x18e
[ 1535.640000] [] unmap_page_range+0x312/0x5ca
[ 1535.640000] [] unmap_single_vma+0x2e/0x40
[ 1535.640000] [] unmap_vmas+0x2a/0x46
[ 1535.640000] [] unmap_region+0x74/0xb8
[ 1535.640000] [] do_munmap+0xfc/0x258
[ 1535.640000] [] vm_munmap+0x42/0x60
[ 1535.640000] [] sys_munmap+0xc/0x14
[ 1535.640000] [] ret_from_syscall+0x0/0xe
[532] successful run completed in 2.65s
[ 1535.730000] BUG: Bad page cache in process stress-ng pfn:266a0f
[ 1535.730000] page:ffffffe1ff873348 count:3 mapcount:1 mapping:ffffffe1f435a630 index:0x21b
[ 1535.730000] flags: 0x4000000000040029(locked|uptodate|lru|swapbacked)
[ 1535.730000] raw: 4000000000040029 ffffffe1ff873270 ffffffe00096d188 ffffffe1f435a630
[ 1535.730000] raw: 000000000000021b 0000000000000000 0000000300000000
[ 1535.730000] page dumped because: still mapped when deleted
[ 1535.730000] CPU: 0 PID: 532 Comm: stress-ng Tainted: G B 4.19.0-sifive-1+ #1
[ 1535.730000] Call Trace:
[ 1535.730000] [] walk_stackframe+0x0/0xa0
[ 1535.730000] [] show_stack+0x2a/0x34
[ 1535.730000] [] dump_stack+0x62/0x7c
[ 1535.730000] [] unaccount_page_cache_page+0x150/0x1ae
[ 1535.730000] [] _delete_from_page_cache+0x22/0xaa
[ 1535.730000] [] delete_from_page_cache+0x44/0x6a
[ 1535.730000] [] truncate_inode_page+0x1c/0x2c
[ 1535.730000] [] shmem_undo_range+0x1fe/0x4e4
[ 1535.730000] [] shmem_truncate_range+0x12/0x2a
[ 1535.730000] [] shmem_evict_inode+0x8c/0x14c
[ 1535.730000] [] +0x7a/0x118
[ 1535.730000] [] +0xb2/0x150
[ 1535.730000] [] +0x82/0xa6
[ 1535.730000] [] +0x92/0x140
[ 1535.730000] [] trstrstr+0x44/0x168
[ 1535.730000] [] +0x10a/0x126
[ 1535.730000] [] +0xc/0x14
[ 1535.730000] [] +0xa6/0x154
[ 1535.730000] [] trstrstrad
+0xc/0x14
[ 1535.730000] [] task_work_run+0x86/0xa8
[ 1535.730000] [] do_notify_resume+0x3c/0x3e
[ 1535.730000] [] ret_from_exception+0x0/0xc
[ 1535.900000] BUG: Bad rss-counter state mm:000000005723578a idx:2 val:-1
[ 1535.910000] BUG: Bad rss-counter state mm:000000005723578a idx:3 val:1


root@HiFiveU:~# dmesg | head
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 4.19.0-sifive-1+ (rrcao@rrcao-Lubuntu) (gcc version 8.3.0 (Buildroot 2019.02-07449-g4eddd28)) #1 SMP Wed Jul 3 02:42:52 CST 2019
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000ffffffff]
[ 0.000000] Normal [mem 0x0000000100000000-0x000027ffffffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x000000027fffffff]

I’ve run “memtester”, it seems the dram is stable enough.

By the way, what’s the dram clock the system is running on, 1.2GHz? And is there any tool which can be used to measure the dram bandwidth?

Please create an issue on the freedom-u-sdk github.

You can also try the dev/new-dts branch which has a 5.2 kernel and if you can reproduce the problem there we can probably get it fixed pretty quickly. Otherwise there is some patch that needs to be backported from 5.2 to 4.19

Works fine on my Unleashed running Atish’s 5.2 tree (https://github.com/atishp04/linux/tree/5.2-rc1_unleashed):

➜ stress-ng --cpu 4 -t 1
stress-ng: info: [17885] dispatching hogs: 4 cpu
stress-ng: info: [17885] successful run completed in 1.33s

carlosedp in ~ at fedora-unleashed
➜ uname -a
Linux fedora-unleashed 5.2.0-rc1-27958-g1cae94e-dirty #6 SMP Mon Jun 24 18:41:56 -03 2019 riscv64 riscv64 riscv64 GNU/Linux

Thanks, I will try 5.2, too.