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: <1319810e-a323-c022-5e27-902f88cefe8f@acm.org>
Date:   Tue, 9 Jun 2020 21:15:58 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     daejun7.park@...sung.com, ALIM AKHTAR <alim.akhtar@...sung.com>,
        "avri.altman@....com" <avri.altman@....com>,
        "jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>,
        "asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
        "beanhuo@...ron.com" <beanhuo@...ron.com>,
        "stanley.chu@...iatek.com" <stanley.chu@...iatek.com>,
        "cang@...eaurora.org" <cang@...eaurora.org>,
        "tomas.winkler@...el.com" <tomas.winkler@...el.com>
Cc:     "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Sang-yoon Oh <sangyoon.oh@...sung.com>,
        Sung-Jun Park <sungjun07.park@...sung.com>,
        yongmyung lee <ymhungry.lee@...sung.com>,
        Jinyoung CHOI <j-young.choi@...sung.com>,
        Adel Choi <adel.choi@...sung.com>,
        BoRam Shin <boram.shin@...sung.com>
Subject: Re: [RFC PATCH 2/5] scsi: ufs: Add UFS-feature layer

On 2020-06-04 18:30, Daejun Park wrote:
> +inline void ufsf_slave_configure(struct ufs_hba *hba,
> +				 struct scsi_device *sdev)
> +{
> +	/* skip well-known LU */
> +	if (sdev->lun >= UFS_UPIU_MAX_UNIT_NUM_ID)
> +		return;
> +
> +	if (!(hba->dev_info.b_ufs_feature_sup & UFS_FEATURE_SUPPORT_HPB_BIT))
> +		return;
> +
> +	atomic_inc(&hba->ufsf.slave_conf_cnt);
> +	smp_mb__after_atomic(); /* for slave_conf_cnt */
> +
> +	/* waiting sdev init.*/
> +	if (waitqueue_active(&hba->ufsf.sdev_wait))
> +		wake_up(&hba->ufsf.sdev_wait);
> +}

Guarding a wake_up() call with a waitqueue_active() check is an
anti-pattern. Please don't do that and call wake_up() directly.
Additionally, wake_up() includes a barrier if it wakes up a kernel
thread so the smp_mb__after_atomic() can be left out if the
waitqueue_active() call is removed.

> +/**
> + * struct ufsf_operation - UFS feature specific callbacks
> + * @prep_fn: called after construct upiu structure
> + * @reset: called after proving hba
                           ^^^^^^^
Is this a typo? Should "proving" perhaps be changed into "probing"?

> +struct ufshpb_driver {
> +	struct device_driver drv;
> +	struct list_head lh_hpb_lu;
> +
> +	struct ufsf_operation ufshpb_ops;
> +
> +	/* memory management */
> +	struct kmem_cache *ufshpb_mctx_cache;
> +	mempool_t *ufshpb_mctx_pool;
> +	mempool_t *ufshpb_page_pool;
> +
> +	struct workqueue_struct *ufshpb_wq;
> +};

Why is a dedicated workqueue needed? Why are the standard workqueues not
good enough?

> @@ -2525,6 +2525,8 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
>  
>  	ufshcd_comp_scsi_upiu(hba, lrbp);
>  
> +	ufsf_ops_prep_fn(hba, lrbp);
> +
>  	err = ufshcd_map_sg(hba, lrbp);
>  	if (err) {
>  		lrbp->cmd = NULL;

What happens if a SCSI command is retried and hence ufsf_ops_prep_fn()
is called multiple times for the same SCSI command?

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ