lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231208124835.GB15552@thinkpad>
Date:   Fri, 8 Dec 2023 18:18:35 +0530
From:   Manivannan Sadhasivam <mani@...nel.org>
To:     Bean Huo <beanhuo@...pp.de>
Cc:     avri.altman@....com, bvanassche@....org, alim.akhtar@...sung.com,
        jejb@...ux.ibm.com, martin.petersen@...cle.com,
        quic_cang@...cinc.com, quic_asutoshd@...cinc.com,
        beanhuo@...ron.com, thomas@...ch.de, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org, mikebi@...ron.com, lporzio@...ron.com
Subject: Re: [PATCH v4 1/3] scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()

On Fri, Dec 08, 2023 at 11:39:38AM +0100, Bean Huo wrote:
> From: Bean Huo <beanhuo@...ron.com>
> 
> Add helper inline for retrieving whether UFS device is busy or not.
> 
> Signed-off-by: Bean Huo <beanhuo@...ron.com>
> Reviewed-by: Avri Altman <avri.altman@....com>
> ---
>  drivers/ufs/core/ufshcd.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index f0b837cb0c2b..32cfcba66d60 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -235,6 +235,13 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state,
>  	return UFS_PM_LVL_0;
>  }
>  
> +static inline bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba)

No need to use 'inline' keyword in '.c' files. Compiler has its own decisions.

> +{
> +	return (hba->clk_gating.active_reqs || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL ||

I feel like checking the ufshcd state inside ufshcd_is_ufs_dev_busy() is
somewhat confusing. Because, if "ufshcd_state != UFSHCD_STATE_OPERATIONAL"
returns true, then it means that the ufshc is in non-operational state. But,
non-operational state doesn't mean that the ufs is busy doing some work.

So I propose to move this check outside of ufshcd_is_ufs_dev_busy().

Like,

	if (hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL ||
	    ufshcd_is_ufs_dev_busy(hba))

- Mani

> +		hba->outstanding_reqs || hba->outstanding_tasks || hba->active_uic_cmd ||
> +		hba->uic_async_done);
> +}
> +
>  static const struct ufs_dev_quirk ufs_fixups[] = {
>  	/* UFS cards deviations table */
>  	{ .wmanufacturerid = UFS_VENDOR_MICRON,
> @@ -1917,10 +1924,7 @@ static void ufshcd_gate_work(struct work_struct *work)
>  		goto rel_lock;
>  	}
>  
> -	if (hba->clk_gating.active_reqs
> -		|| hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL
> -		|| hba->outstanding_reqs || hba->outstanding_tasks
> -		|| hba->active_uic_cmd || hba->uic_async_done)
> +	if (ufshcd_is_ufs_dev_busy(hba))
>  		goto rel_lock;
>  
>  	spin_unlock_irqrestore(hba->host->host_lock, flags);
> -- 
> 2.34.1
> 

-- 
மணிவண்ணன் சதாசிவம்

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ