From: Bart Van Assche <bvanassche@acm.org>
To: j-young.choi@samsung.com, ALIM AKHTAR <alim.akhtar@samsung.com>,
"avri.altman@wdc.com" <avri.altman@wdc.com>,
"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"beanhuo@micron.com" <beanhuo@micron.com>,
Daejun Park <daejun7.park@samsung.com>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
"cang@codeaurora.org" <cang@codeaurora.org>,
"asutoshd@codeaurora.org" <asutoshd@codeaurora.org>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scsi: ufs: wb: Add Manual Flush sysfs and cleanup toggle functions
Date: Fri, 22 Apr 2022 10:25:07 -0700 [thread overview]
Message-ID: <f426fa45-7d72-52ad-8557-0027bca84194@acm.org> (raw)
In-Reply-To: <1891546521.01650629881201.JavaMail.epsvc@epcpadp4>
On 4/22/22 05:14, Jinyoung CHOI wrote:
> There is the following quirk to bypass "WB Manual Flush" in Write
> Booster.
>
> - UFSHCD_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL
>
> If this quirk is not set, there is no knob that can controll "WB Manual Flush".
>
> There are three flags that control Write Booster Feature.
> 1. WB ON/OFF
> 2. WB Hibern Flush ON/OFF
> 3. WB Flush ON/OFF
>
> The sysfs that controls the WB was implemented. (1)
>
> In the case of "Hibern Flush", it is always good to turn on.
> Control may not be required. (2)
>
> Finally, "Manual flush" may be determined that it can affect
> performance or power consumption.
> So the sysfs that controls this may be necessary. (3)
>
> In addition, toggle functions for controlling the above flags are cleaned.
Please make all sentences in the patch description start at the left margin.
> diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c
> index 5c405ff7b6ea..6bbb56152708 100644
> --- a/drivers/scsi/ufs/ufs-sysfs.c
> +++ b/drivers/scsi/ufs/ufs-sysfs.c
> @@ -229,7 +229,7 @@ static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr,
> * If the platform supports UFSHCD_CAP_CLK_SCALING, turn WB
> * on/off will be done while clock scaling up/down.
> */
> - dev_warn(dev, "To control WB through wb_on is not allowed!\n");
> + dev_warn(dev, "To control Write Booster is not allowed!\n");
> return -EOPNOTSUPP;
> }
The new error message is grammatically incorrect. Please fix.
> + if (!ufshcd_is_wb_flush_allowed(hba)) {
> + dev_warn(dev, "To control WB Flush is not allowed!\n");
Same issue for the above error message.
> +static DEVICE_ATTR_RW(wb_flush_on);
"wb_flush_enabled" is probably a better name than "wb_flush_on".
Additionally, the "wb_flush_en" is closer to the terminology used in the
UFS specification (fWriteBoosterBufferFlushEn).
> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
> index 4a00c24a3209..6c85f512f82f 100644
> --- a/drivers/scsi/ufs/ufs.h
> +++ b/drivers/scsi/ufs/ufs.h
> @@ -611,7 +611,7 @@ struct ufs_dev_info {
>
> /* UFS WB related flags */
> bool wb_enabled;
> - bool wb_buf_flush_enabled;
> + bool wb_flush_enabled;
> u8 wb_dedicated_lu;
> u8 wb_buffer_type;
Adding a variable with the name "wb_flush_enabled" next to a variable with
the name "wb_buf_flush_enabled" is confusing. Please chose better names and
add comments.
> -static int __ufshcd_wb_toggle(struct ufs_hba *hba, bool set, enum flag_idn idn)
> +static int __ufshcd_wb_toggle(struct ufs_hba *hba, const char *knob,
> + bool set, enum flag_idn idn)
> {
> + int ret;
> u8 index;
> enum query_opcode opcode = set ? UPIU_QUERY_OPCODE_SET_FLAG :
> - UPIU_QUERY_OPCODE_CLEAR_FLAG;
> + UPIU_QUERY_OPCODE_CLEAR_FLAG;
> +
> + if (!ufshcd_is_wb_allowed(hba))
> + return -EPERM;
>
> index = ufshcd_wb_get_query_index(hba);
> - return ufshcd_query_flag_retry(hba, opcode, idn, index, NULL);
> +
> + ret = ufshcd_query_flag_retry(hba, opcode, idn, index, NULL);
> + if (ret) {
> + dev_err(hba->dev, "%s: %s %s failed %d\n",
> + __func__, knob, set ? "enable" : "disable", ret);
> + return ret;
> + }
> +
> + dev_dbg(hba->dev, "%s: %s %s\n",
> + __func__, knob, set ? "enabled" : "disabled");
> +
> + return ret;
> }
Please leave out the dev_dbg() message and move the dev_err() message to
the callers of __ufshcd_wb_toggle() such that the 'knob' argument does not
have to be added to __ufshcd_wb_toggle().
Thanks,
Bart.
next prev parent reply other threads:[~2022-04-22 17:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220422120240epcms2p24bdcb416becf76b417f7c39006aa40f2@epcms2p1>
2022-04-22 12:14 ` Jinyoung CHOI
2022-04-22 13:46 ` Avri Altman
2022-04-23 14:24 ` jin young choi
2022-04-23 21:38 ` Bart Van Assche
2022-04-25 10:59 ` Jinyoung Choi
2022-04-22 17:25 ` Bart Van Assche [this message]
2022-04-23 18:40 ` jin young choi
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=f426fa45-7d72-52ad-8557-0027bca84194@acm.org \
--to=bvanassche@acm.org \
--cc=adrian.hunter@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=asutoshd@codeaurora.org \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=cang@codeaurora.org \
--cc=daejun7.park@samsung.com \
--cc=j-young.choi@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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®