On Wed, 28 Aug 2019 14:39:47 +0200 Cornelia Huck <cohuck@xxxxxxxxxx> wrote: > > > > > > So we do have three states here, right? (I hope we're not talking past > > > each other again...) > > > > Right, AFAIR and without any consideration to fine details the three > > states and two state transitions do make sense. > > If we translate the three states to today's states in the fsm, we get: > - "idle" -> VFIO_CCW_STATE_IDLE > - "doing translation" -> VFIO_CCW_STATE_CP_PROCESSING > - "submitted" -> VFIO_CCW_STATE_CP_PENDING > and the transitions between the three already look fine to me (modulo > locking). We also seem to handle async requests correctly (-EAGAIN if > _PROCESSING, else just go ahead). > > So we can probably forget about the approach in this patch, and > concentrate on eliminating races in state transitions. I agree. > > Not sure what the best approach is for tackling these: intermediate > transit state, a mutex or another lock, running locked and running > stuff that cannot be done locked on workqueues (and wait for all work > to finish while disallowing new work while doing the transition)? > > Clever ideas wanted :) AFAIR Eric has this problem on his TODO list. I think we can resume the in depth discussion over his code :) Regards, Halil