[PATCH v3 0/3] Untie the host lock entanglement - part 1

Avri Altman posted 3 patches 1 month ago
drivers/ufs/core/ufshcd.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
[PATCH v3 0/3] Untie the host lock entanglement - part 1
Posted by Avri Altman 1 month ago
While trying to simplify the ufs core driver with the guard() macro [1],
Bart made note of the abuse of the scsi host lock in the ufs driver.
Indeed, the host lock is deeply entangled in various flows across the
driver, as if it was some occasional default synchronization mean.

Here is the first part of defusing it, remove some of those calls around
host registers accesses, which needs no protection.

Doing this in phases seems like a reasonable approach, given the myriad
use of the host lock.


Changes compared to v2:
 - leave out changing ufshcd_tmc_handler

Changes compared to v1:
 - get rid of redundant locking (Bart)
 - leave out the HCE register

[1] https://lore.kernel.org/linux-scsi/0b031b8f-c07c-42ef-af93-7336439d3c37@acm.org/

Avri Altman (3):
  scsi: ufs: core: Remove redundant host_lock calls around UTMRLDBR.
  scsi: ufs: core: Remove redundant host_lock calls around UTMRLCLR
  scsi: ufs: core: Remove redundant host_lock calls around UTRLCLR.

 drivers/ufs/core/ufshcd.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

-- 
2.25.1
Re: [PATCH v3 0/3] Untie the host lock entanglement - part 1
Posted by Martin K. Petersen 2 weeks, 6 days ago
On Thu, 24 Oct 2024 10:50:30 +0300, Avri Altman wrote:

> While trying to simplify the ufs core driver with the guard() macro [1],
> Bart made note of the abuse of the scsi host lock in the ufs driver.
> Indeed, the host lock is deeply entangled in various flows across the
> driver, as if it was some occasional default synchronization mean.
> 
> Here is the first part of defusing it, remove some of those calls around
> host registers accesses, which needs no protection.
> 
> [...]

Applied to 6.13/scsi-queue, thanks!

[1/3] scsi: ufs: core: Remove redundant host_lock calls around UTMRLDBR.
      https://git.kernel.org/mkp/scsi/c/2b314e182caa
[2/3] scsi: ufs: core: Remove redundant host_lock calls around UTMRLCLR
      https://git.kernel.org/mkp/scsi/c/5824e18b3db4
[3/3] scsi: ufs: core: Remove redundant host_lock calls around UTRLCLR.
      https://git.kernel.org/mkp/scsi/c/2a330f16ad30

-- 
Martin K. Petersen	Oracle Linux Engineering
Re: [PATCH v3 0/3] Untie the host lock entanglement - part 1
Posted by Martin K. Petersen 1 month ago
Avri,

> While trying to simplify the ufs core driver with the guard() macro
> [1], Bart made note of the abuse of the scsi host lock in the ufs
> driver. Indeed, the host lock is deeply entangled in various flows
> across the driver, as if it was some occasional default
> synchronization mean.
>
> Here is the first part of defusing it, remove some of those calls
> around host registers accesses, which needs no protection.
>
> Doing this in phases seems like a reasonable approach, given the
> myriad use of the host lock.

Applied to 6.13/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering