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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60542301-e77f-ad26-e249-29d42f446d74@acm.org>
Date:   Wed, 10 May 2023 13:05:10 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     Kiwoong Kim <kwmad.kim@...sung.com>, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org, alim.akhtar@...sung.com,
        avri.altman@....com, jejb@...ux.ibm.com,
        martin.petersen@...cle.com, beanhuo@...ron.com,
        adrian.hunter@...el.com, sc.suh@...sung.com, hy50.seo@...sung.com,
        sh425.lee@...sung.com, bhoon95.kim@...sung.com,
        kwangwon.min@...sung.com, junwoo80.lee@...sung.com
Subject: Re: [PATCH v2] ufs: poll pmc until another pa request is completed

On 4/24/23 18:20, Kiwoong Kim wrote:
> @@ -4138,6 +4141,61 @@ int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
>   }
>   EXPORT_SYMBOL_GPL(ufshcd_dme_get_attr);
>   
> +static int __ufshcd_poll_uic_pwr(struct ufs_hba *hba, struct uic_command *cmd,
> +		struct completion *cnf)

What does the name "cnf" mean? To me it seems to be a weird name for a 
completion function pointer.

> +{
> +	unsigned long flags;
> +	int ret;
> +	ktime_t timeout;
> +	u32 mode = cmd->argument3;

Is my understanding correct that __ufshcd_send_uic_cmd() does not modify 
cmd->argument3? If so, why does this function copy cmd->argument3 and 
re-assign cmd->argument3?

> +	timeout = ktime_add_ms(ktime_get(), UIC_PA_RDY_TIMEOUT);

"deadline" is probably a better name for this variable than "timeout". 
Additionally, please consider using jiffies since I think that the 
accuracy of the jiffies counter is sufficient in this context.

> +	do {
> +		spin_lock_irqsave(hba->host->host_lock, flags);
> +		hba->active_uic_cmd = NULL;

Is my understanding correct that it is guaranteed that 
hba->active_uic_cmd is NULL here? If so, what is the purpose of the 
above statement?

> +		ret = __ufshcd_send_uic_cmd(hba, cmd, true);
> +		spin_unlock_irqrestore(hba->host->host_lock, flags);
> +		if (ret) {
> +			dev_err(hba->dev,
> +				"pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n",
> +				cmd->command, cmd->argument3, ret);
> +			goto out;
> +		}
> +
> +		/* This value is heuristic */
> +		if (!wait_for_completion_timeout(&cmd->done,
> +		    msecs_to_jiffies(5))) {

Please align msecs_to_jiffies(5) with the first argument ("&cmd->done").

> +			ret = -ETIMEDOUT;
> +			dev_err(hba->dev,
> +				"pwr ctrl cmd 0x%x with mode 0x%x timeout\n",
> +				cmd->command, cmd->argument3);
> +			if (cmd->cmd_active)
> +				goto out;
> +
> +			dev_info(hba->dev, "%s: pwr ctrl cmd has already been completed\n", __func__);
> +		}
> +
> +		/* retry for only busy cases */

Please fix the word order in the above comment (for only -> only for)

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ