[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2b56041-b418-4ca9-a84a-ac662a850207@acm.org>
Date: Tue, 14 Oct 2025 09:18:50 -0700
From: Bart Van Assche <bvanassche@....org>
To: palash.kambar@....qualcomm.com, mani@...nel.org, alim.akhtar@...sung.com,
avri.altman@....com, peter.griffin@...aro.org, krzk@...nel.org,
peter.wang@...iatek.com, beanhuo@...ron.com, quic_nguyenb@...cinc.com,
adrian.hunter@...el.com, ebiggers@...nel.org, neil.armstrong@...aro.org,
James.Bottomley@...senPartnership.com, martin.petersen@...cle.com
Cc: linux-arm-msm@...r.kernel.org, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org, quic_cang@...cinc.com,
quic_nitirawa@...cinc.com
Subject: Re: [PATCH V1 2/2] ufs: ufs-qcom: Disable AHIT before SQ tail update
to prevent race in MCQ mode
On 10/13/25 11:04 PM, palash.kambar@....qualcomm.com wrote:
> +static void ufs_qcom_send_command(struct ufs_hba *hba,
> + struct ufshcd_lrb *lrbp)
> +{
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
> + unsigned long flags;
> +
> + if ((host->hw_ver.major == 6 && host->hw_ver.minor == 0 &&
> + host->hw_ver.step == 0) && hba->mcq_enabled) {
> + spin_lock_irqsave(hba->host->host_lock, flags);
> + if ((++host->active_cmds) == 1)
> + /* Stop the auto-hiberate idle timer */
> + ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER);
> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> + }
> +}
Do you realize that obtaining the host lock from the command submission
path introduces a contention point and hence cancels one of the benefits
of MCQ (different CPU cores can submit commands independently)? This
argument still applies if host->active_cmds would be changed into an
atomic counter because making that change would still trigger cache line
ping-pong if UFS commands are submitted from multiple CPU cores
simultaneously. I think this is a strong argument against this patch
series.
An example of how to implement this kind of counter without killing
performance is available in the block layer (&q->q_usage_counter).
However, implementing a per-cpu counter and checking in an efficient
way whether it has reached zero is much more complicated than the
approach of this patch series.
Is AHIT really that valuable that you want to sacrifice MCQ performance
to enable AHIT? Why not to enable/disable AHIT from the RPM callbacks?
Bart.
Powered by blists - more mailing lists