Subject: Re: [PATCH] powerpc/book3s64/hash: Add cond_resched to avoid soft lockup warning

From: Michael Ellerman <[email-masked]>
Date: Thu, 14 Nov 2019 20:07:48 +1100 (AEDT)

On Tue, 2019-10-01 at 08:46:56 UTC, "Aneesh Kumar K.V" wrote:
> With large memory (8TB and more) hotplug, we can get soft lockup warnings
> as below. These were caused by a long loop without any explicit cond_resched
> which is a problem for !PREEMPT kernels.
> 
> Avoid the using cond_resched() while inserting hash page table entries. We
> already do similar cond_resched() in __add_pages() (
> commit: f64ac5e6e306 ("mm, memory_hotplug: add scheduling point to __add_pages"))
> 
>  rcu:     3-....: (24002 ticks this GP) idle=13e/1/0x4000000000000002 softirq=722/722 fqs=12001
>   (t=24003 jiffies g=4285 q=2002)
>  NMI backtrace for cpu 3
>  CPU: 3 PID: 3870 Comm: ndctl Not tainted 5.3.0-197.18-default+ #2
>  Call Trace:
>  [c0000000692b3040] [c000000000f759fc] dump_stack+0xb0/0xf4 (unreliable)
>  [c0000000692b3080] [c000000000f80ee4] nmi_cpu_backtrace+0x124/0x130
>  [c0000000692b3100] [c000000000f8109c] nmi_trigger_cpumask_backtrace+0x1ac/0x1f0
>  [c0000000692b31a0] [c00000000006c2f8] arch_trigger_cpumask_backtrace+0x28/0x3c
>  [c0000000692b31c0] [c0000000001eb1e4] rcu_dump_cpu_stacks+0xf8/0x154
>  [c0000000692b3210] [c0000000001e9e88] rcu_sched_clock_irq+0x878/0xb40
>  [c0000000692b32f0] [c0000000001fe878] update_process_times+0x48/0x90
>  [c0000000692b3320] [c000000000217a6c] tick_sched_handle.isra.16+0x4c/0x80
>  [c0000000692b3340] [c000000000217f08] tick_sched_timer+0x68/0xe0
>  [c0000000692b3380] [c0000000001ffee0] __hrtimer_run_queues+0x180/0x430
>  [c0000000692b3400] [c000000000200bd0] hrtimer_interrupt+0x110/0x300
>  [c0000000692b34b0] [c00000000002c128] timer_interrupt+0x108/0x2f0
>  [c0000000692b3510] [c000000000009194] decrementer_common+0x114/0x120
>  --- interrupt: 901 at arch_add_memory+0xc0/0x130
>      LR = arch_add_memory+0x74/0x130
>  [c0000000692b38b0] [c0000000004646b4] memremap_pages+0x494/0x650
>  [c0000000692b3960] [c0000000004648ac] devm_memremap_pages+0x3c/0xa0
>  [c0000000692b39a0] [c000000000b3f4e8] pmem_attach_disk+0x188/0x750
>  [c0000000692b3aa0] [c000000000b2506c] nvdimm_bus_probe+0xac/0x2c0
>  [c0000000692b3b30] [c000000000aeb218] really_probe+0x148/0x570
>  [c0000000692b3bc0] [c000000000aeba1c] driver_probe_device+0x19c/0x1d0
>  [c0000000692b3c40] [c000000000aebe5c] device_driver_attach+0xcc/0x100
>  [c0000000692b3c80] [c000000000ae8a14] bind_store+0x134/0x1c0
>  [c0000000692b3cd0] [c000000000ae7824] drv_attr_store+0x44/0x60
>  [c0000000692b3cf0] [c00000000055e3f4] sysfs_kf_write+0x64/0x90
>  [c0000000692b3d10] [c00000000055d8f0] kernfs_fop_write+0x1a0/0x270
>  [c0000000692b3d60] [c0000000004698ec] __vfs_write+0x3c/0x70
>  [c0000000692b3d80] [c00000000046d260] vfs_write+0xd0/0x260
>  [c0000000692b3dd0] [c00000000046d6ac] ksys_write+0xdc/0x130
>  [c0000000692b3e20] [c00000000000b278] system_call+0x5c/0x68
> 
> Signed-off-by: Aneesh Kumar K.V <[email-masked]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/16f6b67cf03cb43db7104acb2ca877bdc2606c92

cheers