osm_sm_state_mgr.c Fix handling of polling retry number
PATCH 1/1 osm_sm_state_mgr.c Fix handling of polling retry number
The retry counter is now only updated if a packet is actually sent. (But as before the initial request is also counted.)
Prior to this change the actual maximum number of packets sent were polling retry number minus one.
---
opensm/osm_sm_state_mgr.c +5 -4
@@ -197,16 +197,14 @@ void osm_sm_state_mgr_polling_callback(IN void *context) }/* -* Incr the retry number. -* If it reached the max_retry_number in the subnet opt - call +* If retry number reached the max_retry_number in the subnet opt - call * osm_sm_state_mgr_process with signal OSM_SM_SIGNAL_POLLING_TIMEOUT */ - sm->retry_number++;OSM_LOG (sm->p_log,OSM_LOG_VERBOSE ,"SM State %d (%s), Retry number:%d\n" , sm->p_subn->sm_state,osm_get_sm_mgr_state_str (sm->p_subn->sm_state), sm->retry_number); -if (sm->retry_number >= sm->p_subn->opt.polling_retry_number) { +if (sm->retry_number > sm->p_subn->opt.polling_retry_number) {OSM_LOG (sm->p_log,OSM_LOG_DEBUG ,"Reached polling_retry_number value in retry_number. " "Go to DISCOVERY state\n" );
@@ -214,6 +212,9 @@ void osm_sm_state_mgr_polling_callback(IN void *context) goto Exit; } +/* Increment the retry number */ + sm->retry_number++; +/* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */ sm_state_mgr_send_master_sm_info_req (sm);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 34 lines · Line Holen
The retry counter is now only updated if a packet is actually sent. (But as before the initial request is also counted.)
Prior to this change the actual maximum number of packets sent were polling retry number minus one.
Signed-off-by Line Holen <[email protected]>---
opensm/osm_sm_state_mgr.c +2
-4@@ -197,16 +197,14 @@ void osm_sm_state_mgr_polling_callback(IN void *context) }/* -* Incr the retry number. -* If it reached the max_retry_number in the subnet opt - call +* If retry number reached the max_retry_number in the subnet opt - call * osm_sm_state_mgr_process with signal OSM_SM_SIGNAL_POLLING_TIMEOUT */ - sm->retry_number++;OSM_LOG (sm->p_log,OSM_LOG_VERBOSE ,"SM State %d (%s), Retry number:%d\n" , sm->p_subn->sm_state,osm_get_sm_mgr_state_str (sm->p_subn->sm_state), sm->retry_number); -if (sm->retry_number >= sm->p_subn->opt.polling_retry_number) { +if (sm->retry_number > sm->p_subn->opt.polling_retry_number) {OSM_LOG (sm->p_log,OSM_LOG_DEBUG ,"Reached polling_retry_number value in retry_number. " "Go to DISCOVERY state\n" );
opensm/osm_sm_state_mgr.c void osm_sm_state_mgr_polling_callback(IN void *context) · line 216
Quoted 5 lines
opensm/osm_sm_state_mgr.c +2
-0@@ -214,6 +212,9 @@ void osm_sm_state_mgr_polling_callback(IN void *context) goto Exit; } +/* Increment the retry number */ + sm->retry_number++;
Would it be better to increment retry number if sm_state_mgr_send_master_sm_info_req call just below this succeeds ?
-- Hal
Quoted 9 lines
opensm/osm_sm_state_mgr.c +1
-1+/* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */ sm_state_mgr_send_master_sm_info_req (sm); --To unsubscribe from this list: send the line "unsubscribe linux-rdma" in 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-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 38 lines · Hal Rosenstock
Quoted 37 lines · Line Holen
The retry counter is now only updated if a packet is actually sent. (But as before the initial request is also counted.)
Prior to this change the actual maximum number of packets sent were polling retry number minus one.
Signed-off-by Line Holen<[email protected]>---
opensm/osm_sm_state_mgr.c +2
-4@@ -197,16 +197,14 @@ void osm_sm_state_mgr_polling_callback(IN void *context) }/* -* Incr the retry number. -* If it reached the max_retry_number in the subnet opt - call +* If retry number reached the max_retry_number in the subnet opt - call * osm_sm_state_mgr_process with signal OSM_SM_SIGNAL_POLLING_TIMEOUT */ - sm->retry_number++;OSM_LOG (sm->p_log,OSM_LOG_VERBOSE ,"SM State %d (%s), Retry number:%d\n" , sm->p_subn->sm_state,osm_get_sm_mgr_state_str (sm->p_subn->sm_state), sm->retry_number); -if (sm->retry_number>= sm->p_subn->opt.polling_retry_number) { +if (sm->retry_number> sm->p_subn->opt.polling_retry_number) {OSM_LOG (sm->p_log,OSM_LOG_DEBUG ,"Reached polling_retry_number value in retry_number. " "Go to DISCOVERY state\n" );@@ -214,6 +212,9 @@ void osm_sm_state_mgr_polling_callback(IN void *context) goto Exit; }
Quoted 6 lines
opensm/osm_sm_state_mgr.c void osm_sm_state_mgr_polling_callback(IN void *context) · line 216
Quoted 2 lines
opensm/osm_sm_state_mgr.c +2
-0+/* Increment the retry number */ + sm->retry_number++;Would it be better to increment retry number if
sm_state_mgr_send_master_sm_info_reqcall just below this succeeds ?-- Hal
I'm not sure really. The current placement was to avoid potential race with response handling and the clearing of the counter there (incrementing after the response were received). Seemed to me that this could happen with the current locking.
Line
Quoted 10 lines
Quoted 10 lines
opensm/osm_sm_state_mgr.c +1
-1+/* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */ sm_state_mgr_send_master_sm_info_req (sm); --To unsubscribe from this list: send the line "unsubscribe linux-rdma" in 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-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] osm_sm_state_mgr.c: Fix handling of polling retry number
In reply to a message not in the archiveQuoted 45 lines · Line Holen
Quoted 44 lines · Hal Rosenstock
Quoted 43 lines · Line Holen
The retry counter is now only updated if a packet is actually sent. (But as before the initial request is also counted.)
Prior to this change the actual maximum number of packets sent were polling retry number minus one.
Signed-off-by Line Holen<[email protected]>---
opensm/osm_sm_state_mgr.c +1
-2@@ -197,16 +197,14 @@ void osm_sm_state_mgr_polling_callback(IN void *context) }/* -* Incr the retry number. -* If it reached the max_retry_number in the subnet opt - call +* If retry number reached the max_retry_number in the subnet opt - call
*osm_sm_state_mgr_processwith signalOSM_SM_SIGNAL_POLLING_TIMEOUT*/ - sm->retry_number++; OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "SM State %d (%s), Retry number:%d\n", sm->p_subn->sm_state, osm_get_sm_mgr_state_str(sm->p_subn->sm_state), sm->retry_number);opensm/osm_sm_state_mgr.c +1
-1-if (sm->retry_number>= sm->p_subn->opt.polling_retry_number) { +if (sm->retry_number> sm->p_subn->opt.polling_retry_number) {OSM_LOG (sm->p_log,OSM_LOG_DEBUG ,"Reached polling_retry_number value in retry_number. " "Go to DISCOVERY state\n" );@@ -214,6 +212,9 @@ void osm_sm_state_mgr_polling_callback(IN void *context) goto Exit; }
Quoted 7 lines
Quoted 6 lines
opensm/osm_sm_state_mgr.c void osm_sm_state_mgr_polling_callback(IN void *context) · line 216
Quoted 2 lines
opensm/osm_sm_state_mgr.c +2
-0+/* Increment the retry number */ + sm->retry_number++;Would it be better to increment retry number if
sm_state_mgr_send_master_sm_info_reqcall just below this succeeds ?-- Hal
I'm not sure really.
All I was proposing was a minor variation to what you proposed:
to add a status return to sm_state_mgr_send_master_sm_info_req and only increment the retry_number if that call was "successful".
Quoted 4 lines
The current placement was to avoid potential race
with response handling
and the clearing of the counter there (incrementing after the response were received).
Maybe I'm missing something but I don't see how this changes any potential race condition other than perhaps a smaller time window.
Quoted 1 line
Seemed to me that this could happen with the current locking.
Yes, it looks to me like the locking here needs fixing. I'll send a patch for this shortly...
-- Hal
Quoted 15 lines
Line
Quoted 11 lines
Quoted 11 lines
opensm/osm_sm_state_mgr.c +1
-0+/* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */
sm_state_mgr_send_master_sm_info_req(sm);Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in 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-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] osm_sm_state_mgr.c: Fix handling of polling retry number
In reply to a message not in the archiveQuoted 51 lines · Hal Rosenstock
Quoted 50 lines · Line Holen
Quoted 49 lines · Hal Rosenstock
Quoted 39 lines · Line Holen
The retry counter is now only updated if a packet is actually sent. (But as before the initial request is also counted.)
Prior to this change the actual maximum number of packets sent were polling retry number minus one.
Signed-off-by Line Holen<[email protected]>---
opensm/osm_sm_state_mgr.c +1
-2@@ -197,16 +197,14 @@ void osm_sm_state_mgr_polling_callback(IN void *context) }/* -* Incr the retry number. -* If it reached the max_retry_number in the subnet opt - call +* If retry number reached the max_retry_number in the subnet opt - call
*osm_sm_state_mgr_processwith signalOSM_SM_SIGNAL_POLLING_TIMEOUT*/ - sm->retry_number++; OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "SM State %d (%s), Retry number:%d\n", sm->p_subn->sm_state, osm_get_sm_mgr_state_str(sm->p_subn->sm_state), sm->retry_number);opensm/osm_sm_state_mgr.c +1
-1-if (sm->retry_number>= sm->p_subn->opt.polling_retry_number) { +if (sm->retry_number> sm->p_subn->opt.polling_retry_number) {OSM_LOG (sm->p_log,OSM_LOG_DEBUG ,"Reached polling_retry_number value in retry_number. " "Go to DISCOVERY state\n" );opensm/osm_sm_state_mgr.c void osm_sm_state_mgr_polling_callback(IN void · line 217
Quoted 6 lines
opensm/osm_sm_state_mgr.c +2
-0@@ -214,6 +212,9 @@ void osm_sm_state_mgr_polling_callback(IN void *context) goto Exit; } +/* Increment the retry number */ + sm->retry_number++;Would it be better to increment retry number if
sm_state_mgr_send_master_sm_info_reqcall just below this succeeds ?
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
-- Hal
I'm not sure really.
All I was proposing was a minor variation to what you proposed:
to add a status return tosm_state_mgr_send_master_sm_info_reqand only increment theretry_numberif that call was "successful".
Understood.
Quoted 7 lines
Quoted 5 lines
The current placement was to avoid potential race
with response handling
and the clearing of the counter there (incrementing after the response were received).Maybe I'm missing something but I don't see how this changes any potential race condition other than perhaps a smaller time window.
With the current locking and moving the increment later you could end up processing the response (and clear the counter) and then increment it afterwords in this function. With the suggested patch you'd increment every time you would attempt to send a packet. Not perfect, but at least better than it used to be and it did not introduce any race.
Quoted 4 lines
Quoted 2 lines
Seemed to me that this could happen with the current locking.
Yes, it looks to me like the locking here needs fixing. I'll send a patch for this shortly...
OK, good. Do you want me to send a v2 rebased on top of this patch that incorporate your initial comment ?
Line
Quoted 15 lines
-- Hal
Quoted 12 lines
Line
Quoted 10 lines
Quoted 10 lines
opensm/osm_sm_state_mgr.c +1
-0+/* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */
sm_state_mgr_send_master_sm_info_req(sm);Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in 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-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] osm_sm_state_mgr.c: Fix handling of polling retry number
In reply to a message not in the archiveQuoted 6 lines · Line Holen
Quoted 2 lines · Hal Rosenstock
Yes, it looks to me like the locking here needs fixing. I'll send a patch for this shortly...
OK, good. Do you want me to send a v2 rebased on top of this patch that incorporate
your initial comment ?
Yes, please.
-- Hal
Quoted 3 lines
Line
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html