Workqueue (Screenplay)¶
Add Workqueue¶
Clearly per-device
device.{h,c}
wq
memberUse
create_workqueue()
,destroy_workqueue()
# ps -efl|grep my_driver
# ps -eo pid,cmd,rtprio,nice
Talk about realtime a bit.
Submit/Defer Work From Atomic Context¶
device.{h,c}
: addstruct work_struct
right next towq
Dummy work function (
printk()
)INIT_WORK()
in device ctorSubmit from atomic
Interrupt
Timer callback
Check if called
# chrt -p 20 <pid>
Cleanup (Why We Did This, After All)¶
Remove
gfp_t
parameter frommy_event_list_add()
Finish¶
Interrupts at high rate (e.g. from a bouncing switch) ⟶ some are dropped
We did this to get rid of the spinlock
⟶ re-introduce mutex