>> dpcm_be_disconnect already uses a spin_lock around >> >> list_del(&dpcm->list_be); >> list_del(&dpcm->list_fe); >> >> and in some other places, are you suggesting we change those to the FE lock? > > Basically yes. > >> Otherwise, I understood your proposal as using three locks (existing >> spinlock, FE lock, BE lock) to deal with DPCM. If the existing spinlock >> and FE lock are combined, we'd still have two locks. > > Stream locks are more fine-grained, hence more efficient :) > The card-level spinlock is superfluous and it can go away. > >> I was suggesting we use only one ;-) > > Basically we need to protect two things: > - The BE links > - The concurrent accesses to BEs > The former belongs to each FE that holds the links, and the FE stream > lock would cover. The latter is rather a per-BE business. > > An oft-seen risk of multiple locks is deadlocking, but in this case, > as long as we keep the lock order FE->BE, nothing wrong can happen. famous last words "nothing wrong can happen." :-) I already added a helper to do this FE lock, I can easily replace the implementation to remove the spin_lock and use the FE PCM lock. we might even add the lock in the definition of for_each_dpcm_be() to avoid misses. Let me try this out today, thanks for the suggestions.