From: Bart Van Assche <bvanassche@acm.org>
To: Avri Altman <avri.altman@wdc.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] scsi: ufs: core: Introduce a new clock_gating lock
Date: Tue, 29 Oct 2024 11:11:12 -0700 [thread overview]
Message-ID: <611fc99e-c947-463a-82e1-9d2a68d67aa4@acm.org> (raw)
In-Reply-To: <20241029102938.685835-2-avri.altman@wdc.com>
On 10/29/24 3:29 AM, Avri Altman wrote:
> + scoped_guard(spinlock_irqsave, &hba->clk_gating.lock) {
> + /*
> + * In case you are here to cancel this work the gating state
> + * would be marked as REQ_CLKS_ON. In this case save time by
> + * skipping the gating work and exit after changing the clock
> + * state to CLKS_ON.
> + */
> + if (hba->clk_gating.is_suspended || (hba->clk_gating.state != REQ_CLKS_OFF)) {
> + hba->clk_gating.state = CLKS_ON;
> + trace_ufshcd_clk_gating(dev_name(hba->dev), hba->clk_gating.state);
> + return;
> + }
> + if (ufshcd_is_ufs_dev_busy(hba) || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL)
> + return;
> }
Please remove the superfluous parentheses from around the REQ_CLKS_OFF
test and do not exceed the 80 column limit. git clang-format HEAD^ can
help with restricting code to the 80 column limit.
> @@ -2072,18 +2055,18 @@ static ssize_t ufshcd_clkgate_enable_store(struct device *dev,
>
> value = !!value;
>
> - spin_lock_irqsave(hba->host->host_lock, flags);
> - if (value == hba->clk_gating.is_enabled)
> - goto out;
> + scoped_guard(spinlock_irqsave, &hba->clk_gating.lock) {
> + if (value == hba->clk_gating.is_enabled)
> + goto out;
>
> - if (value)
> - __ufshcd_release(hba);
> - else
> - hba->clk_gating.active_reqs++;
> + if (value)
> + __ufshcd_release(hba);
> + else
> + hba->clk_gating.active_reqs++;
>
> - hba->clk_gating.is_enabled = value;
> + hba->clk_gating.is_enabled = value;
> + }
> out:
> - spin_unlock_irqrestore(hba->host->host_lock, flags);
> return count;
> }
Please use guard() instead of scoped_guard() and remove the "out:"
label.
> @@ -9173,11 +9157,10 @@ static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on)
> clk_disable_unprepare(clki->clk);
> }
> } else if (!ret && on) {
> - spin_lock_irqsave(hba->host->host_lock, flags);
> - hba->clk_gating.state = CLKS_ON;
> + scoped_guard(spinlock_irqsave, &hba->clk_gating.lock)
> + hba->clk_gating.state = CLKS_ON;
> trace_ufshcd_clk_gating(dev_name(hba->dev),
> hba->clk_gating.state);
> - spin_unlock_irqrestore(hba->host->host_lock, flags);
> }
The above change moves the trace_ufshcd_clk_gating() call from inside
the region protected by the host lock to outside the region protected
by clk_gating.lock. If this is intentional, shouldn't this be mentioned
in the patch description?
Thanks,
Bart.
next prev parent reply other threads:[~2024-10-29 18:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 10:29 [PATCH v2 0/2] Untie the host lock entanglement - part 2 Avri Altman
2024-10-29 10:29 ` [PATCH v2 1/2] scsi: ufs: core: Introduce a new clock_gating lock Avri Altman
2024-10-29 18:11 ` Bart Van Assche [this message]
2024-10-29 18:39 ` Avri Altman
2024-10-29 19:12 ` Bart Van Assche
2024-10-29 21:33 ` Avri Altman
2024-10-29 19:20 ` Bart Van Assche
2024-10-29 21:32 ` Avri Altman
2024-10-29 10:29 ` [PATCH v2 2/2] scsi: ufs: core: Introduce a new clock_scaling lock Avri Altman
2024-10-29 19:19 ` Bart Van Assche
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=611fc99e-c947-463a-82e1-9d2a68d67aa4@acm.org \
--to=bvanassche@acm.org \
--cc=avri.altman@wdc.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®