最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

kernel module - Threads and spin_lock Soft Lockup - Stack Overflow

programmeradmin1浏览0评论

I have a kernel module that is processing packets.

I have one tasklet that is running and will read from a list that has a spin_lock.

There is a workqueue that is also reading from the same list.

After sending lots of data i get

watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [kworker/0:1:14] beginning of dump is this:

Workqueue: events my_work_fn [mymodule]
PC is at _raw_spin_lock+0x3c/0x50
LR is at destFind+0x24/0xcc [mymodule]

The destFind method needs to use the spin_lock. Both workqueue and taskelt call this.

My theory is that the tasklet processing pkt is hogging the spin_lock by calling it all the time. i.e. lock-unlock-lock-unlock, etc...

Could this cause the work fcn to never get to acquire the spin_lock?

part of dump after register dump is this:

Control: 18c5387d Table: 0443c04a DAC: 00000051
_raw_spin_lock from destFind+0x24/0xcc [mymodule]
destFind [mymodule] from initPacket_intasklet+0x520/0x604 [mymodule]
initPacket_intasklet [mymodule] from mymodule_tasklet_handler+0x2c/0x64 [mymodule]

The initPacket is what gets called from tasklet and runs alot when processing packets.

I am on a dual core arm.

I have a kernel module that is processing packets.

I have one tasklet that is running and will read from a list that has a spin_lock.

There is a workqueue that is also reading from the same list.

After sending lots of data i get

watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [kworker/0:1:14] beginning of dump is this:

Workqueue: events my_work_fn [mymodule]
PC is at _raw_spin_lock+0x3c/0x50
LR is at destFind+0x24/0xcc [mymodule]

The destFind method needs to use the spin_lock. Both workqueue and taskelt call this.

My theory is that the tasklet processing pkt is hogging the spin_lock by calling it all the time. i.e. lock-unlock-lock-unlock, etc...

Could this cause the work fcn to never get to acquire the spin_lock?

part of dump after register dump is this:

Control: 18c5387d Table: 0443c04a DAC: 00000051
_raw_spin_lock from destFind+0x24/0xcc [mymodule]
destFind [mymodule] from initPacket_intasklet+0x520/0x604 [mymodule]
initPacket_intasklet [mymodule] from mymodule_tasklet_handler+0x2c/0x64 [mymodule]

The initPacket is what gets called from tasklet and runs alot when processing packets.

I am on a dual core arm.

Share Improve this question edited Jan 17 at 16:43 RookieBeotch asked Jan 17 at 16:33 RookieBeotchRookieBeotch 1031 silver badge7 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

i was able to fix this using read write lock instead of regular spin lock.

since both of the functions are just reading and not writing it makes a lot of sense having the read lock instead.

like usual i learned something after i post it :)

发布评论

评论列表(0)

  1. 暂无评论