mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bean Huo <huobean@gmail.com>
To: Avri Altman <avri.altman@wdc.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	beanhuo@micron.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH v3 1/2] scsi: ufs: core: Introduce a new clock_gating lock
Date: Tue, 12 Nov 2024 00:16:58 +0100	[thread overview]
Message-ID: <2d9aa1f9ed2e63d29dc2a7745fdd4f6db45d8db0.camel@gmail.com> (raw)
In-Reply-To: <20241105112502.710427-2-avri.altman@wdc.com>

On Tue, 2024-11-05 at 13:25 +0200, Avri Altman wrote:
> -       spin_lock_irqsave(hba->host->host_lock, flags);
> -       /*
> -        * 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);
> -               goto rel_lock;
> +       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;
>         }

I'm wondering if it would be safe to replace host_lock with gating.lock
or scaling.lock. For instance, in above context, ufshcd_state needs to
be checked, but it's currently serialized by host_lock.

King regards,
Bean

  parent reply	other threads:[~2024-11-11 23:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 11:25 [PATCH v3 0/2] Untie the host lock entanglement - part 2 Avri Altman
2024-11-05 11:25 ` [PATCH v3 1/2] scsi: ufs: core: Introduce a new clock_gating lock Avri Altman
2024-11-09  6:05   ` Avri Altman
2024-11-11 23:16   ` Bean Huo [this message]
2024-11-18  7:00     ` Avri Altman
2024-11-05 11:25 ` [PATCH v3 2/2] scsi: ufs: core: Introduce a new clock_scaling lock Avri Altman

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=2d9aa1f9ed2e63d29dc2a7745fdd4f6db45d8db0.camel@gmail.com \
    --to=huobean@gmail.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --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®