Workqueue (Screenplay)

Add Workqueue

  • Clearly per-device

  • device.{h,c}

    • wq member

    • Use 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}: add struct work_struct right next to wq

  • Dummy work function (printk())

  • INIT_WORK() in device ctor

  • Submit from atomic

    • Interrupt

    • Timer callback

  • Check if called

# chrt -p 20 <pid>

Cleanup (Why We Did This, After All)

  • Remove gfp_t parameter from my_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