From: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
To: jbottomley@parallels.com
Cc: stephenmcameron@gmail.com, mikem@beardog.cce.hp.com,
matthew.gates@hp.com, linux-scsi@vger.kernel.org,
scott.teel@hp.com
Subject: [PATCH 01/41] hpsa: revert bring logical drives online when format completes
Date: Wed, 15 Jan 2014 16:36:23 -0600 [thread overview]
Message-ID: <20140115223623.5061.58007.stgit@beardog.cce.hp.com> (raw)
In-Reply-To: <20140115223354.5061.50276.stgit@beardog.cce.hp.com>
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
This relies on a kernel thread which I wish to remove and
replace with a work queue based solution.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
drivers/scsi/hpsa.c | 128 ---------------------------------------------------
drivers/scsi/hpsa.h | 13 -----
2 files changed, 1 insertions(+), 140 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 604f5d0..06cb802 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -220,8 +220,6 @@ static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id);
static int hpsa_wait_for_board_state(struct pci_dev *pdev, void __iomem *vaddr,
int wait_for_ready);
static inline void finish_cmd(struct CommandList *c);
-static unsigned char hpsa_format_in_progress(struct ctlr_info *h,
- unsigned char scsi3addr[]);
#define BOARD_NOT_READY 0
#define BOARD_READY 1
@@ -946,112 +944,6 @@ static int hpsa_scsi_find_entry(struct hpsa_scsi_dev_t *needle,
return DEVICE_NOT_FOUND;
}
-#define OFFLINE_DEVICE_POLL_INTERVAL (120 * HZ)
-static int hpsa_offline_device_thread(void *v)
-{
- struct ctlr_info *h = v;
- unsigned long flags;
- struct offline_device_entry *d;
- unsigned char need_rescan = 0;
- struct list_head *this, *tmp;
-
- while (1) {
- schedule_timeout_interruptible(OFFLINE_DEVICE_POLL_INTERVAL);
- if (kthread_should_stop())
- break;
-
- /* Check if any of the offline devices have become ready */
- spin_lock_irqsave(&h->offline_device_lock, flags);
- list_for_each_safe(this, tmp, &h->offline_device_list) {
- d = list_entry(this, struct offline_device_entry,
- offline_list);
- spin_unlock_irqrestore(&h->offline_device_lock, flags);
- if (!hpsa_format_in_progress(h, d->scsi3addr)) {
- need_rescan = 1;
- goto do_rescan;
- }
- spin_lock_irqsave(&h->offline_device_lock, flags);
- }
- spin_unlock_irqrestore(&h->offline_device_lock, flags);
- }
-
-do_rescan:
-
- /* Remove all entries from the list and rescan and exit this thread.
- * If there are still offline devices, the rescan will make a new list
- * and create a new offline device monitor thread.
- */
- spin_lock_irqsave(&h->offline_device_lock, flags);
- list_for_each_safe(this, tmp, &h->offline_device_list) {
- d = list_entry(this, struct offline_device_entry, offline_list);
- list_del_init(this);
- kfree(d);
- }
- h->offline_device_monitor = NULL;
- h->offline_device_thread_state = OFFLINE_DEVICE_THREAD_STOPPED;
- spin_unlock_irqrestore(&h->offline_device_lock, flags);
- if (need_rescan)
- hpsa_scan_start(h->scsi_host);
- return 0;
-}
-
-static void hpsa_monitor_offline_device(struct ctlr_info *h,
- unsigned char scsi3addr[])
-{
- struct offline_device_entry *device;
- unsigned long flags;
-
- /* Check to see if device is already on the list */
- spin_lock_irqsave(&h->offline_device_lock, flags);
- list_for_each_entry(device, &h->offline_device_list, offline_list) {
- if (memcmp(device->scsi3addr, scsi3addr,
- sizeof(device->scsi3addr)) == 0) {
- spin_unlock_irqrestore(&h->offline_device_lock, flags);
- return;
- }
- }
- spin_unlock_irqrestore(&h->offline_device_lock, flags);
-
- /* Device is not on the list, add it. */
- device = kmalloc(sizeof(*device), GFP_KERNEL);
- if (!device) {
- dev_warn(&h->pdev->dev, "out of memory in %s\n", __func__);
- return;
- }
- memcpy(device->scsi3addr, scsi3addr, sizeof(device->scsi3addr));
- spin_lock_irqsave(&h->offline_device_lock, flags);
- list_add_tail(&device->offline_list, &h->offline_device_list);
- if (h->offline_device_thread_state == OFFLINE_DEVICE_THREAD_STOPPED) {
- h->offline_device_thread_state = OFFLINE_DEVICE_THREAD_RUNNING;
- spin_unlock_irqrestore(&h->offline_device_lock, flags);
- h->offline_device_monitor =
- kthread_run(hpsa_offline_device_thread, h, HPSA "-odm");
- spin_lock_irqsave(&h->offline_device_lock, flags);
- }
- if (!h->offline_device_monitor) {
- dev_warn(&h->pdev->dev, "failed to start offline device monitor thread.\n");
- h->offline_device_thread_state = OFFLINE_DEVICE_THREAD_STOPPED;
- }
- spin_unlock_irqrestore(&h->offline_device_lock, flags);
-}
-
-static void stop_offline_device_monitor(struct ctlr_info *h)
-{
- unsigned long flags;
- int stop_thread;
-
- spin_lock_irqsave(&h->offline_device_lock, flags);
- stop_thread = (h->offline_device_thread_state ==
- OFFLINE_DEVICE_THREAD_RUNNING);
- if (stop_thread)
- /* STOPPING state prevents new thread from starting. */
- h->offline_device_thread_state =
- OFFLINE_DEVICE_THREAD_STOPPING;
- spin_unlock_irqrestore(&h->offline_device_lock, flags);
- if (stop_thread)
- kthread_stop(h->offline_device_monitor);
-}
-
static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
struct hpsa_scsi_dev_t *sd[], int nsds)
{
@@ -1124,10 +1016,7 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
*/
if (sd[i]->format_in_progress) {
dev_info(&h->pdev->dev,
- "c%db%dt%dl%d: Logical drive parity initialization, erase or format in progress\n",
- h->scsi_host->host_no,
- sd[i]->bus, sd[i]->target, sd[i]->lun);
- dev_info(&h->pdev->dev, "c%db%dt%dl%d: temporarily offline\n",
+ "Logical drive format in progress, device c%db%dt%dl%d offline.\n",
h->scsi_host->host_no,
sd[i]->bus, sd[i]->target, sd[i]->lun);
continue;
@@ -1151,17 +1040,6 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
}
spin_unlock_irqrestore(&h->devlock, flags);
- /* Monitor devices which are NOT READY, FORMAT IN PROGRESS to be
- * brought online later. This must be done without holding h->devlock,
- * so don't touch h->dev[]
- */
- for (i = 0; i < nsds; i++) {
- if (!sd[i]) /* if already added above. */
- continue;
- if (sd[i]->format_in_progress)
- hpsa_monitor_offline_device(h, sd[i]->scsi3addr);
- }
-
/* Don't notify scsi mid layer of any changes the first time through
* (or if there are no changes) scsi_scan_host will do it later the
* first time through.
@@ -5066,10 +4944,8 @@ reinit_after_soft_reset:
h->intr_mode = hpsa_simple_mode ? SIMPLE_MODE_INT : PERF_MODE_INT;
INIT_LIST_HEAD(&h->cmpQ);
INIT_LIST_HEAD(&h->reqQ);
- INIT_LIST_HEAD(&h->offline_device_list);
spin_lock_init(&h->lock);
spin_lock_init(&h->scan_lock);
- spin_lock_init(&h->offline_device_lock);
spin_lock_init(&h->passthru_count_lock);
rc = hpsa_pci_init(h);
if (rc != 0)
@@ -5078,7 +4954,6 @@ reinit_after_soft_reset:
sprintf(h->devname, HPSA "%d", number_of_controllers);
h->ctlr = number_of_controllers;
number_of_controllers++;
- h->offline_device_thread_state = OFFLINE_DEVICE_THREAD_STOPPED;
/* configure PCI DMA stuff */
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
@@ -5257,7 +5132,6 @@ static void hpsa_remove_one(struct pci_dev *pdev)
}
h = pci_get_drvdata(pdev);
stop_controller_lockup_detector(h);
- stop_offline_device_monitor(h);
hpsa_unregister_scsi(h); /* unhook from SCSI subsystem */
hpsa_shutdown(pdev);
iounmap(h->vaddr);
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index bea2365..04074f5 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -161,20 +161,7 @@ struct ctlr_info {
#define HPSATMF_LOG_QRY_TASK (1 << 23)
#define HPSATMF_LOG_QRY_TSET (1 << 24)
#define HPSATMF_LOG_QRY_ASYNC (1 << 25)
- spinlock_t offline_device_lock;
- struct list_head offline_device_list;
- struct task_struct *offline_device_monitor;
- unsigned char offline_device_thread_state;
-#define OFFLINE_DEVICE_THREAD_STOPPED 0
-#define OFFLINE_DEVICE_THREAD_STOPPING 1
-#define OFFLINE_DEVICE_THREAD_RUNNING 2
};
-
-struct offline_device_entry {
- unsigned char scsi3addr[8];
- struct list_head offline_list;
-};
-
#define HPSA_ABORT_MSG 0
#define HPSA_DEVICE_RESET_MSG 1
#define HPSA_RESET_TYPE_CONTROLLER 0x00
next prev parent reply other threads:[~2014-01-15 21:36 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-15 22:36 [PATCH 00/41] hpsa January 2014 driver updates Stephen M. Cameron
2014-01-15 22:36 ` Stephen M. Cameron [this message]
2014-01-15 22:36 ` [PATCH 02/41] hpsa: revert hide logical drives with format in progress from linux Stephen M. Cameron
2014-01-15 22:36 ` [PATCH 03/41] hpsa: use workqueue instead of kernel thread for lockup detection Stephen M. Cameron
2014-01-15 22:36 ` [PATCH 04/41] hpsa: rename scsi prefetch field Stephen M. Cameron
2014-01-15 22:36 ` [PATCH 05/41] hpsa: enable unit attention reporting Stephen M. Cameron
2014-01-15 22:36 ` [PATCH 06/41] hpsa: do not require board "not ready" status after hard reset Stephen M. Cameron
2014-01-15 22:36 ` [PATCH 07/41] hpsa: allow SCSI mid layer to handle unit attention Stephen M. Cameron
2014-01-15 22:36 ` [PATCH 08/41] hpsa: use extended report luns command for HP SSD SmartPath Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 09/41] hpsa: mark last scatter gather element as the last Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 10/41] hpsa: add support for 'fastpath' i/o Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 11/41] hpsa: only allow REQ_TYPE_FS to use fast path Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 12/41] hpsa: fix task management for mode-1 ioaccell path Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 13/41] hpsa: add ioaccell mode 1 RAID offload support Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 14/41] hpsa: update raid offload status on device rescan Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 15/41] hpsa: poll controller to detect device change event Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 16/41] hpsa: do not rescan controllers known to be locked up Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 17/41] hpsa: add hp_ssd_smart_path_enabled sysfs attribute Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 18/41] hpsa: complain if physical or logical aborts are not supported Stephen M. Cameron
2014-01-15 22:37 ` [PATCH 19/41] hpsa: add ioaccel mode 2 structure definitions Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 20/41] hpsa: Acknowledge controller events in ioaccell mode 2 as well as mode 1 Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 21/41] hpsa: do ioaccel mode 2 resource allocations Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 22/41] hpsa: get physical device handles for io accel mode 2 as well as mode 1 Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 23/41] hpsa: initialize controller to perform io accelerator mode 2 Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 24/41] hpsa: get ioaccel mode 2 i/o working Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 25/41] hpsa: teach hpsa_device_reset to do either target or lun reset Stephen M. Cameron
2014-01-16 8:36 ` Hannes Reinecke
2014-01-16 13:33 ` Gates, Matt
2014-01-15 22:38 ` [PATCH 26/41] hpsa: add task management for ioaccel mode 2 Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 27/41] hpsa: make device update copy the raid map also Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 28/41] hpsa: complete the ioaccel raidmap code Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 29/41] hpsa: allow user to disable accelerated i/o path Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 30/41] hpsa: rescan devices on ioaccel2 error Stephen M. Cameron
2014-01-15 22:38 ` [PATCH 31/41] hpsa: allow VPD page zero to be queried Stephen M. Cameron
2014-01-15 22:39 ` [PATCH 32/41] hpsa: do not inquire for unsupported ioaccel status vpd page Stephen M. Cameron
2014-01-15 22:39 ` [PATCH 33/41] hpsa: retry certain ioaccel error cases on the RAID path Stephen M. Cameron
2014-01-15 22:39 ` [PATCH 34/41] hpsa: update source file copyrights Stephen M. Cameron
2014-01-15 22:39 ` [PATCH 35/41] hpsa: add controller base data-at-rest encryption compatibility ioaccel2 Stephen M. Cameron
2014-01-15 22:39 ` [PATCH 36/41] hpsa: when switching out of accel mode await only accel command completions Stephen M. Cameron
2014-01-15 22:39 ` [PATCH 37/41] hpsa: only do device rescan for certain events Stephen M. Cameron
2014-01-15 22:39 ` [PATCH 38/41] hpsa: improve error messages for driver initiated commands Stephen M. Cameron
2014-01-16 8:42 ` Hannes Reinecke
2014-01-16 16:14 ` scameron
2014-01-15 22:39 ` [PATCH 39/41] hpsa add sysfs debug switch for raid map debugging messages Stephen M. Cameron
2014-01-15 22:39 ` [PATCH 40/41] pci: add HP/3PAR vendor id to pci_ids.h Stephen M. Cameron
2014-01-15 22:39 ` [PATCH 41/41] hpsa: Add support for a few HP Storage controllers Stephen M. Cameron
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=20140115223623.5061.58007.stgit@beardog.cce.hp.com \
--to=scameron@beardog.cce.hp.com \
--cc=jbottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew.gates@hp.com \
--cc=mikem@beardog.cce.hp.com \
--cc=scott.teel@hp.com \
--cc=stephenmcameron@gmail.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