mvsas: add support for Task collector mode and fixed relative bugs
PATCH 2/2 mvsas: add support for Task collector mode and fixed relative bugs
From: Xiangliang Yu <[email protected]>
1.Add support for Task collector mode.
2.Fixed relative collector mode bug:
- I/O failed when disks is on two ports
- system hang when hotplug disk
- system hang when unplug disk during run IO
3.Unlock ap->lock within .lldd_execute_task for direct mode to improve performance
--- drivers/scsi/mvsas/Kconfig | 1 + drivers/scsi/mvsas/Makefile | 1 + drivers/scsi/mvsas/mv_64xx.c | 1 + drivers/scsi/mvsas/mv_64xx.h | 1 + drivers/scsi/mvsas/mv_94xx.c | 1 + drivers/scsi/mvsas/mv_94xx.h | 1 + drivers/scsi/mvsas/mv_chips.h | 1 + drivers/scsi/mvsas/mv_defs.h | 1 + drivers/scsi/mvsas/mv_init.c | 47 +++-- drivers/scsi/mvsas/mv_sas.c | 385 ++++++++++++++++++++++++++-------------- drivers/scsi/mvsas/mv_sas.h | 8 + 11 files changed, 295 insertions(+), 153 deletions(-)
drivers/scsi/mvsas/Kconfig +1 -0
@@ -3,6 +3,7 @@ # # Copyright 2007 Red Hat, Inc. # Copyright 2008 Marvell. <[email protected]> +# Copyright 2009-20011 Marvell. <[email protected]> # # This file is licensed under GPLv2. #
drivers/scsi/mvsas/Makefile +1 -0
@@ -3,6 +3,7 @@ # # Copyright 2007 Red Hat, Inc. # Copyright 2008 Marvell. <[email protected]> +# Copyright 2009-2011 Marvell. <[email protected]> # # This file is licensed under GPLv2. #
drivers/scsi/mvsas/mv_64xx.c +1 -0
@@ -3,6 +3,7 @@* * Copyright 2007 Red Hat, Inc. * Copyright 2008 Marvell. <[email protected]> +* Copyright 2009-2011 Marvell. <[email protected]> * * This file is licensed under GPLv2. *
drivers/scsi/mvsas/mv_64xx.h +1 -0
@@ -3,6 +3,7 @@* * Copyright 2007 Red Hat, Inc. * Copyright 2008 Marvell. <[email protected]> +* Copyright 2009-2011 Marvell. <[email protected]> * * This file is licensed under GPLv2. *
drivers/scsi/mvsas/mv_94xx.c +1 -0
@@ -3,6 +3,7 @@* * Copyright 2007 Red Hat, Inc. * Copyright 2008 Marvell. <[email protected]> +* Copyright 2009-2011 Marvell. <[email protected]> * * This file is licensed under GPLv2. *
drivers/scsi/mvsas/mv_94xx.h +1 -0
@@ -3,6 +3,7 @@* * Copyright 2007 Red Hat, Inc. * Copyright 2008 Marvell. <[email protected]> +* Copyright 2009-2011 Marvell. <[email protected]> * * This file is licensed under GPLv2. *
drivers/scsi/mvsas/mv_chips.h +1 -0
@@ -3,6 +3,7 @@* * Copyright 2007 Red Hat, Inc. * Copyright 2008 Marvell. <[email protected]> +* Copyright 2009-2011 Marvell. <[email protected]> * * This file is licensed under GPLv2. *
drivers/scsi/mvsas/mv_defs.h +1 -0
@@ -3,6 +3,7 @@* * Copyright 2007 Red Hat, Inc. * Copyright 2008 Marvell. <[email protected]> +* Copyright 2009-2011 Marvell. <[email protected]> * * This file is licensed under GPLv2. *
drivers/scsi/mvsas/mv_init.c +29 -18
104 lines not on this page · raw message
drivers/scsi/mvsas/mv_sas.c +249 -134
445 lines not on this page · raw message
drivers/scsi/mvsas/mv_sas.h +8 -0
@@ -3,6 +3,7 @@* * Copyright 2007 Red Hat, Inc. * Copyright 2008 Marvell. <[email protected]> +* Copyright 2009-2011 Marvell. <[email protected]> * * This file is licensed under GPLv2. *
@@ -67,6 +68,7 @@ extern struct mvs_tgt_initiator mvs_tgt;extern struct mvs_info *tgt_mvi;extern const struct mvs_dispatch mvs_64xx_dispatch;extern const struct mvs_dispatch mvs_94xx_dispatch; +extern struct kmem_cache *mvs_task_list_cache;#define DEV_IS_EXPANDER (type) \ ((type == EDGE_DEV) || (type == FANOUT_DEV))
@@ -341,6 +343,7 @@ struct mvs_info {dma_addr_t bulk_buffer_dma;#define TRASH_BUCKET_SIZE 0x20000#endif +void *dma_pool;struct mvs_slot_info slot_info[0 ]; };
@@ -367,6 +370,11 @@ struct mvs_task_exec_info {int n_elem; }; +struct mvs_task_list { +struct sas_task *task; +struct list_head list; +}; +/******************** function prototype *********************/ void mvs_get_sas_addr (void *buf,u32 buflen);
Signature · 1 line
1.7.4.4
Quoted 8 lines · On Tue, Apr 26, 2011 at 6:36 AM, <[email protected]> wrote:
From: Xiangliang Yu <[email protected]>
1.Add support for Task collector mode.
2.Fixed relative collector mode bug:
- I/O failed when disks is on two ports
- system hang when hotplug disk
- system hang when unplug disk during run IO
3.Unlockap->lockwithin .lldd_execute_task for direct mode to improve performance
Can you share more details about the performance impact? Seems like this should be made generic across all libsas drivers... see below.
[..]
Quoted 6 lines
drivers/scsi/mvsas/mv_sas.c +6
-0+static int mvs_task_exec (struct sas_task *task,const int num,gfp_t gfp_flags, + struct completion *completion, int is_tmf, + struct mvs_tmf_task *tmf) +{ + struct domain_device *dev = task->dev; + struct mvs_info *mvi = NULL;
drivers/scsi/mvsas/mv_sas.c static int mvs_task_prep_ssp(struct mvs_info *mvi, · line 1062
Quoted 10 lines
drivers/scsi/mvsas/mv_sas.c +10
-0+ u32 rc = 0; + u32 pass = 0; + unsigned long flags = 0; + + mvi = ((struct mvs_device *)task->dev->lldd_dev)->mvi_info; + + if ((dev->dev_type == SATA_DEV) && (dev->sata_dev.ap != NULL)) + spin_unlock_irq(dev->sata_dev.ap->lock); + + spin_lock_irqsave(&mvi->lock, flags);
This is fine in current code, but isn't it dangerous to assume that libata is the only agent that might have interrupts disabled? Especially confusing since this code turns around and uses spin_lock_irqsave() as the very next step, which leaves a casual reader wondering what the appropriate lock level is.
Any objections to unifying this lock management in libsas to relieve drivers of implementing this differently/incorrectly? I'll send a patch.
Also, we have seen the dev->sata_dev.ap == NULL problem as well. Have not fully tracked it down (are we issuing i/o before sas_ata_init_host_and_port?). But again, shouldn't libsas be making guarantees about the state of the sata device? At least pm8001 and current isci still get this wrong. And it would be better to fix it once for all drivers.
--
Dan
Quoted 6 lines
Quoted 3 lines
From: Xiangliang Yu <[email protected]>
3.Unlock
ap->lockwithin .lldd_execute_task for direct mode to improve performanceCan you share more details about the performance impact? Seems like this should be made generic across all libsas drivers... see below.
The direct mode should be change to task collector mode. Sorry, this is my fault. We can use interrupt tasklet by unlocking ap->lock within .lldd_execute_task, but interrupt tasklet has some issue, and I'm debugging it.