linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avri Altman <Avri.Altman@wdc.com>
To: Stanley Chu <stanley.chu@mediatek.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"asutoshd@codeaurora.org" <asutoshd@codeaurora.org>
Cc: "beanhuo@micron.com" <beanhuo@micron.com>,
	"cang@codeaurora.org" <cang@codeaurora.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kuohong.wang@mediatek.com" <kuohong.wang@mediatek.com>,
	"peter.wang@mediatek.com" <peter.wang@mediatek.com>,
	"chun-hung.wu@mediatek.com" <chun-hung.wu@mediatek.com>,
	"andy.teng@mediatek.com" <andy.teng@mediatek.com>,
	"chaotian.jing@mediatek.com" <chaotian.jing@mediatek.com>,
	"cc.chou@mediatek.com" <cc.chou@mediatek.com>
Subject: RE: [PATCH v4] scsi: ufs: Fix imprecise load calculation in devfreq window
Date: Thu, 11 Jun 2020 08:03:35 +0000	[thread overview]
Message-ID: <SN6PR04MB46405CE4B375BA3134D64A99FC800@SN6PR04MB4640.namprd04.prod.outlook.com> (raw)
In-Reply-To: <20200611052109.22700-1-stanley.chu@mediatek.com>


> 
> The UFS load calculation is based on "total_time" and "busy_time" in a
> devfreq window. However, the source of time is different for both
> parameters: "busy_time" is assigned from "jiffies" thus has different
> accuracy from "total_time" which is assigned from ktime_get().
> 
> Besides, the time of window boundary is not exactly the same as
> the starting busy time in this window if UFS is actually busy
> in the beginning of the window. A similar accuracy error may also
> happen for the end of busy time in current window.
> 
> To guarantee the precision of load calculation, we need to
> 
> 1. Align time accuracy of both devfreq_dev_status.total_time and
>    devfreq_dev_status.busy_time. For example, use "ktime_get()"
>    directly.
> 
> 2. Align below timelines,
>    - The beginning time of devfreq windows
>    - The beginning of busy time in a new window
>    - The end of busy time in the current window
> 
> Fixes: a3cd5ec55f6c ("scsi: ufs: add load based scaling of UFS gear")
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

Just a small nit.

> -       stat->total_time = jiffies_to_usecs((long)jiffies -
> -                               (long)scaling->window_start_t);
> +       stat->total_time = ktime_to_us(curr_t) - scaling->window_start_t;
ktime_sub ?

Thanks,
Avri

  reply	other threads:[~2020-06-11  8:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  5:21 [PATCH v4] scsi: ufs: Fix imprecise load calculation in devfreq window Stanley Chu
2020-06-11  8:03 ` Avri Altman [this message]
2020-06-11  9:52   ` Stanley Chu

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=SN6PR04MB46405CE4B375BA3134D64A99FC800@SN6PR04MB4640.namprd04.prod.outlook.com \
    --to=avri.altman@wdc.com \
    --cc=alim.akhtar@samsung.com \
    --cc=andy.teng@mediatek.com \
    --cc=asutoshd@codeaurora.org \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=cc.chou@mediatek.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=chun-hung.wu@mediatek.com \
    --cc=jejb@linux.ibm.com \
    --cc=kuohong.wang@mediatek.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=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;
as well as URLs for NNTP newsgroup(s).