public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Kashyap Desai <kashyap.desai@broadcom.com>
To: Hannes Reinecke <hare@suse.de>, linux-scsi@vger.kernel.org
Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
	Steve Hagan <steve.hagan@broadcom.com>,
	Peter Rivera <peter.rivera@broadcom.com>,
	mpi3mr-drvr-developers <mpi3mr-linuxdrv.pdl@broadcom.com>,
	Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Subject: RE: [PATCH v3 06/24] mpi3mr: add support of event handling part-1
Date: Wed, 12 May 2021 00:04:27 +0530	[thread overview]
Message-ID: <93f2f5fefa6b16d7dc9bf8298b9eeb8f@mail.gmail.com> (raw)
In-Reply-To: <1f03c0a0-e9a9-3782-3948-4a11ecb43826@suse.de>

[-- Attachment #1: Type: text/plain, Size: 8579 bytes --]

> > @@ -612,7 +1942,25 @@ static void mpi3mr_target_destroy(struct
> scsi_target *starget)
> >   */
> >  static int mpi3mr_slave_configure(struct scsi_device *sdev)  {
> > +	struct scsi_target *starget;
> > +	struct Scsi_Host *shost;
> > +	struct mpi3mr_ioc *mrioc;
> > +	struct mpi3mr_tgt_dev *tgt_dev;
> > +	unsigned long flags;
> >  	int retval = 0;
> > +
> > +	starget = scsi_target(sdev);
> > +	shost = dev_to_shost(&starget->dev);
> > +	mrioc = shost_priv(shost);
> > +
> > +	spin_lock_irqsave(&mrioc->tgtdev_lock, flags);
> > +	tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id);
> > +	spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags);
> > +	if (!tgt_dev)
> > +		return retval;
> > +
>
> Return '0' on unknown SCSI devices? Really?

Hannes  - I will fix this in V4. I am planning to send V4 today. Please
review.
>
> > +	mpi3mr_tgtdev_put(tgt_dev);
> > +
> >  	return retval;
> >  }
> >
> > @@ -626,7 +1974,37 @@ static int mpi3mr_slave_configure(struct
> scsi_device *sdev)
> >   */
> >  static int mpi3mr_slave_alloc(struct scsi_device *sdev)  {
> > +	struct Scsi_Host *shost;
> > +	struct mpi3mr_ioc *mrioc;
> > +	struct mpi3mr_stgt_priv_data *scsi_tgt_priv_data;
> > +	struct mpi3mr_tgt_dev *tgt_dev;
> > +	struct mpi3mr_sdev_priv_data *scsi_dev_priv_data;
> > +	unsigned long flags;
> > +	struct scsi_target *starget;
> >  	int retval = 0;
> > +
> > +	starget = scsi_target(sdev);
> > +	shost = dev_to_shost(&starget->dev);
> > +	mrioc = shost_priv(shost);
> > +	scsi_tgt_priv_data = starget->hostdata;
> > +
> > +	scsi_dev_priv_data = kzalloc(sizeof(*scsi_dev_priv_data),
> GFP_KERNEL);
> > +	if (!scsi_dev_priv_data)
> > +		return -ENOMEM;
> > +
> > +	scsi_dev_priv_data->lun_id = sdev->lun;
> > +	scsi_dev_priv_data->tgt_priv_data = scsi_tgt_priv_data;
> > +	sdev->hostdata = scsi_dev_priv_data;
> > +
> > +	scsi_tgt_priv_data->num_luns++;
> > +
> > +	spin_lock_irqsave(&mrioc->tgtdev_lock, flags);
> > +	tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id);
> > +	if (tgt_dev && (tgt_dev->starget == NULL))
> > +		tgt_dev->starget = starget;
> > +	if (tgt_dev)
> > +		mpi3mr_tgtdev_put(tgt_dev);
> > +	spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags);
> >  	return retval;
> >  }
> >
> Same here. I would have expected -ENXIO to be returned fi the tgt_dev is
> not
> found.
> And you can fold the two 'if' clauses into one eg like:

This is fixed in  in V4.

>
> if (tgt_dev) {
>   if (tgt_dev->starget == NULL)
>     tgt_dev = starget;
>   mpi3mr_tgtdev_put(tgt_dev);
>   retval = 0;
> }
>
> > @@ -640,7 +2018,33 @@ static int mpi3mr_slave_alloc(struct scsi_device
> *sdev)
> >   */
> >  static int mpi3mr_target_alloc(struct scsi_target *starget)  {
> > +	struct Scsi_Host *shost = dev_to_shost(&starget->dev);
> > +	struct mpi3mr_ioc *mrioc = shost_priv(shost);
> > +	struct mpi3mr_stgt_priv_data *scsi_tgt_priv_data;
> > +	struct mpi3mr_tgt_dev *tgt_dev;
> > +	unsigned long flags;
> >  	int retval = -ENODEV;
> > +
> > +	scsi_tgt_priv_data = kzalloc(sizeof(*scsi_tgt_priv_data),
> GFP_KERNEL);
> > +	if (!scsi_tgt_priv_data)
> > +		return -ENOMEM;
> > +
> > +	starget->hostdata = scsi_tgt_priv_data;
> > +	scsi_tgt_priv_data->starget = starget;
> > +	scsi_tgt_priv_data->dev_handle = MPI3MR_INVALID_DEV_HANDLE;
> > +
> > +	spin_lock_irqsave(&mrioc->tgtdev_lock, flags);
> > +	tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id);
> > +	if (tgt_dev && !tgt_dev->is_hidden) {
> > +		scsi_tgt_priv_data->dev_handle = tgt_dev->dev_handle;
> > +		scsi_tgt_priv_data->perst_id = tgt_dev->perst_id;
> > +		scsi_tgt_priv_data->dev_type = tgt_dev->dev_type;
> > +		scsi_tgt_priv_data->tgt_dev = tgt_dev;
> > +		tgt_dev->starget = starget;
> > +		atomic_set(&scsi_tgt_priv_data->block_io, 0);
> > +		retval = 0;
> > +	}
> > +	spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags);
> >  	return retval;
> >  }
> >
> Ah, here is the correct value set.
> (But wasn't it ENXIO which should've been returned for unknown targets?)

This is fixed in V4.

>
> > @@ -836,7 +2240,7 @@ mpi3mr_probe(struct pci_dev *pdev, const struct
> > pci_device_id *id)  {
> >  	struct mpi3mr_ioc *mrioc = NULL;
> >  	struct Scsi_Host *shost = NULL;
> > -	int retval = 0;
> > +	int retval = 0, i;
> >
> >  	shost = scsi_host_alloc(&mpi3mr_driver_template,
> >  	    sizeof(struct mpi3mr_ioc));
> > @@ -857,11 +2261,21 @@ mpi3mr_probe(struct pci_dev *pdev, const
> struct pci_device_id *id)
> >  	spin_lock_init(&mrioc->admin_req_lock);
> >  	spin_lock_init(&mrioc->reply_free_queue_lock);
> >  	spin_lock_init(&mrioc->sbq_lock);
> > +	spin_lock_init(&mrioc->fwevt_lock);
> > +	spin_lock_init(&mrioc->tgtdev_lock);
> >  	spin_lock_init(&mrioc->watchdog_lock);
> >  	spin_lock_init(&mrioc->chain_buf_lock);
> >
> > +	INIT_LIST_HEAD(&mrioc->fwevt_list);
> > +	INIT_LIST_HEAD(&mrioc->tgtdev_list);
> > +	INIT_LIST_HEAD(&mrioc->delayed_rmhs_list);
> > +
> >  	mpi3mr_init_drv_cmd(&mrioc->init_cmds,
> MPI3MR_HOSTTAG_INITCMDS);
> >
> > +	for (i = 0; i < MPI3MR_NUM_DEVRMCMD; i++)
> > +		mpi3mr_init_drv_cmd(&mrioc->dev_rmhs_cmds[i],
> > +		    MPI3MR_HOSTTAG_DEVRMCMD_MIN + i);
> > +
> >  	if (pdev->revision)
> >  		mrioc->enable_segqueue = true;
> >
> > @@ -877,6 +2291,17 @@ mpi3mr_probe(struct pci_dev *pdev, const struct
> pci_device_id *id)
> >  	shost->max_channel = 1;
> >  	shost->max_id = 0xFFFFFFFF;
> >
> > +	snprintf(mrioc->fwevt_worker_name, sizeof(mrioc-
> >fwevt_worker_name),
> > +	    "%s%d_fwevt_wrkr", mrioc->driver_name, mrioc->id);
> > +	mrioc->fwevt_worker_thread = alloc_ordered_workqueue(
> > +	    mrioc->fwevt_worker_name, WQ_MEM_RECLAIM);
> > +	if (!mrioc->fwevt_worker_thread) {
> > +		ioc_err(mrioc, "failure at %s:%d/%s()!\n",
> > +		    __FILE__, __LINE__, __func__);
> > +		retval = -ENODEV;
> > +		goto out_fwevtthread_failed;
> > +	}
> > +
> >  	mrioc->is_driver_loading = 1;
> >  	if (mpi3mr_init_ioc(mrioc)) {
> >  		ioc_err(mrioc, "failure at %s:%d/%s()!\n", @@ -903,6 +2328,8
> @@
> > mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> >  addhost_failed:
> >  	mpi3mr_cleanup_ioc(mrioc);
> >  out_iocinit_failed:
> > +	destroy_workqueue(mrioc->fwevt_worker_thread);
> > +out_fwevtthread_failed:
> >  	spin_lock(&mrioc_list_lock);
> >  	list_del(&mrioc->list);
> >  	spin_unlock(&mrioc_list_lock);
> > @@ -924,14 +2351,30 @@ static void mpi3mr_remove(struct pci_dev
> *pdev)
> > {
> >  	struct Scsi_Host *shost = pci_get_drvdata(pdev);
> >  	struct mpi3mr_ioc *mrioc;
> > +	struct workqueue_struct	*wq;
> > +	unsigned long flags;
> > +	struct mpi3mr_tgt_dev *tgtdev, *tgtdev_next;
> >
> >  	mrioc = shost_priv(shost);
> >  	while (mrioc->reset_in_progress || mrioc->is_driver_loading)
> >  		ssleep(1);
> >
> >  	mrioc->stop_drv_processing = 1;
> > +	mpi3mr_cleanup_fwevt_list(mrioc);
> > +	spin_lock_irqsave(&mrioc->fwevt_lock, flags);
> > +	wq = mrioc->fwevt_worker_thread;
> > +	mrioc->fwevt_worker_thread = NULL;
> > +	spin_unlock_irqrestore(&mrioc->fwevt_lock, flags);
> > +	if (wq)
> > +		destroy_workqueue(wq);
> >
> >  	scsi_remove_host(shost);
> > +	list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list,
> > +	    list) {
> > +		mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev);
> > +		mpi3mr_tgtdev_del_from_list(mrioc, tgtdev);
> > +		mpi3mr_tgtdev_put(tgtdev);
> > +	}
> >
> >  	mpi3mr_cleanup_ioc(mrioc);
> >
> > @@ -955,6 +2398,8 @@ static void mpi3mr_shutdown(struct pci_dev
> *pdev)
> > {
> >  	struct Scsi_Host *shost = pci_get_drvdata(pdev);
> >  	struct mpi3mr_ioc *mrioc;
> > +	struct workqueue_struct	*wq;
> > +	unsigned long flags;
> >
> >  	if (!shost)
> >  		return;
> > @@ -963,6 +2408,13 @@ static void mpi3mr_shutdown(struct pci_dev
> *pdev)
> >  	while (mrioc->reset_in_progress || mrioc->is_driver_loading)
> >  		ssleep(1);
> >  	mrioc->stop_drv_processing = 1;
> > +	mpi3mr_cleanup_fwevt_list(mrioc);
> > +	spin_lock_irqsave(&mrioc->fwevt_lock, flags);
> > +	wq = mrioc->fwevt_worker_thread;
> > +	mrioc->fwevt_worker_thread = NULL;
> > +	spin_unlock_irqrestore(&mrioc->fwevt_lock, flags);
> > +	if (wq)
> > +		destroy_workqueue(wq);
> >
> >  	mpi3mr_cleanup_ioc(mrioc);
> >
> >
> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke		        Kernel Storage Architect
> hare@suse.de			               +49 911 74053 688
> SUSE Software Solutions Germany GmbH, 90409 Nürnberg
> GF: F. Imendörffer, HRB 36809 (AG Nürnberg)

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

  reply	other threads:[~2021-05-11 18:34 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 11:01 [PATCH v3 00/24] Introducing mpi3mr driver Kashyap Desai
2021-04-19 11:01 ` [PATCH v3 01/24] mpi3mr: add mpi30 Rev-R headers and Kconfig Kashyap Desai
2021-04-23 13:02   ` Hannes Reinecke
2021-04-23 13:14     ` Kashyap Desai
2021-04-19 11:01 ` [PATCH v3 02/24] mpi3mr: base driver code Kashyap Desai
2021-04-23 13:13   ` Hannes Reinecke
2021-04-27 15:47     ` Kashyap Desai
2021-04-27 18:08       ` Hannes Reinecke
2021-04-19 11:01 ` [PATCH v3 03/24] mpi3mr: create operational request and reply queue pair Kashyap Desai
2021-04-21 17:05   ` Himanshu Madhani
2021-04-26 14:22   ` Hannes Reinecke
2021-04-19 11:01 ` [PATCH v3 04/24] mpi3mr: add support of queue command processing Kashyap Desai
2021-04-21 17:05   ` Himanshu Madhani
2021-04-26 15:12   ` Hannes Reinecke
2021-04-27 16:44     ` Kashyap Desai
2021-04-19 11:01 ` [PATCH v3 05/24] mpi3mr: add support of internal watchdog thread Kashyap Desai
2021-04-21 18:57   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 06/24] mpi3mr: add support of event handling part-1 Kashyap Desai
2021-04-19 17:54   ` Tomas Henzl
2021-04-21  6:49     ` Kashyap Desai
2021-04-21 20:25   ` Himanshu Madhani
2021-04-26 16:05   ` Hannes Reinecke
2021-05-11 18:34     ` Kashyap Desai [this message]
2021-04-19 11:01 ` [PATCH v3 07/24] mpi3mr: add support of event handling pcie devices part-2 Kashyap Desai
2021-04-21 20:31   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 08/24] mpi3mr: add support of event handling part-3 Kashyap Desai
2021-04-21 20:35   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 09/24] mpi3mr: add support for recovering controller Kashyap Desai
2021-04-21 20:59   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 10/24] mpi3mr: add support of timestamp sync with firmware Kashyap Desai
2021-04-21 21:08   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 11/24] mpi3mr: print ioc info for debugging Kashyap Desai
2021-04-22  2:24   ` Himanshu Madhani
2021-04-26 16:06   ` Hannes Reinecke
2021-05-11 18:35     ` Kashyap Desai
2021-04-19 11:01 ` [PATCH v3 12/24] mpi3mr: add bios_param shost template hook Kashyap Desai
2021-04-22  2:31   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 13/24] mpi3mr: implement scsi error handler hooks Kashyap Desai
2021-04-22 15:42   ` Himanshu Madhani
2021-04-26 16:10   ` Hannes Reinecke
2021-04-27 16:56     ` Kashyap Desai
2021-04-19 11:01 ` [PATCH v3 14/24] mpi3mr: add change queue depth support Kashyap Desai
2021-04-22 15:48   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 15/24] mpi3mr: allow certain commands during pci-remove hook Kashyap Desai
2021-04-22 15:49   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 16/24] mpi3mr: hardware workaround for UNMAP commands to nvme drives Kashyap Desai
2021-04-22 16:01   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 17/24] mpi3mr: add support of threaded isr Kashyap Desai
2021-04-22 17:08   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 18/24] mpi3mr: add complete support of soft reset Kashyap Desai
2021-04-22 17:16   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 19/24] mpi3mr: print pending host ios for debug Kashyap Desai
2021-04-22 17:17   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 20/24] mpi3mr: wait for pending IO completions upon detection of VD IO timeout Kashyap Desai
2021-04-22 17:22   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 21/24] mpi3mr: add support of PM suspend and resume Kashyap Desai
2021-04-22 17:24   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 22/24] mpi3mr: add support of DSN secure fw check Kashyap Desai
2021-04-22 17:27   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 23/24] mpi3mr: add eedp dif dix support Kashyap Desai
2021-04-22 17:42   ` Himanshu Madhani
2021-04-19 11:01 ` [PATCH v3 24/24] mpi3mr: add event handling debug prints Kashyap Desai
2021-04-22 17:45   ` Himanshu Madhani

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=93f2f5fefa6b16d7dc9bf8298b9eeb8f@mail.gmail.com \
    --to=kashyap.desai@broadcom.com \
    --cc=hare@suse.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mpi3mr-linuxdrv.pdl@broadcom.com \
    --cc=peter.rivera@broadcom.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=steve.hagan@broadcom.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