On Wed, May 07, 2014 at 05:12:54PM +1000, Dave Airlie wrote: > On 7 May 2014 15:26, Ben Skeggs <skeggsb@xxxxxxxxx> wrote: > > On Wed, May 7, 2014 at 9:20 AM, Dave Airlie <airlied@xxxxxxxxx> wrote: > >> So now I've been playing with MST I think get the feeling I might need > >> some explicit locking on the AUX channel, I think at the moment the > >> mode_config mutex implicitly defends the aux channel as the only real > >> paths into it are > >> > >> a) from userspace connector probing, > >> b) from HPD irqs, > >> > >> currently both of these on i915 at least take mode config, > >> > >> however with MST I can't use mode_config for this, so I'm wondering if > >> I should be adding some explicit locking in the helpers or make it the > >> drivers problem to lock around helper access? > > Without yet being clear on what you're locking against exactly, my > > vote would be on making this the driver's problem. We (should be, but > > don't yet) need to take locks around AUX access anyway as the pads are > > shared between aux/ddc channels in a lot of cases. > > locking against concurrent access, > > currently if I get a HPD irq that requires reading the DPCD status, > and I get a connector detect from userspace that reads i2c over aux > they would collide, > > at the moment mode config lock seems to stop that in i915 but taking mode config > for the DP HPD irq is very wrong for MST. I think that if concurrent access is all that you're worried about, then having a lock in each driver's drm_dp_aux implementation should work. If we end up doing that for every driver then it probably makes sense to move it into drm_dp_aux directly and handle locking within the helpers. That has the disadvantage that somebody could for some reason decide to call into the driver's ->transfer function directly, in which case that code will have to make sure to do proper locking itself. Depending on what you want to do I guess it would make sense to introduce two levels of locking. For example the DPCD and I2C-over-AUX helpers have retry logic built in, so it might make sense to lock around the loops as well in order for concurrent accesses not to be interleaved with the subsequent retries. If the locking happens within the driver's ->transfer implementation it would still be possible for other DPCD accesses to happen in between retries. I'm not sure if that's actually a problem, but I can imagine that it could mess up the whole retry logic. Thierry
Attachment:
pgpaY94aA7uAD.pgp
Description: PGP signature
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel