public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] opensm/osm_lid_mgr: use 'first_time_master_sweep' flag
@ 2010-04-26 10:48 Sasha Khapyorsky
  2010-04-26 12:16 ` [PATCH] opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs Sasha Khapyorsky
  2010-05-22 13:09 ` [PATCH] opensm/osm_lid_mgr: use 'first_time_master_sweep' flag Sasha Khapyorsky
  0 siblings, 2 replies; 5+ messages in thread
From: Sasha Khapyorsky @ 2010-04-26 10:48 UTC (permalink / raw)
  To: linux-rdma; +Cc: Eli Dorfman, Alex Netes


Use 'first_time_master_sweep' as initial sweep indication instead of
'coming_out_of_standby'. The last flag will be set only when OpenSM
previously was in standby state, this doesn't cover some other cases
such as temporary SM port disconnection.

Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 opensm/opensm/osm_lid_mgr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index 0fd3b20..84f3508 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -304,7 +304,7 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
 	   info we might have.
 	   Do this only if the honor_guid2lid_file option is FALSE. If not, then
 	   need to honor this file. */
-	if (p_mgr->p_subn->coming_out_of_standby == TRUE) {
+	if (p_mgr->p_subn->first_time_master_sweep == TRUE) {
 		osm_db_clear(p_mgr->p_g2l);
 		if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE) {
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
-- 
1.7.0.4

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs
  2010-04-26 10:48 [PATCH] opensm/osm_lid_mgr: use 'first_time_master_sweep' flag Sasha Khapyorsky
@ 2010-04-26 12:16 ` Sasha Khapyorsky
  2010-04-26 13:02   ` [PATCH v2] " Sasha Khapyorsky
  2010-05-22 13:09 ` [PATCH] opensm/osm_lid_mgr: use 'first_time_master_sweep' flag Sasha Khapyorsky
  1 sibling, 1 reply; 5+ messages in thread
From: Sasha Khapyorsky @ 2010-04-26 12:16 UTC (permalink / raw)
  To: linux-rdma; +Cc: Eli Dorfman, Alex Netes


Fix couple of cases where duplicated LID generation is possible:

1) When guid2lid db is reloaded after standby or disconnected SM port
state (discovering) it must be validated, so content of used_lids[]
array (used as reference during LID assignment) will be consistent with
loaded guid2lid db.

2) When port for which LIDs were assigned exists in guid2lid db already
its record should be updated due to possibly changed LIDs, LMC, etc..

There still be more potential cases where LIDs could be duplicated. So
this patch fixes just part of them. I'm continuing an investigation.

Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 opensm/opensm/osm_lid_mgr.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index 84f3508..08d54f0 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -319,6 +319,7 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
 					"ERR 0306: "
 					"Error restoring Guid-to-Lid "
 					"persistent database. Ignoring it\n");
+			lid_mgr_validate_db(p_mgr);
 		}
 	}
 
@@ -710,7 +711,7 @@ static int lid_mgr_get_port_lid(IN osm_lid_mgr_t * p_mgr,
 			/* we still need to send the setting to the target port */
 			lid_changed = 1;
 		}
-		goto Exit;
+		goto NewLidSet;
 	} else
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"0x%016" PRIx64 " has no persistent lid assigned\n",
@@ -764,7 +765,6 @@ NewLidSet:
 	for (lid = *p_min_lid; lid <= *p_max_lid; lid++)
 		p_mgr->used_lids[lid] = 1;
 
-Exit:
 	/* make sure the assigned lids are marked in port_lid_tbl */
 	for (lid = *p_min_lid; lid <= *p_max_lid; lid++)
 		cl_ptr_vector_set(&p_mgr->p_subn->port_lid_tbl, lid, p_port);
-- 
1.7.0.4

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2] opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs
  2010-04-26 12:16 ` [PATCH] opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs Sasha Khapyorsky
@ 2010-04-26 13:02   ` Sasha Khapyorsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sasha Khapyorsky @ 2010-04-26 13:02 UTC (permalink / raw)
  To: linux-rdma; +Cc: Eli Dorfman, Alex Netes


Fix couple of cases where duplicated LID generation is possible:

1) When guid2lid db is reloaded after standby or disconnected SM port
state (discovering) it must be validated, so content of used_lids[]
array (used as reference during LID assignment) will be consistent with
loaded guid2lid db.

2) When port for which LIDs were assigned exists in guid2lid db already
its record should be updated due to possibly changed LIDs, LMC, etc..

There still be more potential cases where LIDs could be duplicated. So
this patch fixes just part of them. I'm continuing an investigation.

Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 opensm/opensm/osm_lid_mgr.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

v2: With guid2lid db reset (osm_db_clear()) clean also user_lids[]
array.

diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index 84f3508..7da4eb0 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -306,11 +306,11 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
 	   need to honor this file. */
 	if (p_mgr->p_subn->first_time_master_sweep == TRUE) {
 		osm_db_clear(p_mgr->p_g2l);
-		if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE) {
+		memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids));
+		if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE)
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"Ignore guid2lid file when coming out of standby\n");
-			memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids));
-		} else {
+		else {
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"Honor current guid2lid file when coming out "
 				"of standby\n");
@@ -319,6 +319,7 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
 					"ERR 0306: "
 					"Error restoring Guid-to-Lid "
 					"persistent database. Ignoring it\n");
+			lid_mgr_validate_db(p_mgr);
 		}
 	}
 
@@ -710,7 +711,7 @@ static int lid_mgr_get_port_lid(IN osm_lid_mgr_t * p_mgr,
 			/* we still need to send the setting to the target port */
 			lid_changed = 1;
 		}
-		goto Exit;
+		goto NewLidSet;
 	} else
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"0x%016" PRIx64 " has no persistent lid assigned\n",
@@ -764,7 +765,6 @@ NewLidSet:
 	for (lid = *p_min_lid; lid <= *p_max_lid; lid++)
 		p_mgr->used_lids[lid] = 1;
 
-Exit:
 	/* make sure the assigned lids are marked in port_lid_tbl */
 	for (lid = *p_min_lid; lid <= *p_max_lid; lid++)
 		cl_ptr_vector_set(&p_mgr->p_subn->port_lid_tbl, lid, p_port);
-- 
1.7.0.4

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] opensm/osm_lid_mgr: use 'first_time_master_sweep' flag
  2010-04-26 10:48 [PATCH] opensm/osm_lid_mgr: use 'first_time_master_sweep' flag Sasha Khapyorsky
  2010-04-26 12:16 ` [PATCH] opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs Sasha Khapyorsky
@ 2010-05-22 13:09 ` Sasha Khapyorsky
  2010-05-22 13:16   ` [PATCH] opensm/osm_lid_mgr: revert 'coming_out_of_standby' replacement patch Sasha Khapyorsky
  1 sibling, 1 reply; 5+ messages in thread
From: Sasha Khapyorsky @ 2010-05-22 13:09 UTC (permalink / raw)
  To: linux-rdma; +Cc: Eli Dorfman, Alex Netes

On 13:48 Mon 26 Apr     , Sasha Khapyorsky wrote:
> 
> Use 'first_time_master_sweep' as initial sweep indication instead of
> 'coming_out_of_standby'. The last flag will be set only when OpenSM
> previously was in standby state, this doesn't cover some other cases
> such as temporary SM port disconnection.
> 
> Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
> ---
>  opensm/opensm/osm_lid_mgr.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
> index 0fd3b20..84f3508 100644
> --- a/opensm/opensm/osm_lid_mgr.c
> +++ b/opensm/opensm/osm_lid_mgr.c
> @@ -304,7 +304,7 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
>  	   info we might have.
>  	   Do this only if the honor_guid2lid_file option is FALSE. If not, then
>  	   need to honor this file. */
> -	if (p_mgr->p_subn->coming_out_of_standby == TRUE) {
> +	if (p_mgr->p_subn->first_time_master_sweep == TRUE) {

Actually this changes the current behavior. Flag 'coming_out_of_standby'
is not set on first initial sweep and 'first_time_master_sweep' is. So
I'm reverting this patch yet up to more cleanup will be performed.

Sasha

>  		osm_db_clear(p_mgr->p_g2l);
>  		if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE) {
>  			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
> -- 
> 1.7.0.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] opensm/osm_lid_mgr: revert 'coming_out_of_standby' replacement patch
  2010-05-22 13:09 ` [PATCH] opensm/osm_lid_mgr: use 'first_time_master_sweep' flag Sasha Khapyorsky
@ 2010-05-22 13:16   ` Sasha Khapyorsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sasha Khapyorsky @ 2010-05-22 13:16 UTC (permalink / raw)
  To: linux-rdma; +Cc: Eli Dorfman, Alex Netes


This reverts the patch where 'coming_out_of_standby' flag was replaced by
'first_time_master_sweep'. It is probably a good idea in general to
merge those, but right now it will change the default lid manager
behavior, since it will ignore guid2lid file in initial sweep.

Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 opensm/opensm/osm_lid_mgr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index 7da4eb0..97b1de6 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -304,7 +304,7 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
 	   info we might have.
 	   Do this only if the honor_guid2lid_file option is FALSE. If not, then
 	   need to honor this file. */
-	if (p_mgr->p_subn->first_time_master_sweep == TRUE) {
+	if (p_mgr->p_subn->coming_out_of_standby == TRUE) {
 		osm_db_clear(p_mgr->p_g2l);
 		memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids));
 		if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE)
-- 
1.7.0.4

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-05-22 13:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-26 10:48 [PATCH] opensm/osm_lid_mgr: use 'first_time_master_sweep' flag Sasha Khapyorsky
2010-04-26 12:16 ` [PATCH] opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs Sasha Khapyorsky
2010-04-26 13:02   ` [PATCH v2] " Sasha Khapyorsky
2010-05-22 13:09 ` [PATCH] opensm/osm_lid_mgr: use 'first_time_master_sweep' flag Sasha Khapyorsky
2010-05-22 13:16   ` [PATCH] opensm/osm_lid_mgr: revert 'coming_out_of_standby' replacement patch Sasha Khapyorsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox