linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Don Brace <brace77070@gmail.com>
To: "Matthew R. Ochs" <mrochs@linux.vnet.ibm.com>,
	Don Brace <brace77070@gmail.com>
Cc: scott.teel@pmcs.com, Kevin.Barnett@pmcs.com,
	scott.benesh@pmcs.com, james.bottomley@parallels.com,
	hch@infradead.org, Justin.Lindley@pmcs.com, elliott@hpe.com,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1 20/25] hpsa: add discovery polling for PT RAID devices.
Date: Fri, 30 Oct 2015 09:08:02 -0500	[thread overview]
Message-ID: <563379C2.9070107@pmcs.com> (raw)
In-Reply-To: <CC13A5AD-7DF6-420F-B1F8-54B6D79BB6CF@linux.vnet.ibm.com>

On 10/29/2015 03:59 PM, Matthew R. Ochs wrote:
>> On Oct 29, 2015, at 3:51 PM, Don Brace <brace77070@gmail.com> wrote:
>> On 10/29/2015 03:20 PM, Matthew R. Ochs wrote:
>>>> On Oct 28, 2015, at 5:06 PM, Don Brace <don.brace@pmcs.com>
>>>>   wrote:
>>>>
>>>> From: Scott Teel
>>>> <scott.teel@pmcs.com>
>>>>
>>>>
>>>> There are problems with getting configuration change notification
>>>> in pass-through RAID environments.  So, activate flag
>>>> h->discovery_polling when one of these devices is detected in
>>>> update_scsi_devices.
>>>>
>>>> After discovery_polling is set, execute a report luns from
>>>> rescan_controller_worker (every 30 seconds).
>>>>
>>>> If the data from report_luns is different than last
>>>> time (binary compare), execute a full rescan via update_scsi_devices.
>>>>
>>>> Reviewed-by: Scott Teel
>>>> <scott.teel@pmcs.com>
>>>>
>>>> Reviewed-by: Justin Lindley
>>>> <justin.lindley@pmcs.com>
>>>>
>>>> Reviewed-by: Kevin Barnett
>>>> <kevin.barnett@pmcs.com>
>>>>
>>>> Signed-off-by: Don Brace
>>>> <don.brace@pmcs.com>
>>>>
>>>> ---
>>>> drivers/scsi/hpsa.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++
>>>> drivers/scsi/hpsa.h |    2 ++
>>>> 2 files changed, 70 insertions(+)
>>>>
>>>> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
>>>> index 8d67648..e521acd 100644
>>>> --- a/drivers/scsi/hpsa.c
>>>> +++ b/drivers/scsi/hpsa.c
>>>> @@ -276,6 +276,7 @@ static int hpsa_scsi_ioaccel_queue_command(struct ctlr_info *h,
>>>> static void hpsa_command_resubmit_worker(struct work_struct *work);
>>>> static u32 lockup_detected(struct ctlr_info *h);
>>>> static int detect_controller_lockup(struct ctlr_info *h);
>>>> +static int hpsa_luns_changed(struct ctlr_info *h);
>>>>
>>>> static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
>>>> {
>>>> @@ -3904,6 +3905,18 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
>>>> 		hpsa_update_device_supports_aborts(h, tmpdevice, lunaddrbytes);
>>>> 		this_device = currentsd[ncurrent];
>>>>
>>>> +		/* Turn on discovery_polling if there are ext target devices.
>>>> +		 * Event-based change notification is unreliable for those.
>>>> +		 */
>>>> +		if (!h->discovery_polling) {
>>>> +			if (tmpdevice->external) {
>>>> +				h->discovery_polling = 1;
>>>> +				dev_info(&h->pdev->dev,
>>>> +					"External target, activate discovery polling.\n");
>>>> +			}
>>>> +		}
>>>> +
>>>> +
>>>> 		*this_device = *tmpdevice;
>>>> 		this_device->physical_device = physical_device;
>>>>
>>>> @@ -8022,6 +8035,41 @@ static int hpsa_offline_devices_ready(struct ctlr_info *h)
>>>> 	return 0;
>>>> }
>>>>
>>>> +static int hpsa_luns_changed(struct ctlr_info *h)
>>>> +{
>>>> +	int rc = 1; /* assume there are changes */
>>>> +	struct ReportLUNdata *logdev = NULL;
>>>> +
>>>> +	/* if we can't find out if lun data has changed,
>>>> +	 * assume that it has.
>>>> +	 */
>>>> +
>>>> +	if (!h->lastlogicals)
>>>> +		goto out;
>>>> +
>>>> +	logdev = kzalloc(sizeof(*logdev), GFP_KERNEL);
>>>> +	if (!logdev) {
>>>> +		dev_warn(&h->pdev->dev,
>>>> +			"Out of memory, can't track lun changes.\n");
>>>> +		goto out;
>>>> +	}
>>>> +	if (hpsa_scsi_do_report_luns(h, 1, logdev, sizeof(*logdev), 0)) {
>>>> +		dev_warn(&h->pdev->dev,
>>>> +			"report luns failed, can't track lun changes.\n");
>>>> +		goto out;
>>>> +	}
>>>> +	if (memcmp(logdev, h->lastlogicals, sizeof(*logdev))) {
>>>> +		dev_info(&h->pdev->dev,
>>>> +			"Lun changes detected.\n");
>>>> +		memcpy(h->lastlogicals, logdev, sizeof(*logdev));
>>>> +		goto out;
>>>> +	} else
>>>> +		rc = 0; /* no changes detected. */
>>>> +out:
>>>> +	kfree(logdev);
>>>> +	return rc;
>>>> +}
>>>> +
>>>> static void hpsa_rescan_ctlr_worker(struct work_struct *work)
>>>> {
>>>> 	unsigned long flags;
>>>> @@ -8037,6 +8085,18 @@ static void hpsa_rescan_ctlr_worker(struct work_struct *work)
>>>> 		hpsa_ack_ctlr_events(h);
>>>> 		hpsa_scan_start(h->scsi_host);
>>>> 		scsi_host_put(h->scsi_host);
>>>> +	} else if (h->discovery_polling) {
>>>> +		if (hpsa_luns_changed(h)) {
>>>> +			struct Scsi_Host *sh = NULL;
>>>> +
>>>> +			dev_info(&h->pdev->dev,
>>>> +				"driver discovery polling rescan.\n");
>>>> +			sh = scsi_host_get(h->scsi_host);
>>>> +			if (sh != NULL) {
>>>> +				hpsa_scan_start(sh);
>>>> +				scsi_host_put(sh);
>>>> +			}
>>>> +		}
>>>> 	}
>>>> 	spin_lock_irqsave(&h->lock, flags);
>>>> 	if (!h->remove_in_progress)
>>>> @@ -8277,6 +8337,8 @@ reinit_after_soft_reset:
>>>>
>>>> 	/* Enable Accelerated IO path at driver layer */
>>>> 	h->acciopath_status = 1;
>>>> +	/* Disable discovery polling.*/
>>>> +	h->discovery_polling = 0;
>>>>
>>>>
>>>> 	/* Turn the interrupts on so we can service requests */
>>>> @@ -8284,6 +8346,11 @@ reinit_after_soft_reset:
>>>>
>>>> 	hpsa_hba_inquiry(h);
>>>>
>>>> +	h->lastlogicals = kzalloc(sizeof(*(h->lastlogicals)), GFP_KERNEL);
>>>> +	if (!h->lastlogicals)
>>>> +		dev_info(&h->pdev->dev,
>>>> +			"Can't track change to report lun data\n");
>>>> +
>>>> 	/* Monitor the controller for firmware lockups */
>>>> 	h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL;
>>>> 	INIT_DELAYED_WORK(&h->monitor_ctlr_work, hpsa_monitor_ctlr_worker);
>>>> @@ -8368,6 +8435,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
>>>> 	hpsa_flush_cache(h);
>>>> 	h->access.set_intr_mask(h, HPSA_INTR_OFF);
>>>> 	hpsa_free_irqs(h);			/* init_one 4 */
>>>> +	kfree(h->lastlogicals);
>>>>
>>> Is this the best place to free this memory? If your rescan worker is running
>>> concurrently you might run into trouble.
>>>
>> Since hpsa_shutdown is called from hpsa_remove_one, at a point after
>> cancel_delayed_work_sync(&h->rescan_ctlr_work) has already been called,
>> I  think that the rescan worker won’t be running at this point.
> My concern wasn't about the remove path but rather the shutdown notification path.
> ]
You are correct. I moved this to hpsa_remove_one.
Thanks
>

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-10-30 14:08 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28 22:04 [PATCH 1 00/25] hpsa updates Don Brace
2015-10-28 22:04 ` [PATCH 1 01/25] hpsa: stop zeroing reset_cmds_out and ioaccel_cmds_out during rescan Don Brace
2015-10-29 13:25   ` Tomas Henzl
2015-10-30  7:45   ` Hannes Reinecke
2015-10-28 22:04 ` [PATCH 1 02/25] hpsa: remove unused hpsa_tag_discard_error_bits Don Brace
2015-10-29 13:26   ` Tomas Henzl
2015-10-29 14:37   ` Manoj Kumar
2015-10-29 14:49     ` Don Brace
2015-10-30  7:46   ` Hannes Reinecke
2015-10-28 22:04 ` [PATCH 1 03/25] hpsa: check for null arguments to dev_printk Don Brace
2015-10-29 13:41   ` Tomas Henzl
2015-10-29 14:41   ` Manoj Kumar
2015-10-30  7:47   ` Hannes Reinecke
2015-10-30 14:16     ` Don Brace
2015-10-28 22:04 ` [PATCH 1 04/25] hpsa: fix null device issues Don Brace
2015-10-29 14:06   ` Tomas Henzl
2015-10-30  7:49   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 05/25] hpsa: allow driver requested rescans Don Brace
2015-10-30  7:51   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 06/25] hpsa: abandon rescans on memory alloaction failures Don Brace
2015-10-30  7:53   ` Hannes Reinecke
2015-10-30 20:44     ` Don Brace
2015-10-28 22:05 ` [PATCH 1 07/25] hpsa: correct transfer length for 6 byte read/write commands Don Brace
2015-10-30  7:54   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 08/25] hpsa: fix hpsa_adjust_hpsa_scsi_table Don Brace
2015-10-29 14:23   ` Tomas Henzl
2015-10-30  7:57   ` Hannes Reinecke
2015-10-30 20:46     ` Don Brace
2015-10-28 22:05 ` [PATCH 1 09/25] hpsa: fix physical target reset Don Brace
2015-10-29 14:30   ` Tomas Henzl
2015-10-29 15:29     ` Don Brace
2015-10-29 15:52       ` Tomas Henzl
2015-10-30  7:59   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 10/25] hpsa: correct check for non-disk devices Don Brace
2015-10-29 14:37   ` Tomas Henzl
2015-10-30  8:01   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 11/25] hpsa: correct ioaccel2 sg chain len Don Brace
2015-10-29 15:01   ` Tomas Henzl
2015-10-30  8:01   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 12/25] hpsa: simplify check for device exposure Don Brace
2015-10-29 15:03   ` Tomas Henzl
2015-10-30  8:04   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 13/25] hpsa: simplify update scsi devices Don Brace
2015-10-29 15:53   ` Tomas Henzl
2015-10-29 16:43   ` Matthew R. Ochs
2015-10-29 19:01     ` Don Brace
2015-10-29 20:28       ` Matthew R. Ochs
2015-10-30  8:05   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 14/25] hpsa: add function is_logical_device Don Brace
2015-10-29 15:53   ` Tomas Henzl
2015-10-29 16:46   ` Matthew R. Ochs
2015-10-30  8:05   ` Hannes Reinecke
2015-10-28 22:06 ` [PATCH 1 15/25] hpsa: enhance hpsa_get_device_id Don Brace
2015-10-29 16:04   ` Tomas Henzl
2015-10-29 17:04   ` Matthew R. Ochs
2015-10-30  8:08   ` Hannes Reinecke
2015-10-30 20:59     ` Don Brace
2015-10-28 22:06 ` [PATCH 1 16/25] hpsa: refactor hpsa_figure_bus_target_lun Don Brace
2015-10-29 16:27   ` Tomas Henzl
2015-10-30  8:09   ` Hannes Reinecke
2015-10-28 22:06 ` [PATCH 1 17/25] hpsa: move scsi_add_device and scsi_remove_device calls to new function Don Brace
2015-10-29 16:37   ` Tomas Henzl
2015-10-29 17:21   ` Matthew R. Ochs
2015-10-29 20:30     ` Don Brace
2015-10-30 15:56       ` Matthew R. Ochs
2015-10-30  8:09   ` Hannes Reinecke
2015-10-28 22:06 ` [PATCH 1 18/25] External array LUNs must use target and lun numbers assigned by the Don Brace
2015-10-29 19:41   ` Matthew R. Ochs
2015-10-30  8:11   ` Hannes Reinecke
2015-10-30 14:11   ` Tomas Henzl
2015-10-28 22:06 ` [PATCH 1 19/25] hpsa: eliminate fake lun0 enclosures Don Brace
2015-10-29 20:05   ` Matthew R. Ochs
2015-10-30  8:12   ` Hannes Reinecke
2015-10-30 14:12   ` Tomas Henzl
2015-10-28 22:06 ` [PATCH 1 20/25] hpsa: add discovery polling for PT RAID devices Don Brace
2015-10-29 20:20   ` Matthew R. Ochs
     [not found]     ` <563286B7.8070200@pmcs.com>
2015-10-29 20:59       ` Matthew R. Ochs
2015-10-30 14:08         ` Don Brace [this message]
2015-10-30 15:58           ` Matthew R. Ochs
2015-10-30  8:15   ` Hannes Reinecke
2015-10-28 22:06 ` [PATCH 1 21/25] hpsa: disable report lun data caching Don Brace
2015-10-30  8:16   ` Hannes Reinecke
2015-10-30 14:25   ` Tomas Henzl
2015-10-30 21:18     ` Don Brace
2015-10-30 16:27   ` Matthew R. Ochs
2015-10-28 22:06 ` [PATCH 1 22/25] hpsa: enhance device messages Don Brace
2015-10-30  8:16   ` Hannes Reinecke
2015-10-30 14:32   ` Tomas Henzl
2015-11-02 16:54     ` Don Brace
2015-11-03 13:12       ` Tomas Henzl
2015-10-30 16:53   ` Matthew R. Ochs
2015-10-28 22:06 ` [PATCH 1 23/25] hpsa: fix multiple issues in path_info_show Don Brace
2015-10-30  8:18   ` Hannes Reinecke
2015-10-30 14:33   ` Tomas Henzl
2015-10-30 17:07   ` Matthew R. Ochs
2015-10-28 22:06 ` [PATCH 1 24/25] hpsa: add in sas transport class Don Brace
2015-10-30  8:21   ` Hannes Reinecke
2015-10-30 14:40   ` Tomas Henzl
2015-10-30 20:07   ` Matthew R. Ochs
2015-10-30 22:00     ` Don Brace
2015-10-30 23:23       ` Matthew R. Ochs
2015-11-03  0:40   ` kbuild test robot
2015-10-28 22:07 ` [PATCH 1 25/25] hpsa: bump the driver version Don Brace
2015-10-30  8:22   ` Hannes Reinecke
2015-10-30 14:44   ` Tomas Henzl
2015-10-30 20:08   ` Matthew R. Ochs
2015-11-03  4:49 ` [PATCH 1 00/25] hpsa updates Martin K. Petersen

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=563379C2.9070107@pmcs.com \
    --to=brace77070@gmail.com \
    --cc=Justin.Lindley@pmcs.com \
    --cc=Kevin.Barnett@pmcs.com \
    --cc=elliott@hpe.com \
    --cc=hch@infradead.org \
    --cc=james.bottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mrochs@linux.vnet.ibm.com \
    --cc=scott.benesh@pmcs.com \
    --cc=scott.teel@pmcs.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;
as well as URLs for NNTP newsgroup(s).