Re: [PATCH 5/6] ufs: Remove superfluous memory barriers

Can Guo
2019-12-25T10:32:04Z

On 2019-12-25 06:02, Bart Van Assche wrote:
> Calling wmb() after having written to a doorbell slows down code and
> does
> not help to commit the doorbell write faster. Hence remove such wmb()
> calls. Note: detailed information about the semantics of writel() is
> available in Documentation/driver-api/device-io.rst.
>
> Cc: Bean Huo <beanhuo@micron.com>
> Cc: Can Guo <cang@codeaurora.org>
> Cc: Avri Altman <avri.altman@wdc.com>
> Cc: Stanley Chu <stanley.chu@mediatek.com>
> Cc: Tomas Winkler <tomas.winkler@intel.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/ufs/ufshcd.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 4d9bb1932b39..edcc137c436b 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1879,8 +1879,6 @@ void ufshcd_send_command(struct ufs_hba *hba,
> unsigned int task_tag)
> ufshcd_clk_scaling_start_busy(hba);
> __set_bit(task_tag, &hba->outstanding_reqs);
> ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL);
> - /* Make sure that doorbell is committed immediately */
> - wmb();
> }
>
> /**
> @@ -5766,8 +5764,6 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba
> *hba,
> wmb();
>
> ufshcd_writel(hba, 1 << free_slot, REG_UTP_TASK_REQ_DOOR_BELL);
> - /* Make sure that doorbell is committed immediately */
> - wmb();
>
> spin_unlock_irqrestore(host->host_lock, flags);

Hi Bart,

Three wmb()s were added in commit ad1a1b9cd because we did see instances
on
which OCS=3(MISMATCH_DATA_BUFFER_SIZE) error were observed in large
scale
test. Commit ad1a1b9cd fixed the error and we had confirmed it through
large amount of tests. I am not sure removing the 2 wmb()s here would
cause
regression or not.

Thanks,

Can Guo.