octeontx2: nic: Replace get_cpu()/put_cpu() with get_cpu_ptr()/put_cpu_ptr()
After commit 2baa2d5b(octeontx2-pf: disable preemption while using per_cpu pointer) applied, the kmalloc function is called in the atomic context, which leads to the following call trace. It can be solved by using get_cpu_ptr()/put_cpu_ptr() in function __cn10k_aura_freeptr(). BUG: sleeping function called from invalid context at mm/slab.h:513 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0 2 locks held by swapper/0/1: #0: ffff800012629730 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock+0x28/0x34 #1: ffff000110d956c8 (&mbox->lock){+.+.}-{3:3}, at: otx2_init_hw_resources+0xa0/0x350 device: '179:24': device_add Preemption disabled at: [<ffff800010aef7e0>] otx2_sq_aura_pool_init+0x14c/0x310 CPU: 13 PID: 1 Comm: swapper/0 Not tainted 5.10.89-yocto-standard #1 device: 'mmcblk2boot1': device_add Hardware name: Marvell OcteonTX CN96XX board (DT) Call trace: dump_backtrace+0x0/0x1e0 show_stack+0x24/0x30 dump_stack+0xec/0x154 ___might_sleep+0x1a0/0x250 __might_sleep+0x5c/0x94 __kmalloc+0x2f4/0x450 otx2_sq_aura_pool_init+0x1ac/0x310 otx2_init_hw_resources+0x108/0x350 otx2_open+0xf0/0x5f0 __dev_open+0x134/0x200 __dev_change_flags+0x1d8/0x260 dev_change_flags+0x30/0x70 ic_open_devs+0x128/0x320 ip_auto_config+0x184/0x430 do_one_initcall+0x54/0x190 kernel_init_freeable+0x1f0/0x26c kernel_init+0x20/0x12c ret_from_fork+0x10/0x18 Signed-off-by: Ruiqiang Hao <Ruiqiang.Hao@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Please register or sign in to comment