On Wed, Jun 01, 2022 at 06:59:09AM -0700, Davidlohr Bueso wrote: > On Tue, 31 May 2022, Ira Weiny wrote: > > Thinking about it I don't see a benefit to a rwlock. We don't have multiple > > readers. > > ... but you have concurrent workqueues reading the value of cur_task. No, concurrent workqueues are reading the value of different DOE mailboxes' cur_task. Each mailbox has it's own lock for its current task. This is a multiple writers to a single reader pattern. The lock serializes driver requests (possibly from different threads) into the single mailbox as well as signaling when the cur_task is done; retire_cur_task(). At the same time multiple mailboxes can be running parallel. I don't think taking the lock in doe_statemachine_work() is technically necessary. But I left it there for completeness because if the queue depth is increased like it was in Jonathans original code the locking around cur_task will need to be adjusted in this area. Ira > > Thanks, > Davidlohr