Skip to content

usb: typec: ucsi: Fix various locking issues

Hans de Goede linux-usb stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4usb: typec: ucsi: Fix AB BA lock inversiondrivers/usb/typec/ucsi/ucsi.c+9 -92 replies
2/4usb: typec: ucsi: Fix 2 unlocked ucsi_run_command callsdrivers/usb/typec/ucsi/ucsi.c+4 -23 replies
3/4usb: typec: ucsi: Rework ppm_lock handlingdrivers/usb/typec/ucsi/ucsi.c+22 -343 replies
4/4usb: typec: ucsi: Hold con->lock for the entire duration of ucsi_register_port()drivers/usb/typec/ucsi/displayport.c drivers/usb/typec/ucsi/ucsi.c+23 -173 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchHeikki KrogerusGuenter Roeck
SeriesA-b R-b
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] usb: typec: ucsi: Fix various locking issues

Hi Heikki, et al.,

As discussed before here is my fix for the AB BA lock inversion issue which lockdep found in the ucsi code.

While working on the AB BA fix I added a WARN_ON(!mutex_is_locked(&ucsi->ppm_lock)) to ucsi_run_command() and that found me some more unrelated issues of ucsi_run_command() getting called without the ppm_lock held. This is fixed in the second patch. This made me realize that the ppm_lock handling should probably just be pushed down to inside ucsi_run_command() instead of letting the callers worry about this.

In essence the first 3 patches are all related and all boil down to push the ppm_lock handling down into ucsi_run_command(), removing the difference between ucsi_run_command() and ucsi_send_command(). I have been thinking that we may want to just squash these 3 together. I've left them as separate patches now as thet document how I go to the end result after the 3th patch and having them separate might be easier for reviewing purposes. Let me know if you want a v2 of this patchset with them squashed into a single "usb: typec: ucsi: Rework ppm_lock handling" commit (with the commit messages merged).

The 4th patch makes the also already discussed change of holding con->lock for the entire duration of ucsi_register_port().

Regards,

Hans