Atomic operations should be employed within rwlock, hence GFP_ATOMIC
is utilized instead of GFP_KERNEL. This ensures the avoidance of the
subsequent call trace and prevents potential misinterpretation of NPU
performance degradation during testing.

BUG: sleeping function called from invalid context at 
include/linux/sched/mm.h:274
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 529, name: python3
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
Preemption disabled at:
[<ffffffc008cbe384>] ethosu_rpmsg_register+0x24/0x64
CPU: 1 PID: 529 Comm: python3 Tainted: G         C         
6.1.90-yocto-standard #1
Hardware name: NXP i.MX93 11X11 EVK board (DT)
Call trace:
 dump_backtrace.part.0+0xc8/0xd4
 show_stack+0x20/0x30
 dump_stack_lvl+0x6c/0x88
 dump_stack+0x18/0x34
 __might_resched+0x154/0x1c0
 __might_sleep+0x54/0xa4
 kmem_cache_alloc+0x458/0x630
 radix_tree_node_alloc.constprop.0+0x54/0x110
 idr_get_free+0x22c/0x2b0
 idr_alloc_u32+0x70/0x100
 idr_alloc_cyclic+0x6c/0xf0
 ethosu_rpmsg_register+0x3c/0x64
 ethosu_inference_create+0xc0/0x2a4
 ethosu_network_ioctl+0xd4/0x2a0
 __arm64_sys_ioctl+0xb4/0x100

Signed-off-by: Xiaolei Wang <xiaolei.w...@windriver.com>
---
 drivers/staging/ethosu/ethosu_rpmsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ethosu/ethosu_rpmsg.c 
b/drivers/staging/ethosu/ethosu_rpmsg.c
index d3e597e82762..f2ab3b366de7 100644
--- a/drivers/staging/ethosu/ethosu_rpmsg.c
+++ b/drivers/staging/ethosu/ethosu_rpmsg.c
@@ -36,7 +36,7 @@ int ethosu_rpmsg_register(struct ethosu_rpmsg *erp,
                          struct ethosu_rpmsg_msg *msg)
 {
        write_lock(&erp->lock);
-       msg->id = idr_alloc_cyclic(&erp->msg_idr, msg, 0, INT_MAX, GFP_KERNEL);
+       msg->id = idr_alloc_cyclic(&erp->msg_idr, msg, 0, INT_MAX, GFP_ATOMIC);
        write_unlock(&erp->lock);
        if (msg->id < 0)
                return msg->id;
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13938): 
https://lists.yoctoproject.org/g/linux-yocto/message/13938
Mute This Topic: https://lists.yoctoproject.org/mt/106112654/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to