mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: Maramaina Naresh <quic_mnaresh@quicinc.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Peter Wang <peter.wang@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	stanley.chu@mediatek.com
Cc: Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Stanley Jhu <chu.stanley@gmail.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, quic_cang@quicinc.com,
	quic_nguyenb@quicinc.com
Subject: Re: [PATCH V4 1/2] ufs: core: Add CPU latency QoS support for ufs driver
Date: Wed, 13 Dec 2023 11:59:53 +0100	[thread overview]
Message-ID: <ecf4d4f8-8232-44bc-b1a0-c6bd4b579949@collabora.com> (raw)
In-Reply-To: <20231213103642.15320-2-quic_mnaresh@quicinc.com>

Il 13/12/23 11:36, Maramaina Naresh ha scritto:
> Register ufs driver to CPU latency PM QoS framework to improve
> ufs device random io performance.
> 
> PM QoS initialization will insert new QoS request into the CPU
> latency QoS list with the maximum latency PM_QOS_DEFAULT_VALUE
> value.
> 
> UFS driver will vote for performance mode on scale up and power
> save mode for scale down.
> 
> If clock scaling feature is not enabled then voting will be based
> on clock on or off condition.
> 
> Provided sysfs interface to enable/disable PM QoS feature.
> 
> tiotest benchmark tool io performance results on sm8550 platform:
> 
> 1. Without PM QoS support
> 	Type (Speed in)    | Average of 18 iterations
> 	Random Write(IPOS) | 41065.13
> 	Random Read(IPOS)  | 37101.3
> 
> 2. With PM QoS support
> 	Type (Speed in)    | Average of 18 iterations
> 	Random Write(IPOS) | 46784.9
> 	Random Read(IPOS)  | 42943.4
> (Improvement with PM QoS = ~15%).
> 
> Co-developed-by: Nitin Rawat <quic_nitirawa@quicinc.com>
> Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
> Signed-off-by: Naveen Kumar Goud Arepalli <quic_narepall@quicinc.com>
> Signed-off-by: Maramaina Naresh <quic_mnaresh@quicinc.com>
> ---
>   drivers/ufs/core/ufshcd.c | 127 ++++++++++++++++++++++++++++++++++++++
>   include/ufs/ufshcd.h      |   6 ++
>   2 files changed, 133 insertions(+)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index ae9936fc6ffb..7318fa480706 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -1001,6 +1001,20 @@ static bool ufshcd_is_unipro_pa_params_tuning_req(struct ufs_hba *hba)
>   	return ufshcd_get_local_unipro_ver(hba) < UFS_UNIPRO_VER_1_6;
>   }
>   
> +/**
> + * ufshcd_pm_qos_update - update PM QoS request
> + * @hba: per adapter instance
> + * @on: If True, vote for perf PM QoS mode otherwise power save mode
> + */
> +static void ufshcd_pm_qos_update(struct ufs_hba *hba, bool on)
> +{
> +	if (!hba->pm_qos_enabled)
> +		return;
> +
> +	cpu_latency_qos_update_request(&hba->pm_qos_req, on ? 0
> +							: PM_QOS_DEFAULT_VALUE);

This fits in one line.

> +}
> +
>   /**
>    * ufshcd_set_clk_freq - set UFS controller clock frequencies
>    * @hba: per adapter instance
> @@ -1147,8 +1161,11 @@ static int ufshcd_scale_clks(struct ufs_hba *hba, unsigned long freq,
>   					    hba->devfreq->previous_freq);
>   		else
>   			ufshcd_set_clk_freq(hba, !scale_up);
> +		goto out;
>   	}
>   
> +	ufshcd_pm_qos_update(hba, scale_up);
> +
>   out:
>   	trace_ufshcd_profile_clk_scaling(dev_name(hba->dev),
>   			(scale_up ? "up" : "down"),
> @@ -8615,6 +8632,109 @@ static void ufshcd_set_timestamp_attr(struct ufs_hba *hba)
>   	ufshcd_release(hba);
>   }
>   
> +/**
> + * ufshcd_pm_qos_init - initialize PM QoS request
> + * @hba: per adapter instance
> + */
> +static void ufshcd_pm_qos_init(struct ufs_hba *hba)
> +{
> +
> +	if (hba->pm_qos_enabled)
> +		return;
> +
> +	cpu_latency_qos_add_request(&hba->pm_qos_req,
> +					PM_QOS_DEFAULT_VALUE);

same here.

> +
> +	if (cpu_latency_qos_request_active(&hba->pm_qos_req))
> +		hba->pm_qos_enabled = true;
> +}
> +

Apart from that,

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



  reply	other threads:[~2023-12-13 11:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 10:36 [PATCH V4 0/2] " Maramaina Naresh
2023-12-13 10:36 ` [PATCH V4 1/2] ufs: core: " Maramaina Naresh
2023-12-13 10:59   ` AngeloGioacchino Del Regno [this message]
2023-12-13 10:36 ` [PATCH V4 2/2] ufs: ufs-mediatek: Enable CPU latency PM QoS support for MEDIATEK SoC Maramaina Naresh
2023-12-13 10:59   ` AngeloGioacchino Del Regno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecf4d4f8-8232-44bc-b1a0-c6bd4b579949@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=chu.stanley@gmail.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=matthias.bgg@gmail.com \
    --cc=peter.wang@mediatek.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_mnaresh@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=stanley.chu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®