Skip to contentSkip to conversation

libsas: export sas_alloc_task()

PATCH In review Dan Williams 4 participants 13 messages Jul 30, 2011 – Sep 7, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 libsas: export sas_alloc_task()

Now that isci has added a 3rd open coded user of this functionality just share the libsas version.

---

Updated with Jack's ack, and now includes the removal of the open-coded sas_alloc_task in isci.

 drivers/scsi/isci/task.c         |   29 +++--------------------------
 drivers/scsi/libsas/sas_init.c   |   30 +++++++++++++++++++++++++++---
 drivers/scsi/mvsas/mv_sas.c      |   29 +++--------------------------
 drivers/scsi/pm8001/pm8001_sas.c |   38 ++++++--------------------------------
 include/scsi/libsas.h            |   26 ++------------------------
 5 files changed, 41 insertions(+), 111 deletions(-)
drivers/scsi/isci/task.c +3 -26
index d6bcdd0..e2d9418 100644
@@ -1345,29 +1345,6 @@ static void isci_smp_task_done(struct sas_task *task)
 	complete(&task->completion);
 }
 
-static struct sas_task *isci_alloc_task(void)
-{
-	struct sas_task *task = kzalloc(sizeof(*task), GFP_KERNEL);
-
-	if (task) {
-		INIT_LIST_HEAD(&task->list);
-		spin_lock_init(&task->task_state_lock);
-		task->task_state_flags = SAS_TASK_STATE_PENDING;
-		init_timer(&task->timer);
-		init_completion(&task->completion);
-	}
-
-	return task;
-}
-
-static void isci_free_task(struct isci_host *ihost, struct sas_task  *task)
-{
-	if (task) {
-		BUG_ON(!list_empty(&task->list));
-		kfree(task);
-	}
-}
-
 static int isci_smp_execute_task(struct isci_host *ihost,
 				 struct domain_device *dev, void *req,
 				 int req_size, void *resp, int resp_size)
@@ -1376,7 +1353,7 @@ static int isci_smp_execute_task(struct isci_host *ihost,
 	struct sas_task *task = NULL;
 
 	for (retry = 0; retry < 3; retry++) {
-		task = isci_alloc_task();
+		task = sas_alloc_task(GFP_KERNEL);
 		if (!task)
 			return -ENOMEM;
 
@@ -1439,13 +1416,13 @@ static int isci_smp_execute_task(struct isci_host *ihost,
 				SAS_ADDR(dev->sas_addr),
 				task->task_status.resp,
 				task->task_status.stat);
-			isci_free_task(ihost, task);
+			sas_free_task(task);
 			task = NULL;
 		}
 	}
 ex_err:
 	BUG_ON(retry == 3 && task != NULL);
-	isci_free_task(ihost, task);
+	sas_free_task(task);
 	return res;
 }
 
drivers/scsi/libsas/sas_init.c +27 -3
index 2dc5534..dd56ea8 100644
@@ -37,7 +37,32 @@
 
 #include "../scsi_sas_internal.h"
 
-struct kmem_cache *sas_task_cache;
+static struct kmem_cache *sas_task_cache;
+
+struct sas_task *sas_alloc_task(gfp_t flags)
+{
+	struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags);
+
+	if (task) {
+		INIT_LIST_HEAD(&task->list);
+		spin_lock_init(&task->task_state_lock);
+		task->task_state_flags = SAS_TASK_STATE_PENDING;
+		init_timer(&task->timer);
+		init_completion(&task->completion);
+	}
+
+	return task;
+}
+EXPORT_SYMBOL_GPL(sas_alloc_task);
+
+void sas_free_task(struct sas_task *task)
+{
+	if (task) {
+		BUG_ON(!list_empty(&task->list));
+		kmem_cache_free(sas_task_cache, task);
+	}
+}
+EXPORT_SYMBOL_GPL(sas_free_task);
 
 /*------------ SAS addr hash -----------*/
 void sas_hash_addr(u8 *hashed, const u8 *sas_addr)
@@ -293,8 +318,7 @@ EXPORT_SYMBOL_GPL(sas_domain_release_transport);
 
 static int __init sas_class_init(void)
 {
-	sas_task_cache = kmem_cache_create("sas_task", sizeof(struct sas_task),
-					   0, SLAB_HWCACHE_ALIGN, NULL);
+	sas_task_cache = KMEM_CACHE(sas_task, SLAB_HWCACHE_ALIGN);
 	if (!sas_task_cache)
 		return -ENOMEM;
 
drivers/scsi/mvsas/mv_sas.c +3 -26
index 0ef2742..7921b61 100644
@@ -1518,28 +1518,6 @@ void mvs_dev_gone(struct domain_device *dev)
 	mvs_dev_gone_notify(dev);
 }
 
-static  struct sas_task *mvs_alloc_task(void)
-{
-	struct sas_task *task = kzalloc(sizeof(struct sas_task), GFP_KERNEL);
-
-	if (task) {
-		INIT_LIST_HEAD(&task->list);
-		spin_lock_init(&task->task_state_lock);
-		task->task_state_flags = SAS_TASK_STATE_PENDING;
-		init_timer(&task->timer);
-		init_completion(&task->completion);
-	}
-	return task;
-}
-
-static  void mvs_free_task(struct sas_task *task)
-{
-	if (task) {
-		BUG_ON(!list_empty(&task->list));
-		kfree(task);
-	}
-}
-
 static void mvs_task_done(struct sas_task *task)
 {
 	if (!del_timer(&task->timer))
@@ -1564,7 +1542,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
 	struct sas_task *task = NULL;
 
 	for (retry = 0; retry < 3; retry++) {
-		task = mvs_alloc_task();
+		task = sas_alloc_task(GFP_KERNEL);
 		if (!task)
 			return -ENOMEM;
 
@@ -1622,15 +1600,14 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
 				    SAS_ADDR(dev->sas_addr),
 				    task->task_status.resp,
 				    task->task_status.stat);
-			mvs_free_task(task);
+			sas_free_task(task);
 			task = NULL;
 
 		}
 	}
 ex_err:
 	BUG_ON(retry == 3 && task != NULL);
-	if (task != NULL)
-		mvs_free_task(task);
+	sas_free_task(task);
 	return res;
 }
 
drivers/scsi/pm8001/pm8001_sas.c +6 -32
index 6ae059e..7dbbf8b 100644
@@ -669,30 +669,6 @@ int pm8001_dev_found(struct domain_device *dev)
 	return pm8001_dev_found_notify(dev);
 }
 
-/**
-  * pm8001_alloc_task - allocate a task structure for TMF
-  */
-static struct sas_task *pm8001_alloc_task(void)
-{
-	struct sas_task *task = kzalloc(sizeof(*task), GFP_KERNEL);
-	if (task) {
-		INIT_LIST_HEAD(&task->list);
-		spin_lock_init(&task->task_state_lock);
-		task->task_state_flags = SAS_TASK_STATE_PENDING;
-		init_timer(&task->timer);
-		init_completion(&task->completion);
-	}
-	return task;
-}
-
-static void pm8001_free_task(struct sas_task *task)
-{
-	if (task) {
-		BUG_ON(!list_empty(&task->list));
-		kfree(task);
-	}
-}
-
 static void pm8001_task_done(struct sas_task *task)
 {
 	if (!del_timer(&task->timer))
@@ -728,7 +704,7 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev,
 	struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev);
 
 	for (retry = 0; retry < 3; retry++) {
-		task = pm8001_alloc_task();
+		task = sas_alloc_task(GFP_KERNEL);
 		if (!task)
 			return -ENOMEM;
 
@@ -789,14 +765,13 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev,
 				SAS_ADDR(dev->sas_addr),
 				task->task_status.resp,
 				task->task_status.stat));
-			pm8001_free_task(task);
+			sas_free_task(task);
 			task = NULL;
 		}
 	}
 ex_err:
 	BUG_ON(retry == 3 && task != NULL);
-	if (task != NULL)
-		pm8001_free_task(task);
+	sas_free_task(task);
 	return res;
 }
 
@@ -811,7 +786,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
 	struct sas_task *task = NULL;
 
 	for (retry = 0; retry < 3; retry++) {
-		task = pm8001_alloc_task();
+		task = sas_alloc_task(GFP_KERNEL);
 		if (!task)
 			return -ENOMEM;
 
@@ -864,14 +839,13 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
 				SAS_ADDR(dev->sas_addr),
 				task->task_status.resp,
 				task->task_status.stat));
-			pm8001_free_task(task);
+			sas_free_task(task);
 			task = NULL;
 		}
 	}
 ex_err:
 	BUG_ON(retry == 3 && task != NULL);
-	if (task != NULL)
-		pm8001_free_task(task);
+	sas_free_task(task);
 	return res;
 }
 
include/scsi/libsas.h +2 -24
index ee86606..2517254 100644
@@ -555,36 +555,14 @@ struct sas_task {
 	struct work_struct abort_work;
 };
 
-extern struct kmem_cache *sas_task_cache;
-
 #define SAS_TASK_STATE_PENDING      1
 #define SAS_TASK_STATE_DONE         2
 #define SAS_TASK_STATE_ABORTED      4
 #define SAS_TASK_NEED_DEV_RESET     8
 #define SAS_TASK_AT_INITIATOR       16
 
-static inline struct sas_task *sas_alloc_task(gfp_t flags)
-{
-	struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags);
-
-	if (task) {
-		INIT_LIST_HEAD(&task->list);
-		spin_lock_init(&task->task_state_lock);
-		task->task_state_flags = SAS_TASK_STATE_PENDING;
-		init_timer(&task->timer);
-		init_completion(&task->completion);
-	}
-
-	return task;
-}
-
-static inline void sas_free_task(struct sas_task *task)
-{
-	if (task) {
-		BUG_ON(!list_empty(&task->list));
-		kmem_cache_free(sas_task_cache, task);
-	}
-}
+extern struct sas_task *sas_alloc_task(gfp_t flags);
+extern void sas_free_task(struct sas_task *task);
 
 struct sas_domain_function_template {
 	/* The class calls these to notify the LLDD of an event. */
#1 lore raw

Re: [PATCH] [SCSI]: Allow expander T-T attachments

Since Luben's patch on July 28th 2011 went nowhere, as there was an unanswered question regarding the future-proofing that Luben added in. I decided to submit a simplified focussed patch we have been using for the past year testing with the Xyratex enclosures (5U84, 2U24, chained with *many* peered expanders with Table to Table routing) that should hopefully expedite things and will be on hot standby to refactor as requested (including tossing this baby and refactoring Luben's patch should he be too busy, no hair off my back)

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

NB: this patch (and Luben's independent patch) results in an ABI break as the structures change 'shape' and thus result in a different set of libsas export signatures. I have an internal patch I use that preserves the structure shapes and thus the ABI; but would be considered inappropriate for the pristine trees. Said alternate patch would work fine for a Distribution tree where ABI concerns are an issue.

Checkpatch.pl reports clean.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>
 drivers/scsi/libsas/sas_expander.c |    6 +++++-
 include/scsi/libsas.h              |    1 +
 include/scsi/sas.h                 |    6 ++++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c
--- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c 2011-08-31
08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-08-31 09:07:31.000000000 -0400

@@ -331,6 +331,7 @@
dev->ex_dev.num_phys = min(rg->num_phys, (u8)MAX_EXPANDER_PHYS); dev->ex_dev.conf_route_table = rg->conf_route_table; dev->ex_dev.configuring = rg->configuring;
+ dev->ex_dev.table_to_table = rg->table_to_table;
memcpy(dev->ex_dev.enclosure_logical_id,
rg->enclosure_logical_id, 8);
}

@@ -1239,7 +1240,10 @@
res = -ENODEV;
}
} else if (parent_phy->routing_attr ==
TABLE_ROUTING &&
- child_phy->routing_attr !=
SUBTRACTIVE_ROUTING) {
+ child_phy->routing_attr !=
+ SUBTRACTIVE_ROUTING &&
+ (child_ex->table_to_table == 0 ||
+ child_phy->routing_attr !=
TABLE_ROUTING)) {
sas_print_parent_topology_bug(child,
parent_phy, child_phy);
res = -ENODEV;
}
diff -ru scsi-misc-2.6/include/scsi/libsas.h scsi-misc-2.6.new/include/scsi/libsas.h
--- scsi-misc-2.6/include/scsi/libsas.h 2011-08-31 08:32:22.000000000
-0400
+++ scsi-misc-2.6.new/include/scsi/libsas.h 2011-08-31
09:07:31.000000000 -0400
@@ -144,6 +144,7 @@

 	u8     num_phys;
 	u8     configuring:1;
 	u8     conf_route_table:1;
+	u8     table_to_table:1;
 	u8     enclosure_logical_id[8];

struct ex_phy *ex_phy;
diff -ru scsi-misc-2.6/include/scsi/sas.h
scsi-misc-2.6.new/include/scsi/sas.h
--- scsi-misc-2.6/include/scsi/sas.h 2011-08-31 08:32:22.000000000
-0400
+++ scsi-misc-2.6.new/include/scsi/sas.h 2011-08-31
09:07:31.000000000 -0400
@@ -341,7 +341,8 @@

 	u8      conf_route_table:1;
 	u8      configuring:1;
-	u8      _r_b:6;
+	u8      _r_b:5;
+	u8      table_to_table:1;

u8 _r_c;

@@ -528,7 +529,8 @@
u8 _r_a;
u8 num_phys;

-	u8      _r_b:6;
+	u8      table_to_table:1;
+	u8      _r_b:5;
 	u8      configuring:1;
 	u8      conf_route_table:1;

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________

 drivers/scsi/libsas/sas_expander.c |    6 +++++-
 include/scsi/libsas.h              |    1 +
 include/scsi/sas.h                 |    6 ++++--
 3 files changed, 10 insertions(+), 3 deletions(-)
drivers/scsi/libsas/sas_expander.c +5 -1
diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c
@@ -331,6 +331,7 @@
 	dev->ex_dev.num_phys = min(rg->num_phys, (u8)MAX_EXPANDER_PHYS);
 	dev->ex_dev.conf_route_table = rg->conf_route_table;
 	dev->ex_dev.configuring = rg->configuring;
+	dev->ex_dev.table_to_table = rg->table_to_table;
 	memcpy(dev->ex_dev.enclosure_logical_id, rg->enclosure_logical_id, 8);
 }
 
@@ -1239,7 +1240,10 @@
 					res = -ENODEV;
 				}
 			} else if (parent_phy->routing_attr == TABLE_ROUTING &&
-				   child_phy->routing_attr != SUBTRACTIVE_ROUTING) {
+				   child_phy->routing_attr !=
+					SUBTRACTIVE_ROUTING &&
+				   (child_ex->table_to_table == 0 ||
+				    child_phy->routing_attr != TABLE_ROUTING)) {
 				sas_print_parent_topology_bug(child, parent_phy, child_phy);
 				res = -ENODEV;
 			}
include/scsi/libsas.h +1 -0
diff -ru scsi-misc-2.6/include/scsi/libsas.h scsi-misc-2.6.new/include/scsi/libsas.h
@@ -144,6 +144,7 @@
 	u8     num_phys;
 	u8     configuring:1;
 	u8     conf_route_table:1;
+	u8     table_to_table:1;
 	u8     enclosure_logical_id[8];
 
 	struct ex_phy *ex_phy;
include/scsi/sas.h +4 -2
diff -ru scsi-misc-2.6/include/scsi/sas.h scsi-misc-2.6.new/include/scsi/sas.h
@@ -341,7 +341,8 @@
 
 	u8      conf_route_table:1;
 	u8      configuring:1;
-	u8      _r_b:6;
+	u8      _r_b:5;
+	u8      table_to_table:1;
 
 	u8      _r_c;
 
@@ -528,7 +529,8 @@
 	u8      _r_a;
 	u8      num_phys;
 
-	u8      _r_b:6;
+	u8      table_to_table:1;
+	u8      _r_b:5;
 	u8      configuring:1;
 	u8      conf_route_table:1;
 
#2 lore raw

Re: [PATCH] [SCSI]: Allow expander T-T attachments

----- Original Message -----

Quoted 8 lines

From: Mark Salyzyn <[email protected]>
To: [email protected]
Cc: Luben Tuikov <[email protected]>; Darrick J Wong <[email protected]>; James Bottomley <[email protected]>
Sent: Wednesday, August 31, 2011 6:44 AM
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

Since Luben's patch on July 28th 2011 went nowhere, as there was an unanswered question regarding the future-proofing that Luben added in.

Are you saying that the patch I posted,
http://marc.info/?t=131182720200001&r=1&w=2, didn't go in because I didn't entertain Bottomley's unrelated question therein? Or are you saying that it did go in based on TECHNICAL CONTENT? I.e. it was buggy, or wrong, etc?

Quoted 1 line

I decided to submit a simplified focussed patch we have been using for the

By "simplified, focused" you mean one which doesn't define 2 out of 3 flags of REPORT GENERAL SMP response?

Quoted 5 lines

past year testing with the Xyratex enclosures (5U84, 2U24, chained with *many* peered expanders with Table to Table routing) that should hopefully expedite things and will be on hot standby to refactor as requested (including tossing this baby and refactoring Luben's patch should he be too busy, no hair off my back)

Now onto technical matter:
1) I'd call the flag "t2t_supp" to a) fit in with the rest of the spirit of the code as other fields are also called "_supp", and to b) actually convey the meaning of "table-to-table supported. Your naming of this flag "table_to_table" implicitly means "table to table supported".
2) Please also add the debug output as my patch did. People will be wondering what went wrong if their domain didn't work, and the debug print in my original patch would tell them that.
3) You don't check that the parent also supports T2T. That's a bug.
4) Your patch logically does this: P=T && C!=S && (C is T2T || C!=T), which after expansion is equivalent to:
(P==T) && ((C!=S && C!=T2T) || C==D) ==> fail
where the outmost parens are an if (). Albeit from not being entirely correct, it also obfuscates what is being sought after. I chose to use the negation for successful check to make it more clear:
(P==T) && (C==S || (C==T && P==T2T && C==T2T)) ==> success, Translates to
"If parent phy is T, and If child phy is S OR (child is T and child and parent both support table to table) then we're okay, else report an error." Which is: T<-S is okay, and T<-T is okay if both parent and child support it.

Alternatively, Bottomley could just add my patch upstream.

Quoted 91 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

NB: this patch (and Luben's independent patch) results in an ABI break as the structures change 'shape' and thus result in a different set of libsas export signatures. I have an internal patch I use that preserves the structure shapes and thus the ABI; but would be considered inappropriate for the pristine trees. Said alternate patch would work fine for a Distribution tree where ABI concerns are an issue.

Checkpatch.pl reports clean.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>

drivers/scsi/libsas/sas_expander.c |    6 +++++-
include/scsi/libsas.h              |    1 +
include/scsi/sas.h                |    6 ++++--

3 files changed, 10 insertions(+), 3 deletions(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c --- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c    2011-08-31 08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-08-31 09:07:31.000000000 -0400
drivers/scsi/libsas/sas_expander.c +1 -0
@@ -331,6 +331,7 @@
     dev->ex_dev.num_phys = min(rg->num_phys, (u8)MAX_EXPANDER_PHYS);
     dev->ex_dev.conf_route_table = rg->conf_route_table;
     dev->ex_dev.configuring = rg->configuring;
+    dev->ex_dev.table_to_table = rg->table_to_table;
     memcpy(dev->ex_dev.enclosure_logical_id,
 rg->enclosure_logical_id, 8);
 }
@@ -1239,7 +1240,10 @@
                     res = -ENODEV;
                 }
             } else if (parent_phy->routing_attr ==

TABLE_ROUTING &&
-                  child_phy->routing_attr != SUBTRACTIVE_ROUTING) {
+                  child_phy->routing_attr !=
+                    SUBTRACTIVE_ROUTING &&
+                  (child_ex->table_to_table == 0 ||
+                    child_phy->routing_attr != TABLE_ROUTING)) {
                sas_print_parent_topology_bug(child, parent_phy, child_phy);
                res = -ENODEV;
            }
diff -ru scsi-misc-2.6/include/scsi/libsas.h scsi-misc-2.6.new/include/scsi/libsas.h
--- scsi-misc-2.6/include/scsi/libsas.h    2011-08-31 08:32:22.000000000 -0400
+++ scsi-misc-2.6.new/include/scsi/libsas.h    2011-08-31 09:07:31.000000000 -0400

include/scsi/libsas.h +1 -0
@@ -144,6 +144,7 @@
     u8     num_phys;
     u8     configuring:1;
     u8     conf_route_table:1;
+    u8     table_to_table:1;
     u8     enclosure_logical_id[8];
 
     struct ex_phy *ex_phy;

diff -ru scsi-misc-2.6/include/scsi/sas.h scsi-misc-2.6.new/include/scsi/sas.h
--- scsi-misc-2.6/include/scsi/sas.h    2011-08-31 08:32:22.000000000 -0400
+++ scsi-misc-2.6.new/include/scsi/sas.h    2011-08-31 09:07:31.000000000 -0400

include/scsi/sas.h +2 -1
@@ -341,7 +341,8 @@
 
     u8      conf_route_table:1;
     u8      configuring:1;
-    u8      _r_b:6;
+    u8      _r_b:5;
+    u8      table_to_table:1;
 
     u8      _r_c;
 

include/scsi/sas.h line 536

Quoted 9 lines
include/scsi/sas.h +2 -1
@@ -528,7 +529,8 @@
     u8      _r_a;
     u8      num_phys;
 
-    u8      _r_b:6;
+    u8      table_to_table:1;
+    u8      _r_b:5;
     u8      configuring:1;
     u8      conf_route_table:1;
 

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

#3 lore raw

RE: [PATCH] [SCSI]: Allow expander T-T attachments

We will need James to chime in why your patch did not go in. My assumption is the lack of response to his question left it in limbo.

The likely modification to your patch would be to remove all the unused added flags rather than staking out the territory.

What kind of testing was involved in your patch? I have not merged yours in here to try it out on our enclosures. Either way, I want to see some movement; James any directions?

Sincerely -- Mark Salyzyn

-----Original Message-----
From: Luben Tuikov [mailto:[email protected]]
Sent: Wednesday, August 31, 2011 1:43 PM
To: Mark Salyzyn; [email protected]
Cc: Darrick J Wong; James Bottomley
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

----- Original Message -----

Quoted 8 lines

From: Mark Salyzyn <[email protected]>
To: [email protected]
Cc: Luben Tuikov <[email protected]>; Darrick J Wong <[email protected]>; James Bottomley <[email protected]>
Sent: Wednesday, August 31, 2011 6:44 AM
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

Since Luben's patch on July 28th 2011 went nowhere, as there was an unanswered question regarding the future-proofing that Luben added in.

Are you saying that the patch I posted,
http://marc.info/?t=131182720200001&r=1&w=2, didn't go in because I didn't entertain Bottomley's unrelated question therein? Or are you saying that it did go in based on TECHNICAL CONTENT? I.e. it was buggy, or wrong, etc?

Quoted 1 line

I decided to submit a simplified focussed patch we have been using for the

By "simplified, focused" you mean one which doesn't define 2 out of 3 flags of REPORT GENERAL SMP response?

Quoted 5 lines

past year testing with the Xyratex enclosures (5U84, 2U24, chained with *many* peered expanders with Table to Table routing) that should hopefully expedite things and will be on hot standby to refactor as requested (including tossing this baby and refactoring Luben's patch should he be too busy, no hair off my back)

Now onto technical matter:
1) I'd call the flag "t2t_supp" to a) fit in with the rest of the spirit of the code as other fields are also called "_supp", and to b) actually convey the meaning of "table-to-table supported. Your naming of this flag "table_to_table" implicitly means "table to table supported".
2) Please also add the debug output as my patch did. People will be wondering what went wrong if their domain didn't work, and the debug print in my original patch would tell them that.
3) You don't check that the parent also supports T2T. That's a bug.
4) Your patch logically does this: P=T && C!=S && (C is T2T || C!=T), which after expansion is equivalent to:
(P==T) && ((C!=S && C!=T2T) || C==D) ==> fail
where the outmost parens are an if (). Albeit from not being entirely correct, it also obfuscates what is being sought after. I chose to use the negation for successful check to make it more clear:
(P==T) && (C==S || (C==T && P==T2T && C==T2T)) ==> success, Translates to
"If parent phy is T, and If child phy is S OR (child is T and child and parent both support table to table) then we're okay, else report an error." Which is: T<-S is okay, and T<-T is okay if both parent and child support it.

Alternatively, Bottomley could just add my patch upstream.

Quoted 91 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

NB: this patch (and Luben's independent patch) results in an ABI break as the structures change 'shape' and thus result in a different set of libsas export signatures. I have an internal patch I use that preserves the structure shapes and thus the ABI; but would be considered inappropriate for the pristine trees. Said alternate patch would work fine for a Distribution tree where ABI concerns are an issue.

Checkpatch.pl reports clean.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>

drivers/scsi/libsas/sas_expander.c |    6 +++++-
include/scsi/libsas.h              |    1 +
include/scsi/sas.h                |    6 ++++--

3 files changed, 10 insertions(+), 3 deletions(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c --- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c    2011-08-31 08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-08-31 09:07:31.000000000 -0400
drivers/scsi/libsas/sas_expander.c +1 -0
@@ -331,6 +331,7 @@
     dev->ex_dev.num_phys = min(rg->num_phys, (u8)MAX_EXPANDER_PHYS);
     dev->ex_dev.conf_route_table = rg->conf_route_table;
     dev->ex_dev.configuring = rg->configuring;
+    dev->ex_dev.table_to_table = rg->table_to_table;
     memcpy(dev->ex_dev.enclosure_logical_id,
 rg->enclosure_logical_id, 8);
 }
@@ -1239,7 +1240,10 @@
                     res = -ENODEV;
                 }
             } else if (parent_phy->routing_attr ==

TABLE_ROUTING &&
-                  child_phy->routing_attr != SUBTRACTIVE_ROUTING) {
+                  child_phy->routing_attr !=
+                    SUBTRACTIVE_ROUTING &&
+                  (child_ex->table_to_table == 0 ||
+                    child_phy->routing_attr != TABLE_ROUTING)) {
                sas_print_parent_topology_bug(child, parent_phy, child_phy);
                res = -ENODEV;
            }
diff -ru scsi-misc-2.6/include/scsi/libsas.h scsi-misc-2.6.new/include/scsi/libsas.h
--- scsi-misc-2.6/include/scsi/libsas.h    2011-08-31 08:32:22.000000000 -0400
+++ scsi-misc-2.6.new/include/scsi/libsas.h    2011-08-31 09:07:31.000000000 -0400

include/scsi/libsas.h +1 -0
@@ -144,6 +144,7 @@
     u8     num_phys;
     u8     configuring:1;
     u8     conf_route_table:1;
+    u8     table_to_table:1;
     u8     enclosure_logical_id[8];
 
     struct ex_phy *ex_phy;

diff -ru scsi-misc-2.6/include/scsi/sas.h scsi-misc-2.6.new/include/scsi/sas.h
--- scsi-misc-2.6/include/scsi/sas.h    2011-08-31 08:32:22.000000000 -0400
+++ scsi-misc-2.6.new/include/scsi/sas.h    2011-08-31 09:07:31.000000000 -0400

include/scsi/sas.h +2 -1
@@ -341,7 +341,8 @@
 
     u8      conf_route_table:1;
     u8      configuring:1;
-    u8      _r_b:6;
+    u8      _r_b:5;
+    u8      table_to_table:1;
 
     u8      _r_c;
 

include/scsi/sas.h line 536

Quoted 9 lines
include/scsi/sas.h +2 -1
@@ -528,7 +529,8 @@
     u8      _r_a;
     u8      num_phys;
 
-    u8      _r_b:6;
+    u8      table_to_table:1;
+    u8      _r_b:5;
     u8      configuring:1;
     u8      conf_route_table:1;
 

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________

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

#8 lore raw

PATCH 1/1 : libsas failure to revalidate domain for anything but the first expander child.

In reply to Mark Salyzyn

In an enclosure model where there are chaining expanders to a large body of storage, it was discovered that libsas, responding to a broadcast event change, would only revalidate the domain of first child expander in the list.

The issue is that the pointer value to the discovered source device was used to break out of the loop, rather than the content of the pointer.

This still remains non-compliant as the revalidate domain code is supposed to loop through all child expanders, and not stop at the first one it finds that reports a change count. However, the design of this routine does not allow multiple device discoveries and that would be a more complicated set of patches reserved for another day. We are fixing the glaring bug rather than refactoring the code.

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

Checkpatch.pl reports clean. Patch applies cleanly to a WIDE variety of kernels up to latest.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>
 sas_expander.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c
--- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c 2011-08-31
08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-09-01 08:57:55.000000000 -0400

@@ -1721,7 +1721,7 @@
list_for_each_entry(ch, &ex->children, siblings) {
if (ch->dev_type == EDGE_DEV || ch->dev_type ==
FANOUT_DEV) {
res = sas_find_bcast_dev(ch, src_dev);
- if (src_dev)
+ if (*src_dev)
return res;
}
}

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>
 sas_expander.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libsas/sas_expander.c +1 -1
diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c
@@ -1721,7 +1721,7 @@
 	list_for_each_entry(ch, &ex->children, siblings) {
 		if (ch->dev_type == EDGE_DEV || ch->dev_type == FANOUT_DEV) {
 			res = sas_find_bcast_dev(ch, src_dev);
-			if (src_dev)
+			if (*src_dev)
 				return res;
 		}
 	}
maintainer
#4 lore raw

RE: [PATCH] [SCSI]: Allow expander T-T attachments

In reply to Mark Salyzyn
Quoted 2 lines · Mark Salyzyn

We will need James to chime in why your patch did not go in. My assumption is the lack of response to his question left it in limbo.

That's a good assumption. A maintainers list folder is usually sorted by thread and by activity. I mark patches for inclusion, but if a thread is expecting a reply I don't do anything since it comes back to the top again once there's activity on it.

Quoted 2 lines

The likely modification to your patch would be to remove all the unused added flags rather than staking out the territory.

Well, yes, but the question is broader than that. In theory we can't support SAS2.0 expanders until we support all of their features. Table to Table routing is one, but self configuration is another. If there are no current self configuring expanders, I'm OK with just doing table to table ... but the extra bits made me wonder.

James

Quoted 179 lines

What kind of testing was involved in your patch? I have not merged yours in here to try it out on our enclosures. Either way, I want to see some movement; James any directions?

Sincerely -- Mark Salyzyn

-----Original Message-----
From: Luben Tuikov [mailto:[email protected]]
Sent: Wednesday, August 31, 2011 1:43 PM
To: Mark Salyzyn; [email protected]
Cc: Darrick J Wong; James Bottomley
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

----- Original Message -----

Quoted 8 lines

From: Mark Salyzyn <[email protected]>
To: [email protected]
Cc: Luben Tuikov <[email protected]>; Darrick J Wong <[email protected]>; James Bottomley <[email protected]>
Sent: Wednesday, August 31, 2011 6:44 AM
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

Since Luben's patch on July 28th 2011 went nowhere, as there was an unanswered question regarding the future-proofing that Luben added in.

Are you saying that the patch I posted,
http://marc.info/?t=131182720200001&r=1&w=2, didn't go in because I didn't entertain Bottomley's unrelated question therein? Or are you saying that it did go in based on TECHNICAL CONTENT? I.e. it was buggy, or wrong, etc?

Quoted 1 line

I decided to submit a simplified focussed patch we have been using for the

By "simplified, focused" you mean one which doesn't define 2 out of 3 flags of REPORT GENERAL SMP response?

Quoted 5 lines

past year testing with the Xyratex enclosures (5U84, 2U24, chained with *many* peered expanders with Table to Table routing) that should hopefully expedite things and will be on hot standby to refactor as requested (including tossing this baby and refactoring Luben's patch should he be too busy, no hair off my back)

Now onto technical matter:
1) I'd call the flag "t2t_supp" to a) fit in with the rest of the spirit of the code as other fields are also called "_supp", and to b) actually convey the meaning of "table-to-table supported. Your naming of this flag
"table_to_table" implicitly means "table to table supported".
2) Please also add the debug output as my patch did. People will be wondering what went wrong if their domain didn't work, and the debug print in my original patch would tell them that.
3) You don't check that the parent also supports T2T. That's a bug.
4) Your patch logically does this: P=T && C!=S && (C is T2T || C!=T), which after expansion is equivalent to:
(P==T) && ((C!=S && C!=T2T) || C==D) ==> fail
where the outmost parens are an if (). Albeit from not being entirely correct, it also obfuscates what is being sought after. I chose to use the negation for successful check to make it more clear:
(P==T) && (C==S || (C==T && P==T2T && C==T2T)) ==> success, Translates to
"If parent phy is T, and If child phy is S OR (child is T and child and parent both support table to table) then we're okay, else report an error." Which is: T<-S is okay, and T<-T is okay if both parent and child support it.

Alternatively, Bottomley could just add my patch upstream.

Quoted 91 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

NB: this patch (and Luben's independent patch) results in an ABI break as the structures change 'shape' and thus result in a different set of libsas export signatures. I have an internal patch I use that preserves the structure shapes and thus the ABI; but would be considered inappropriate for the pristine trees. Said alternate patch would work fine for a Distribution tree where ABI concerns are an issue.

Checkpatch.pl reports clean.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>
drivers/scsi/libsas/sas_expander.c |    6 +++++-
include/scsi/libsas.h              |    1 +
include/scsi/sas.h                 |    6 ++++--
3 files changed, 10 insertions(+), 3 deletions(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c
--- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c 2011-08-31
08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-08-31 09:07:31.000000000 -0400
drivers/scsi/libsas/sas_expander.c +1 -0
@@ -331,6 +331,7 @@
    dev->ex_dev.num_phys = min(rg->num_phys, (u8)MAX_EXPANDER_PHYS);
    dev->ex_dev.conf_route_table = rg->conf_route_table;
    dev->ex_dev.configuring = rg->configuring;
+    dev->ex_dev.table_to_table = rg->table_to_table;
    memcpy(dev->ex_dev.enclosure_logical_id,
 rg->enclosure_logical_id, 8);
 }
@@ -1239,7 +1240,10 @@
                    res = -ENODEV;
                }
            } else if (parent_phy->routing_attr ==

TABLE_ROUTING &&
- child_phy->routing_attr !=
SUBTRACTIVE_ROUTING) {

drivers/scsi/libsas/sas_expander.c +4 -0
+                   child_phy->routing_attr !=
+                    SUBTRACTIVE_ROUTING &&
+                   (child_ex->table_to_table == 0 ||
+                    child_phy->routing_attr !=

TABLE_ROUTING)) {
sas_print_parent_topology_bug(child,

parent_phy, child_phy);
                res = -ENODEV;
            }

diff -ru scsi-misc-2.6/include/scsi/libsas.h
scsi-misc-2.6.new/include/scsi/libsas.h
--- scsi-misc-2.6/include/scsi/libsas.h 2011-08-31 08:32:22.000000000
-0400
+++ scsi-misc-2.6.new/include/scsi/libsas.h 2011-08-31
09:07:31.000000000 -0400

include/scsi/libsas.h +1 -0
@@ -144,6 +144,7 @@
    u8     num_phys;
    u8     configuring:1;
    u8     conf_route_table:1;
+    u8     table_to_table:1;
    u8     enclosure_logical_id[8];
 
    struct ex_phy *ex_phy;

diff -ru scsi-misc-2.6/include/scsi/sas.h
scsi-misc-2.6.new/include/scsi/sas.h
--- scsi-misc-2.6/include/scsi/sas.h 2011-08-31 08:32:22.000000000
-0400
+++ scsi-misc-2.6.new/include/scsi/sas.h 2011-08-31
09:07:31.000000000 -0400

include/scsi/sas.h +2 -1
@@ -341,7 +341,8 @@
 
    u8      conf_route_table:1;
    u8      configuring:1;
-    u8      _r_b:6;
+    u8      _r_b:5;
+    u8      table_to_table:1;
 
    u8      _r_c;
 

include/scsi/sas.h line 536

Quoted 9 lines
include/scsi/sas.h +2 -1
@@ -528,7 +529,8 @@
    u8      _r_a;
    u8      num_phys;
 
-    u8      _r_b:6;
+    u8      table_to_table:1;
+    u8      _r_b:5;
    u8      configuring:1;
    u8      conf_route_table:1;
 

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________

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

#5 lore raw

RE: [PATCH] [SCSI]: Allow expander T-T attachments

Ok James, my take on this (a rationalization):

I believe the SAS 2.0 enhancements are orthogonal and the expanders will stage-in these new features.

Every change in the shape of the libsas structures creates an ABI break for all the libsas-dependent drivers. Fine for kernel.org, expected and barely noticed, but the ABI break affects Distributions as they will not be able to weakly-link modules from Quarterly Update to Quarterly Update. This will create resistance at every step of the way as SAS 2.0 code migrates in from whatever source.

I find Luben's patch suitable primarily because it has staked some useful territory which will make the move to all the SAS 2.0 features less costly on the Distributions. I also find that this territory, even if Luben has or does not have plans, to be inert but future-proofed. Knowing how to use them may create issues though for the chosen algorithms and for that reason alone I could be convinced that we should drop these until someone somewhere uses them in their own model (ok, I waffle, but placing /* reserved */ after each will solve most of the worry about misuse).

I would expect that the enhancements to deal with self-configuring expanders (which Xyratex does not have ... yet) to be an orthogonal effort (minus the staked out territory) and along with other issues and deficiencies more complicated to merge in.

I would appeal that you, and all other stakeholders, be willing to take Luben's patch unmodified (or at least with /* reserved */ comments) with the understanding that someone somewhere is going to take on the other enhancements for 2.0 as they hit *real* hardware. And if this one is taken (to at least the pending tree), we will make sure it is tested and get back to the list if we find borkenness(sic).

Approved: <[email protected]>

Sincerely -- Mark Salyzyn

ObligatoryDisclaimer: Ignore the Xyratex tacked-on disclaimer.

-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Thursday, September 01, 2011 11:34 AM
To: Mark Salyzyn
Cc: Luben Tuikov; [email protected]; Darrick J Wong
Subject: RE: [PATCH] [SCSI]: Allow expander T-T attachments

Quoted 2 lines · Mark Salyzyn

We will need James to chime in why your patch did not go in. My assumption is the lack of response to his question left it in limbo.

That's a good assumption. A maintainers list folder is usually sorted by thread and by activity. I mark patches for inclusion, but if a thread is expecting a reply I don't do anything since it comes back to the top again once there's activity on it.

Quoted 2 lines

The likely modification to your patch would be to remove all the unused added flags rather than staking out the territory.

Well, yes, but the question is broader than that. In theory we can't support SAS2.0 expanders until we support all of their features. Table to Table routing is one, but self configuration is another. If there are no current self configuring expanders, I'm OK with just doing table to table ... but the extra bits made me wonder.

James

Quoted 6 lines

What kind of testing was involved in your patch? I have not merged yours in here to try it out on our enclosures. Either way, I want to see some movement; James any directions?

Sincerely -- Mark Salyzyn

Quoted 12 lines

-----Original Message-----
From: Luben Tuikov [mailto:[email protected]]
Sent: Wednesday, August 31, 2011 1:43 PM
To: Mark Salyzyn; [email protected]
Cc: Darrick J Wong; James Bottomley
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

----- Original Message -----

Quoted 3 lines

From: Mark Salyzyn <[email protected]>
To: [email protected]
Cc: Luben Tuikov <[email protected]>; Darrick J Wong

<[email protected]>; James Bottomley <[email protected]>

Quoted 5 lines
Quoted 5 lines

Sent: Wednesday, August 31, 2011 6:44 AM
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

Since Luben's patch on July 28th 2011 went nowhere, as there was an unanswered question regarding the future-proofing that Luben added

in.

Quoted 5 lines

Are you saying that the patch I posted,
http://marc.info/?t=131182720200001&r=1&w=2, didn't go in because I didn't entertain Bottomley's unrelated question therein? Or are you saying that it did go in based on TECHNICAL CONTENT? I.e.

it

Quoted 3 lines

was buggy, or wrong, etc?

Quoted 1 line

I decided to submit a simplified focussed patch we have been using

for the

Quoted 2 lines

By "simplified, focused" you mean one which doesn't define 2 out of 3

flags of

Quoted 3 lines

REPORT GENERAL SMP response?

Quoted 1 line

past year testing with the Xyratex enclosures (5U84, 2U24, chained

with

Quoted 7 lines
Quoted 4 lines

*many* peered expanders with Table to Table routing) that should hopefully expedite things and will be on hot standby to refactor as requested (including tossing this baby and refactoring Luben's patch should he be too busy, no hair off my back)

Now onto technical matter:
1) I'd call the flag "t2t_supp" to a) fit in with the rest of the

spirit of the

Quoted 1 line

code as other fields are also called "_supp", and to b) actually

convey

Quoted 10 lines

the meaning of "table-to-table supported. Your naming of this flag
"table_to_table" implicitly means "table to table supported".
2) Please also add the debug output as my patch did. People will be wondering what went wrong if their domain didn't work, and the debug print in my original patch would tell them that.
3) You don't check that the parent also supports T2T. That's a bug.
4) Your patch logically does this: P=T && C!=S && (C is T2T || C!=T), which after expansion is equivalent to:
(P==T) && ((C!=S && C!=T2T) || C==D) ==> fail
where the outmost parens are an if (). Albeit from not being entirely

correct,

Quoted 1 line

it also obfuscates what is being sought after. I chose to use the

negation for

Quoted 4 lines

successful check to make it more clear:
(P==T) && (C==S || (C==T && P==T2T && C==T2T)) ==> success, Translates to
"If parent phy is T, and If child phy is S OR (child is T and child

and parent

Quoted 2 lines

both support table to table) then we're okay, else report an error." Which is: T<-S is okay, and T<-T is okay if both parent and child

support it.

Quoted 11 lines

Alternatively, Bottomley could just add my patch upstream.

Quoted 8 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

NB: this patch (and Luben's independent patch) results in an ABI

break

Quoted 1 line
Quoted 1 line

as the structures change 'shape' and thus result in a different set

of

Quoted 1 line
Quoted 1 line

libsas export signatures. I have an internal patch I use that

preserves

Quoted 2 lines
Quoted 2 lines

the structure shapes and thus the ABI; but would be considered inappropriate for the pristine trees. Said alternate patch would

work

Quoted 43 lines
Quoted 43 lines

fine for a Distribution tree where ABI concerns are an issue.

Checkpatch.pl reports clean.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>
drivers/scsi/libsas/sas_expander.c |    6 +++++-
include/scsi/libsas.h              |    1 +
include/scsi/sas.h                 |    6 ++++--
3 files changed, 10 insertions(+), 3 deletions(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c
--- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c 2011-08-31
08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-08-31 09:07:31.000000000 -0400
drivers/scsi/libsas/sas_expander.c +1 -0
@@ -331,6 +331,7 @@
    dev->ex_dev.num_phys = min(rg->num_phys, (u8)MAX_EXPANDER_PHYS);
    dev->ex_dev.conf_route_table = rg->conf_route_table;
    dev->ex_dev.configuring = rg->configuring;
+    dev->ex_dev.table_to_table = rg->table_to_table;
    memcpy(dev->ex_dev.enclosure_logical_id,
 rg->enclosure_logical_id, 8);
 }
@@ -1239,7 +1240,10 @@
                    res = -ENODEV;
                }
            } else if (parent_phy->routing_attr ==

TABLE_ROUTING &&
- child_phy->routing_attr !=
SUBTRACTIVE_ROUTING) {

drivers/scsi/libsas/sas_expander.c +4 -0
+                   child_phy->routing_attr !=
+                    SUBTRACTIVE_ROUTING &&
+                   (child_ex->table_to_table == 0 ||
+                    child_phy->routing_attr !=
Quoted 8 lines
Quoted 8 lines

TABLE_ROUTING)) {
sas_print_parent_topology_bug(child,

parent_phy, child_phy);
                res = -ENODEV;
            }

diff -ru scsi-misc-2.6/include/scsi/libsas.h
scsi-misc-2.6.new/include/scsi/libsas.h
--- scsi-misc-2.6/include/scsi/libsas.h 2011-08-31

08:32:22.000000000

Quoted 10 lines
Quoted 10 lines

-0400
+++ scsi-misc-2.6.new/include/scsi/libsas.h 2011-08-31
09:07:31.000000000 -0400

include/scsi/libsas.h +1 -0
@@ -144,6 +144,7 @@
    u8     num_phys;
    u8     configuring:1;
    u8     conf_route_table:1;
+    u8     table_to_table:1;
    u8     enclosure_logical_id[8];
 
Quoted 4 lines
Quoted 4 lines
include/scsi/libsas.h +0 -0
    struct ex_phy *ex_phy;

diff -ru scsi-misc-2.6/include/scsi/sas.h
scsi-misc-2.6.new/include/scsi/sas.h
--- scsi-misc-2.6/include/scsi/sas.h 2011-08-31

08:32:22.000000000

Quoted 17 lines
Quoted 17 lines

-0400
+++ scsi-misc-2.6.new/include/scsi/sas.h 2011-08-31
09:07:31.000000000 -0400

include/scsi/sas.h +2 -1
@@ -341,7 +341,8 @@
 
    u8      conf_route_table:1;
    u8      configuring:1;
-    u8      _r_b:6;
+    u8      _r_b:5;
+    u8      table_to_table:1;
 
    u8      _r_c;
 
@@ -528,7 +529,8 @@
    u8      _r_a;
    u8      num_phys;
 
Quoted 6 lines

include/scsi/sas.h line 536

Quoted 6 lines
include/scsi/sas.h +2 -1
-    u8      _r_b:6;
+    u8      table_to_table:1;
+    u8      _r_b:5;
    u8      configuring:1;
    u8      conf_route_table:1;
 

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________

#9 lore raw

Re: [PATCH] [SCSI]: libsas failure to revalidate domain for anything but the first expander child.

In reply to Mark Salyzyn

----- Original Message -----

Quoted 8 lines

In an enclosure model where there are chaining expanders to a large body of storage, it was discovered that libsas, responding to a broadcast event change, would only revalidate the domain of first child expander in the list.

The issue is that the pointer value to the discovered source device was used to break out of the loop, rather than the content of the pointer.

Quoted 6 lines

This still remains non-compliant as the revalidate domain code is supposed to loop through all child expanders, and not stop at the first one it finds that reports a change count. However, the design of this routine does not allow multiple device discoveries and that would be a more complicated set of patches reserved for another day. We are fixing the glaring bug rather than refactoring the code.

Obviously I've tested this both when I was at Adaptec and at Vitesse. I'd connect 7-8 expanders, run iogen with 1000 threads to say 30-40 disks, and then unplug the port between a level 1 and 2 expander and the I/O would quiesce, iogen would report a subset of the disks missing, and then when the port was reestablished, I/O would restart. However I'm not sure that Bottomley tested this scenario after changing my code off-line before submitting it into the Linux kernel.

Now a few notes to mention: Your patch patches a function called sas_find_bcast_dev(). My original code does NOT have such a function. Revalidation is much more subtle and the code looks simpler in my original version. In my original code there is a lot more recursion, symmetry and code mirroring. Granted, while such code is shorter, and simpler, it is harder to figure out what it does, and I feel this is exactly why we see the current state of libsas to be so explicit, simplistic and introducing bugs. See this:
http://marc.info/?l=linux-scsi&m=131480962006471&w=2 where I described the state of libsas recently.

Quoted 29 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

Checkpatch.pl reports clean. Patch applies cleanly to a WIDE variety of kernels up to latest.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>

sas_expander.c |    2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c --- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c    2011-08-31 08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-09-01 08:57:55.000000000 -0400
drivers/scsi/libsas/sas_expander.c +0 -0
@@ -1721,7 +1721,7 @@
     list_for_each_entry(ch, &ex->children, siblings) {
Quoted 9 lines

        if (ch->dev_type == EDGE_DEV || ch->dev_type == FANOUT_DEV) {
            res = sas_find_bcast_dev(ch, src_dev); -            if (src_dev)
+            if (*src_dev)
                return res;
        }
    }

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

#7 lore raw

Re: [PATCH] [SCSI]: Allow expander T-T attachments

In reply to Mark Salyzyn

It was tested on a bunch of self-configuring, T2T supporting expanders, connected as a binary tree with a SAS controller at the root of the tree, forming more than 2 levels of branching.

----- Original Message -----

Quoted 202 lines

From: Mark Salyzyn <[email protected]>
To: Luben Tuikov <[email protected]>; [email protected]
Cc: Darrick J Wong <[email protected]>; James Bottomley <[email protected]>
Sent: Wednesday, August 31, 2011 10:51 AM
Subject: RE: [PATCH] [SCSI]: Allow expander T-T attachments

We will need James to chime in why your patch did not go in. My assumption is the lack of response to his question left it in limbo.

The likely modification to your patch would be to remove all the unused added flags rather than staking out the territory.

What kind of testing was involved in your patch? I have not merged yours in here to try it out on our enclosures. Either way, I want to see some movement; James any directions?

Sincerely -- Mark Salyzyn

-----Original Message-----
From: Luben Tuikov [mailto:[email protected]]
Sent: Wednesday, August 31, 2011 1:43 PM
To: Mark Salyzyn; [email protected]
Cc: Darrick J Wong; James Bottomley
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

----- Original Message -----

Quoted 3 lines

From: Mark Salyzyn <[email protected]>
To: [email protected]
Cc: Luben Tuikov <[email protected]>; Darrick J Wong

<[email protected]>; James Bottomley <[email protected]>

Quoted 5 lines

Sent: Wednesday, August 31, 2011 6:44 AM
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

Since Luben's patch on July 28th 2011 went nowhere, as there was an unanswered question regarding the future-proofing that Luben added in.

Are you saying that the patch I posted,
http://marc.info/?t=131182720200001&r=1&w=2, didn't go in because I didn't entertain Bottomley's unrelated question therein? Or are you saying that it did go in based on TECHNICAL CONTENT? I.e. it was buggy, or wrong, etc?

Quoted 1 line

I decided to submit a simplified focussed patch we have been using for the

By "simplified, focused" you mean one which doesn't define 2 out of 3 flags of
REPORT GENERAL SMP response?

Quoted 5 lines

past year testing with the Xyratex enclosures (5U84, 2U24, chained with *many* peered expanders with Table to Table routing) that should hopefully expedite things and will be on hot standby to refactor as requested (including tossing this baby and refactoring Luben's patch should he be too busy, no hair off my back)

Now onto technical matter:
1) I'd call the flag "t2t_supp" to a) fit in with the rest of the spirit of the
code as other fields are also called "_supp", and to b) actually convey
 the meaning of "table-to-table supported. Your naming of this flag "table_to_table" implicitly means "table to table
supported".
2) Please also add the debug output as my patch did. People will be wondering what went wrong if their domain didn't work, and the debug print in my original patch would tell them that.
3) You don't check that the parent also supports T2T. That's a bug.
4) Your patch logically does this: P=T && C!=S && (C is T2T || C!=T),
which after expansion is equivalent to:
(P==T) && ((C!=S && C!=T2T) || C==D) ==> fail
where the outmost parens are an if (). Albeit from not being entirely correct, it also obfuscates what is being sought after. I chose to use the negation for successful check to make it more clear:
(P==T) && (C==S || (C==T && P==T2T && C==T2T)) ==>
success,
Translates to
"If parent phy is T, and If child phy is S OR (child is T and child and parent
both support table to table) then we're okay, else report an error." Which is: T<-S is okay, and T<-T is okay if both parent and child support it.

Alternatively, Bottomley could just add my patch upstream.

Quoted 9 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

NB: this patch (and Luben's independent patch) results in an ABI break as the structures change 'shape' and thus result in a different set

of

Quoted 85 lines

libsas export signatures. I have an internal patch I use that preserves the structure shapes and thus the ABI; but would be considered inappropriate for the pristine trees. Said alternate patch would work fine for a Distribution tree where ABI concerns are an issue.

Checkpatch.pl reports clean.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>
 drivers/scsi/libsas/sas_expander.c |    6 +++++-
 include/scsi/libsas.h              |    1 +
 include/scsi/sas.h                 |    6 ++++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c --- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c    2011-08-31 08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

 2011-08-31 09:07:31.000000000 -0400
 @@ -331,6 +331,7 @@
     dev->ex_dev.num_phys = min(rg->num_phys, (u8)MAX_EXPANDER_PHYS);
     dev->ex_dev.conf_route_table = rg->conf_route_table;
     dev->ex_dev.configuring = rg->configuring;
 +    dev->ex_dev.table_to_table = rg->table_to_table;
     memcpy(dev->ex_dev.enclosure_logical_id,
 rg->enclosure_logical_id, 8);
 }

@@ -1239,7 +1240,10 @@
                    res = -ENODEV;
                }
            } else if (parent_phy->routing_attr == TABLE_ROUTING &&
-                   child_phy->routing_attr != SUBTRACTIVE_ROUTING) {
+                   child_phy->routing_attr !=
+                    SUBTRACTIVE_ROUTING &&
+                   (child_ex->table_to_table == 0 ||
+                    child_phy->routing_attr != TABLE_ROUTING)) {
                sas_print_parent_topology_bug(child, parent_phy, child_phy);
                res = -ENODEV;
            }
diff -ru scsi-misc-2.6/include/scsi/libsas.h scsi-misc-2.6.new/include/scsi/libsas.h
--- scsi-misc-2.6/include/scsi/libsas.h    2011-08-31 08:32:22.000000000 -0400
+++ scsi-misc-2.6.new/include/scsi/libsas.h    2011-08-31 09:07:31.000000000 -0400
@@ -144,6 +144,7 @@
    u8     num_phys;
    u8     configuring:1;
    u8     conf_route_table:1;
+    u8     table_to_table:1;
    u8     enclosure_logical_id[8];

    struct ex_phy *ex_phy;
diff -ru scsi-misc-2.6/include/scsi/sas.h scsi-misc-2.6.new/include/scsi/sas.h
--- scsi-misc-2.6/include/scsi/sas.h    2011-08-31 08:32:22.000000000 -0400
+++ scsi-misc-2.6.new/include/scsi/sas.h    2011-08-31 09:07:31.000000000 -0400
@@ -341,7 +341,8 @@

    u8      conf_route_table:1;
    u8      configuring:1;
-    u8      _r_b:6;
+    u8      _r_b:5;
+    u8      table_to_table:1;

    u8      _r_c;

@@ -528,7 +529,8 @@
    u8      _r_a;
    u8      num_phys;

Quoted 6 lines

-    u8      _r_b:6;
+    u8      table_to_table:1;
+    u8      _r_b:5;
    u8      configuring:1;
    u8      conf_route_table:1;

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

Quoted 7 lines

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________

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

#10 lore raw

RE: [PATCH] [SCSI]: libsas failure to revalidate domain for anything but the first expander child.

In reply to Luben Tuikov

So are you suggesting a larger/different fix, or do you see this minor change as an acceptable means of resolving the specific issue of the revalidation not going beyond the first child expander? At least with this fix it will go to the first expander with a change. It was a code-bug from fumble-fingers, missing a '*', not a request to revamp ;->

I know that by spec it should not stop at the first discovered change, ignoring changes in other children, but that is a much finer corner case requiring discovery events at a higher frequency than the revalidation period can handle. Not sure if I have the stomach to wait for a rewrite of libsas ... Besides I feel libsas 'mostly works' and for today just needs a few tweaks (evolution, not revolution).

Sincerely -- Mark Salyzyn

-----Original Message-----
From: Luben Tuikov [mailto:[email protected]]
Sent: Thursday, September 01, 2011 1:18 PM
To: Mark Salyzyn; [email protected]
Cc: Darrick J Wong; James Bottomley
Subject: Re: [PATCH] [SCSI]: libsas failure to revalidate domain for anything but the first expander child.

----- Original Message -----

Quoted 8 lines

In an enclosure model where there are chaining expanders to a large body of storage, it was discovered that libsas, responding to a broadcast event change, would only revalidate the domain of first child expander in the list.

The issue is that the pointer value to the discovered source device was used to break out of the loop, rather than the content of the pointer.

Quoted 6 lines

This still remains non-compliant as the revalidate domain code is supposed to loop through all child expanders, and not stop at the first one it finds that reports a change count. However, the design of this routine does not allow multiple device discoveries and that would be a more complicated set of patches reserved for another day. We are fixing the glaring bug rather than refactoring the code.

Obviously I've tested this both when I was at Adaptec and at Vitesse. I'd connect 7-8 expanders, run iogen with 1000 threads to say 30-40 disks, and then unplug the port between a level 1 and 2 expander and the I/O would quiesce, iogen would report a subset of the disks missing, and then when the port was reestablished, I/O would restart. However I'm not sure that Bottomley tested this scenario after changing my code off-line before submitting it into the Linux kernel.

Now a few notes to mention: Your patch patches a function called sas_find_bcast_dev(). My original code does NOT have such a function. Revalidation is much more subtle and the code looks simpler in my original version. In my original code there is a lot more recursion, symmetry and code mirroring. Granted, while such code is shorter, and simpler, it is harder to figure out what it does, and I feel this is exactly why we see the current state of libsas to be so explicit, simplistic and introducing bugs. See this:
http://marc.info/?l=linux-scsi&m=131480962006471&w=2 where I described the state of libsas recently.

Quoted 29 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

Checkpatch.pl reports clean. Patch applies cleanly to a WIDE variety of kernels up to latest.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>

sas_expander.c |    2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c --- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c    2011-08-31 08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-09-01 08:57:55.000000000 -0400
drivers/scsi/libsas/sas_expander.c +0 -0
@@ -1721,7 +1721,7 @@
     list_for_each_entry(ch, &ex->children, siblings) {
Quoted 9 lines

        if (ch->dev_type == EDGE_DEV || ch->dev_type == FANOUT_DEV) {
            res = sas_find_bcast_dev(ch, src_dev); -            if (src_dev)
+            if (*src_dev)
                return res;
        }
    }

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________

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

#6 lore raw

Re: [PATCH] [SCSI]: Allow expander T-T attachments

In reply to James Bottomley

----- Original Message -----

Quoted 7 lines
Quoted 2 lines

We will need James to chime in why your patch did not go in. My assumption is the lack of response to his question left it in limbo.

That's a good assumption.  A maintainers list folder is usually sorted by thread and by activity.  I mark patches for inclusion, but if a thread is expecting a reply I don't do anything since it comes back to the top again once there's activity on it.

This kernel business shouldn't be about you. It should be about making the kernel better today than it is tomorrow, so that people can use it and can use it with more devices, without bugs.

Quoted 5 lines
Quoted 2 lines

The likely modification to your patch would be to remove all the unused added flags rather than staking out the territory.

Well, yes, but the question is broader than that.  In theory we can't support SAS2.0 expanders until we support all of their features.

That's strictly _your_ theory and what it does, it excludes functionality from the kernel instead of enabling it.  When two vendors send you a patch that enables the same functionality and ask for it to be included into the kernel, because people are using this functionality, you should listen and include it.

Quoted 2 lines

Table
to Table routing is one, but self configuration is another.

That's a very uninformed statement.  It shows your utter lack of familiarity of the SAS protocol.

Quoted 3 lines

If there
are no current self configuring expanders, I'm OK with just doing table to table ... but the extra bits made me wonder.

Yes, you should simply include the patch.

Quoted 211 lines

James

Quoted 6 lines

What kind of testing was involved in your patch? I have not merged yours in here to try it out on our enclosures. Either way, I want to see some movement; James any directions?

Sincerely -- Mark Salyzyn

Quoted 12 lines

-----Original Message-----
From: Luben Tuikov [mailto:[email protected]]
Sent: Wednesday, August 31, 2011 1:43 PM
To: Mark Salyzyn; [email protected]
Cc: Darrick J Wong; James Bottomley
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

----- Original Message -----

Quoted 3 lines

From: Mark Salyzyn <[email protected]>
To: [email protected]
Cc: Luben Tuikov <[email protected]>; Darrick J Wong

<[email protected]>; James Bottomley <[email protected]>

Quoted 4 lines
Quoted 4 lines

Sent: Wednesday, August 31, 2011 6:44 AM
Subject: Re: [PATCH] [SCSI]: Allow expander T-T attachments

Since Luben's patch on July 28th 2011 went nowhere, as there was

an

Quoted 9 lines
Quoted 1 line

unanswered question regarding the future-proofing that Luben added in.

Are you saying that the patch I posted,
http://marc.info/?t=131182720200001&r=1&w=2, didn't go in because I didn't entertain Bottomley's unrelated question therein? Or are you saying that it did go in based on TECHNICAL CONTENT? I.e. it was buggy, or wrong, etc?

Quoted 1 line

I decided to submit a simplified focussed patch we have been using for

the

Quoted 2 lines

By "simplified, focused" you mean one which doesn't define 2

out of 3 flags of

Quoted 3 lines

REPORT GENERAL SMP response?

Quoted 1 line

past year testing with the Xyratex enclosures (5U84, 2U24, chained

with

Quoted 3 lines
Quoted 3 lines

*many* peered expanders with Table to Table routing) that should hopefully expedite things and will be on hot standby to refactor as requested (including tossing this baby and refactoring Luben's

patch

Quoted 4 lines
Quoted 1 line

should he be too busy, no hair off my back)

Now onto technical matter:
1) I'd call the flag "t2t_supp" to a) fit in with the rest of

the spirit of the

Quoted 1 line

code as other fields are also called "_supp", and to b) actually

convey

Quoted 2 lines

  the meaning of "table-to-table supported. Your naming of this flag
"table_to_table" implicitly means "table to table

supported".

Quoted 5 lines

2) Please also add the debug output as my patch did. People will be wondering what went wrong if their domain didn't work, and the debug print in my original patch would tell them that.
3) You don't check that the parent also supports T2T. That's a bug.
4) Your patch logically does this: P=T && C!=S && (C is T2T

|| C!=T),
>  which after expansion is equivalent to:
>  (P==T) && ((C!=S && C!=T2T) || C==D) ==> fail
>  where the outmost parens are an if (). Albeit from not being entirely 

correct,

Quoted 1 line

it also obfuscates what is being sought after. I chose to use the negation

for

Quoted 2 lines

successful check to make it more clear:
(P==T) && (C==S || (C==T && P==T2T && C==T2T))

==> success,

Quoted 2 lines

Translates to
"If parent phy is T, and If child phy is S OR (child is T and child

and parent

Quoted 1 line

both support table to table) then we're okay, else report an

error."

Quoted 1 line

Which is: T<-S is okay, and T<-T is okay if both parent and child

support it.

Quoted 6 lines

Alternatively, Bottomley could just add my patch upstream.

Quoted 3 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I

have

Quoted 5 lines
Quoted 5 lines

Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

NB: this patch (and Luben's independent patch) results in an ABI

break

Quoted 1 line
Quoted 1 line

as the structures change 'shape' and thus result in a

different set of

Quoted 1 line
Quoted 1 line

libsas export signatures. I have an internal patch I use that

preserves

Quoted 19 lines
Quoted 19 lines

the structure shapes and thus the ABI; but would be considered inappropriate for the pristine trees. Said alternate patch would work fine for a Distribution tree where ABI concerns are an issue.

Checkpatch.pl reports clean.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>

drivers/scsi/libsas/sas_expander.c |    6 +++++-
include/scsi/libsas.h              |    1 +
include/scsi/sas.h                |    6 ++++--

3 files changed, 10 insertions(+), 3 deletions(-)
Quoted 8 lines

Review line 331

Quoted 8 lines

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c --- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c    2011-08-31 08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-08-31 09:07:31.000000000 -0400
(quoted diff) +0 -0
@@ -331,6 +331,7 @@
      dev->ex_dev.num_phys = min(rg->num_phys, 

(u8)MAX_EXPANDER_PHYS);

Quoted 18 lines
Quoted 18 lines
drivers/scsi/libsas/sas_expander.c +1 -0
      dev->ex_dev.conf_route_table = rg->conf_route_table;
      dev->ex_dev.configuring = rg->configuring;
+    dev->ex_dev.table_to_table = rg->table_to_table;
      memcpy(dev->ex_dev.enclosure_logical_id,
 rg->enclosure_logical_id, 8);
 }
@@ -1239,7 +1240,10 @@
                      res = -ENODEV;
                  }
              } else if (parent_phy->routing_attr ==

TABLE_ROUTING &&
-                  child_phy->routing_attr != SUBTRACTIVE_ROUTING) {
+                  child_phy->routing_attr != +                    SUBTRACTIVE_ROUTING &&
+                  (child_ex->table_to_table == 0 || +                    child_phy->routing_attr !=

Quoted 8 lines
Quoted 8 lines

TABLE_ROUTING)) { sas_print_parent_topology_bug(child, parent_phy, child_phy);
                res = -ENODEV;
            }
diff -ru scsi-misc-2.6/include/scsi/libsas.h scsi-misc-2.6.new/include/scsi/libsas.h
--- scsi-misc-2.6/include/scsi/libsas.h    2011-08-31

08:32:22.000000000

Quoted 31 lines
Quoted 31 lines

-0400
+++ scsi-misc-2.6.new/include/scsi/libsas.h    2011-08-31 09:07:31.000000000 -0400

include/scsi/libsas.h +1 -0
@@ -144,6 +144,7 @@
      u8     num_phys;
      u8     configuring:1;
      u8     conf_route_table:1;
+    u8     table_to_table:1;
      u8     enclosure_logical_id[8];
 
      struct ex_phy *ex_phy;

diff -ru scsi-misc-2.6/include/scsi/sas.h scsi-misc-2.6.new/include/scsi/sas.h
--- scsi-misc-2.6/include/scsi/sas.h    2011-08-31 08:32:22.000000000 -0400
+++ scsi-misc-2.6.new/include/scsi/sas.h    2011-08-31 09:07:31.000000000 -0400

include/scsi/sas.h +2 -1
@@ -341,7 +341,8 @@
 
      u8      conf_route_table:1;
      u8      configuring:1;
-    u8      _r_b:6;
+    u8      _r_b:5;
+    u8      table_to_table:1;
 
      u8      _r_c;
 
@@ -528,7 +529,8 @@
      u8      _r_a;
      u8      num_phys;
 
Quoted 8 lines

include/scsi/sas.h line 536

Quoted 6 lines
include/scsi/sas.h +2 -1
-    u8      _r_b:6;
+    u8      table_to_table:1;
+    u8      _r_b:5;
      u8      configuring:1;
      u8      conf_route_table:1;
 

______________________________________________________________________
This email may contain privileged or confidential information, which should

only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Quoted 2 lines


Internet email is susceptible to data corruption, interception and

unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Quoted 2 lines


Xyratex Technology Limited (03134912), Registered in England & Wales,

Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

Quoted 2 lines


The Xyratex group of companies also includes, Xyratex Ltd, registered in

Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.

Quoted 9 lines
Quoted 5 lines

______________________________________________________________________

--
To unsubscribe from this list: send the line "unsubscribe

linux-scsi" in

Quoted 2 lines

the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

#11 lore raw

Re: [PATCH] [SCSI]: libsas failure to revalidate domain for anything but the first expander child.

In reply to Mark Salyzyn
Quoted 2 lines

So are you suggesting a larger/different fix, or do you see this minor change as an acceptable means of resolving the specific issue of the revalidation not going beyond the first child expander? At least with this fix it will go to the first expander with a change. It was a code-bug from fumble-fingers, missing a '*', not a request to revamp ;->

Neither. I was merely stating a fact, history.

I don't mind this patch.

Quoted 2 lines

I know that by spec it should not stop at the first discovered change, ignoring changes in other children, but that is a much finer corner case requiring discovery events at a higher frequency than the revalidation period can handle. Not sure if I have the stomach to wait for a rewrite of libsas ... Besides I feel libsas 'mostly works' and for today just needs a few tweaks (evolution, not revolution).

Yes. My original code did handle all this as event management used a clever technique to handle infinite number of events (of finite number of type of event) in finite amount of memory. Bottomley and his gang (2908d778ab3e244900c310974e1fc1c69066e450) ripped that out and added the utterly naive way or processing events as you currently see in libsas. The result is a buggy, substandard and mediocre implementation.

Quoted 84 lines

Sincerely -- Mark Salyzyn

-----Original Message-----
From: Luben Tuikov [mailto:[email protected]]
Sent: Thursday, September 01, 2011 1:18 PM
To: Mark Salyzyn; [email protected]
Cc: Darrick J Wong; James Bottomley
Subject: Re: [PATCH] [SCSI]: libsas failure to revalidate domain for anything but the first expander child.

----- Original Message -----

Quoted 8 lines

In an enclosure model where there are chaining expanders to a large body of storage, it was discovered that libsas, responding to a broadcast event change, would only revalidate the domain of first child expander in the list.

The issue is that the pointer value to the discovered source device was used to break out of the loop, rather than the content of the pointer.

Quoted 6 lines

This still remains non-compliant as the revalidate domain code is supposed to loop through all child expanders, and not stop at the first one it finds that reports a change count. However, the design of this routine does not allow multiple device discoveries and that would be a more complicated set of patches reserved for another day. We are fixing the glaring bug rather than refactoring the code.

Obviously I've tested this both when I was at Adaptec and at Vitesse. I'd connect 7-8 expanders, run iogen with 1000 threads to say 30-40 disks, and then unplug the port between a level 1 and 2 expander and the I/O would quiesce, iogen would report a subset of the disks missing, and then when the port was reestablished, I/O would restart. However I'm not sure that Bottomley tested this scenario after changing my code off-line before submitting it into the Linux kernel.

Now a few notes to mention: Your patch patches a function called sas_find_bcast_dev(). My original code does NOT have such a function. Revalidation is much more subtle and the code looks simpler in my original version. In my original code there is a lot more recursion, symmetry and code mirroring. Granted, while such code is shorter, and simpler, it is harder to figure out what it does, and I feel this is exactly why we see the current state of libsas to be so explicit, simplistic and introducing bugs. See this:
http://marc.info/?l=linux-scsi&m=131480962006471&w=2 where I described the state of libsas recently.

Quoted 29 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job. I have Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

Checkpatch.pl reports clean. Patch applies cleanly to a WIDE variety of kernels up to latest.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>

sas_expander.c |    2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

diff -ru scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c --- scsi-misc-2.6/drivers/scsi/libsas/sas_expander.c    2011-08-31 08:32:21.000000000 -0400
+++ scsi-misc-2.6.new/drivers/scsi/libsas/sas_expander.c

2011-09-01 08:57:55.000000000 -0400
drivers/scsi/libsas/sas_expander.c +0 -0
@@ -1721,7 +1721,7 @@
     list_for_each_entry(ch, &ex->children, siblings) {
Quoted 9 lines

        if (ch->dev_type == EDGE_DEV || ch->dev_type == FANOUT_DEV) {
            res = sas_find_bcast_dev(ch, src_dev); -            if (src_dev)
+            if (*src_dev)
                return res;
        }
    }

______________________________________________________________________
This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.

Quoted 11 lines

Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.

Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.

The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
______________________________________________________________________

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

author Reviewed-by Reviewed-by on v1 1/1
#12 lore raw

Re: [PATCH] [SCSI]: libsas failure to revalidate domain for anything but the first expander child.

In reply to Mark Salyzyn
Quoted 15 lines · Mark Salyzyn

In an enclosure model where there are chaining expanders to a large body of storage, it was discovered that libsas, responding to a broadcast event change, would only revalidate the domain of first child expander in the list.

The issue is that the pointer value to the discovered source device was used to break out of the loop, rather than the content of the pointer.

This still remains non-compliant as the revalidate domain code is supposed to loop through all child expanders, and not stop at the first one it finds that reports a change count. However, the design of this routine does not allow multiple device discoveries and that would be a more complicated set of patches reserved for another day. We are fixing the glaring bug rather than refactoring the code.

Quoted 3 lines

Please note, as I am *stuck* on Outlook as per company policy, the following inline content will likely not patch clean even emailed as 'Plain Text', the enclosed attached file should do the job.

Yeah, Outlook helped you out with some line wrapping. The attachment is missing "From:", "Subject::" and the rest of the changelog, I went ahead and attached a revised version.

Quoted 3 lines

I have Cc'd
all the folks that originated the files in libsas, as there was no listed MAINTAINERs.

I wouldn't mind being cc'd on all libsas patches, probably all the other libsas lldd maintainers would like to be cc'd as well (added Xiangliang (mvsas) and Jack (pm8001))

Quoted 8 lines

Checkpatch.pl reports clean. Patch applies cleanly to a WIDE variety of kernels up to latest.

Sincerely -- Mark Salyzyn

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>

From e3569cf6e71f9435af8476c6729624cf32870326 Mon Sep 17 00:00:00 2001
From: Mark Salyzyn <[email protected]>
Date: Thu, 1 Sep 2011 06:11:17 -0700
Subject: [PATCH] libsas: failure to revalidate domain for anything but the
first expander child

In an enclosure model where there are chaining expanders to a large body of storage, it was discovered that libsas, responding to a broadcast event change, would only revalidate the domain of first child expander in the list.

The issue is that the pointer value to the discovered source device was used to break out of the loop, rather than the content of the pointer.

This still remains non-compliant as the revalidate domain code is supposed to loop through all child expanders, and not stop at the first one it finds that reports a change count. However, the design of this routine does not allow multiple device discoveries and that would be a more complicated set of patches reserved for another day. We are fixing the glaring bug rather than refactoring the code.

Cc Luben Tuikov <[email protected]>
Cc Darrick J Wong <[email protected]>
Cc James Bottomley <[email protected]>
---
 drivers/scsi/libsas/sas_expander.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/libsas/sas_expander.c +1 -1
index 874e29d..7d68517 100644
@@ -1718,7 +1718,7 @@ static int sas_find_bcast_dev(struct domain_device *dev,
 	list_for_each_entry(ch, &ex->children, siblings) {
 		if (ch->dev_type == EDGE_DEV || ch->dev_type == FANOUT_DEV) {
 			res = sas_find_bcast_dev(ch, src_dev);
-			if (src_dev)
+			if (*src_dev)
 				return res;
 		}
 	}
Signature · 1 line
1.7.6