mbox series

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

Message ID 20241024075033.562562-1-avri.altman@wdc.com
Headers show
Series Untie the host lock entanglement - part 1 | expand

Message

Avri Altman Oct. 24, 2024, 7:50 a.m. UTC
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(-)

Comments

Bart Van Assche Oct. 24, 2024, 10:08 p.m. UTC | #1
On 10/24/24 12:50 AM, Avri Altman wrote:
> There is no need to serialize single read/write calls to the host
> controller registers. Remove the redundant host_lock calls that protect
> access to the task management doorbell register: UTMRLDBR.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Martin K. Petersen Oct. 25, 2024, 7:03 p.m. UTC | #2
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!