register_to_trap(): Increase number of iterations from 3 to 5
PATCH 1/1 register_to_trap(): Increase number of iterations from 3 to 5
Master SM changes can take more than three seconds. Hence increase the time during which to wait for a master SM to appear from 3 to 5 seconds.
--- srp_daemon/srp_handle_traps.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
srp_daemon/srp_handle_traps.c +5 -6
@@ -550,8 +550,8 @@ static int register_to_trap(struct sync_resources *sync_res,struct ibv_sge sg;struct ibv_send_wr *_bad_wr =NULL ;struct ibv_send_wr **bad_wr = &_bad_wr; -int counter =0 ; -int rc =0 ; +int counter; +int rc;int ret;long long unsigned comp_mask =0 ;
@@ -609,7 +609,7 @@ static int register_to_trap(struct sync_resources *sync_res, p_sa_mad->comp_mask =htobe64 (comp_mask);pr_debug ("comp_mask: %llx\n" , comp_mask); - do { +for (counter =5 , rc =0 ; counter >0 && rc ==0 ; counter--) {pthread_mutex_lock (res->mad_buffer_mutex); res->mad_buffer->mad_hdr.base_version =0 ;// flag that the buffer is empty pthread_mutex_unlock (res->mad_buffer_mutex);
@@ -640,10 +640,9 @@ static int register_to_trap(struct sync_resources *sync_res, }pthread_mutex_unlock (res->mad_buffer_mutex); }while (rc ==2 );// while old response. + } - }while (rc ==0 && ++counter <3 ); - -if (counter==3 ) { +if (counter ==0 ) {pr_err ("No response to inform info registration\n" );return -EAGAIN ; }
Signature · 6 lines
2.15.1 -- 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
Hal Rosenstock
Reviewed-byQuoted 39 lines · Bart Van Assche
Master SM changes can take more than three seconds. Hence increase the time during which to wait for a master SM to appear from 3 to 5 seconds.
Signed-off-by Bart Van Assche <[email protected]>Cc Hal Rosenstock <[email protected]>Cc Nicolas Morey-Chaisemartin <[email protected]>--- srp_daemon/srp_handle_traps.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)srp_daemon/srp_handle_traps.c +3
-3@@ -550,8 +550,8 @@ static int register_to_trap(struct sync_resources *sync_res,struct ibv_sge sg;struct ibv_send_wr *_bad_wr =NULL ;struct ibv_send_wr **bad_wr = &_bad_wr; -int counter =0 ; -int rc =0 ; +int counter; +int rc;int ret;long long unsigned comp_mask =0 ;@@ -609,7 +609,7 @@ static int register_to_trap(struct sync_resources *sync_res, p_sa_mad->comp_mask =htobe64 (comp_mask);pr_debug ("comp_mask: %llx\n" , comp_mask); - do { +for (counter =5 , rc =0 ; counter >0 && rc ==0 ; counter--) {pthread_mutex_lock (res->mad_buffer_mutex); res->mad_buffer->mad_hdr.base_version =0 ;// flag that the buffer is empty pthread_mutex_unlock (res->mad_buffer_mutex);@@ -640,10 +640,9 @@ static int register_to_trap(struct sync_resources *sync_res, }pthread_mutex_unlock (res->mad_buffer_mutex);
srp_daemon/srp_handle_traps.c static int register_to_trap(struct sync_resources *sync_res, · line 648
Quoted 10 lines
srp_daemon/srp_handle_traps.c +2
-3}while (rc ==2 );// while old response. + } - }while (rc ==0 && ++counter <3 ); - -if (counter==3 ) { +if (counter ==0 ) {pr_err ("No response to inform info registration\n" );return -EAGAIN ; }
--
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 42 lines · Hal Rosenstock
Quoted 41 lines · Bart Van Assche
Master SM changes can take more than three seconds. Hence increase the time during which to wait for a master SM to appear from 3 to 5 seconds.
Signed-off-by Bart Van Assche <[email protected]>Cc Hal Rosenstock <[email protected]>Cc Nicolas Morey-Chaisemartin <[email protected]>--- srp_daemon/srp_handle_traps.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)srp_daemon/srp_handle_traps.c +4
-3@@ -550,8 +550,8 @@ static int register_to_trap(struct sync_resources *sync_res,struct ibv_sge sg;struct ibv_send_wr *_bad_wr =NULL ;struct ibv_send_wr **bad_wr = &_bad_wr; -int counter =0 ; -int rc =0 ; +int counter; +int rc;int ret;long long unsigned comp_mask =0 ;@@ -609,7 +609,7 @@ static int register_to_trap(struct sync_resources *sync_res, p_sa_mad->comp_mask =htobe64 (comp_mask);pr_debug ("comp_mask: %llx\n" , comp_mask); - do { +for (counter =5 , rc =0 ; counter >0 && rc ==0 ; counter--) {pthread_mutex_lock (res->mad_buffer_mutex); res->mad_buffer->mad_hdr.base_version =0 ;// flag that the buffer is empty pthread_mutex_unlock (res->mad_buffer_mutex);@@ -640,10 +640,9 @@ static int register_to_trap(struct sync_resources *sync_res, }pthread_mutex_unlock (res->mad_buffer_mutex); }while (rc ==2 );// while old response. + }
Quoted 11 lines
srp_daemon/srp_handle_traps.c static int register_to_trap(struct sync_resources *sync_res, · line 648
Quoted 8 lines
srp_daemon/srp_handle_traps.c +1
-3- }while (rc ==0 && ++counter <3 ); - -if (counter==3 ) { +if (counter ==0 ) {pr_err ("No response to inform info registration\n" );return -EAGAIN ; }
Given what Nicolas wrote, maybe this should be split into 2 patches with first being refactoring but not changing counter and leave the counter increase for Nicolas.
-- Hal
--
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
T24gRnJpLCAyMDE3LTEyLTA4IGF0IDEzOjE3IC0wNTAwLCBIYWwgUm9zZW5zdG9jayB3cm90ZToN Cj4gR2l2ZW4gd2hhdCBOaWNvbGFzIHdyb3RlLCBtYXliZSB0aGlzIHNob3VsZCBiZSBzcGxpdCBp bnRvIDIgcGF0Y2hlcyB3aXRoDQo+IGZpcnN0IGJlaW5nIHJlZmFjdG9yaW5nIGJ1dCBub3QgY2hh bmdpbmcgY291bnRlciBhbmQgbGVhdmUgdGhlIGNvdW50ZXINCj4gaW5jcmVhc2UgZm9yIE5pY29s YXMuDQoNCkhlbGxvIEhhbCwNCg0KSG93IGFib3V0IHRoZSBwYXRjaCBiZWxvdz8NCg0KVGhhbmtz LA0KDQpCYXJ0Lg0KDQoNCltQQVRDSCBmb3IgcmRtYS1jb3JlXSByZWdpc3Rlcl90b190cmFwKCk6 IFNw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KLQlpZiAoY291bnRlcj09Mykgew0KKwlpZiAoY291bnRlciA9PSAwKSB7DQogCQlwcl9lcnIo Ik5vIHJlc3BvbnNlIHRvIGluZm9ybSBpbmZvIHJlZ2lzdHJhdGlvblxuIik7DQogCQlyZXR1cm4g LUVBR0FJTjsNCiAJfQ0KLS0gDQoyLjE1LjENCg==
--
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
Hal Rosenstock
Reviewed-byQuoted 54 lines · Bart Van Assche
Quoted 3 lines · Hal Rosenstock
Given what Nicolas wrote, maybe this should be split into 2 patches with first being refactoring but not changing counter and leave the counter increase for Nicolas.
Hello Hal,
How about the patch below?
Thanks,
Bart.
[PATCH for rdma-core]
register_to_trap(): Specify number of iterations onceRearrange the loop in
register_to_trap()and also the if-statement after that loop such that the number of iterations only occurs once.Signed-off-by Bart Van Assche <[email protected]>Cc Hal Rosenstock <[email protected]>Cc Nicolas Morey-Chaisemartin <[email protected]>--- srp_daemon/srp_handle_traps.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)srp_daemon/srp_handle_traps.c +3
-3@@ -550,8 +550,8 @@ static int register_to_trap(struct sync_resources *sync_res,struct ibv_sge sg;struct ibv_send_wr *_bad_wr =NULL ;struct ibv_send_wr **bad_wr = &_bad_wr; -int counter =0 ; -int rc =0 ; +int counter; +int rc;int ret;long long unsigned comp_mask =0 ;@@ -609,7 +609,7 @@ static int register_to_trap(struct sync_resources *sync_res, p_sa_mad->comp_mask =htobe64 (comp_mask);pr_debug ("comp_mask: %llx\n" , comp_mask); - do { +for (counter =3 , rc =0 ; counter >0 && rc ==0 ; counter--) {pthread_mutex_lock (res->mad_buffer_mutex); res->mad_buffer->mad_hdr.base_version =0 ;// flag that the buffer is empty pthread_mutex_unlock (res->mad_buffer_mutex);@@ -640,10 +640,9 @@ static int register_to_trap(struct sync_resources *sync_res, }pthread_mutex_unlock (res->mad_buffer_mutex);
srp_daemon/srp_handle_traps.c static int register_to_trap(struct sync_resources *sync_res, · line 648
Quoted 10 lines
srp_daemon/srp_handle_traps.c +2
-3}while (rc ==2 );// while old response. + } - }while (rc ==0 && ++counter <3 ); - -if (counter==3 ) { +if (counter ==0 ) {pr_err ("No response to inform info registration\n" );return -EAGAIN ; }
--
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
Le 08/12/2017 à 19:17, Hal Rosenstock a écrit :
Quoted 53 lines · Hal Rosenstock
Quoted 42 lines · Bart Van Assche
Quoted 41 lines
Master SM changes can take more than three seconds. Hence increase the time during which to wait for a master SM to appear from 3 to 5 seconds.
Signed-off-by Bart Van Assche <[email protected]>Cc Hal Rosenstock <[email protected]>Cc Nicolas Morey-Chaisemartin <[email protected]>--- srp_daemon/srp_handle_traps.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)srp_daemon/srp_handle_traps.c +4
-3@@ -550,8 +550,8 @@ static int register_to_trap(struct sync_resources *sync_res,struct ibv_sge sg;struct ibv_send_wr *_bad_wr =NULL ;struct ibv_send_wr **bad_wr = &_bad_wr; -int counter =0 ; -int rc =0 ; +int counter; +int rc;int ret;long long unsigned comp_mask =0 ;@@ -609,7 +609,7 @@ static int register_to_trap(struct sync_resources *sync_res, p_sa_mad->comp_mask =htobe64 (comp_mask);pr_debug ("comp_mask: %llx\n" , comp_mask); - do { +for (counter =5 , rc =0 ; counter >0 && rc ==0 ; counter--) {pthread_mutex_lock (res->mad_buffer_mutex); res->mad_buffer->mad_hdr.base_version =0 ;// flag that the buffer is empty pthread_mutex_unlock (res->mad_buffer_mutex);@@ -640,10 +640,9 @@ static int register_to_trap(struct sync_resources *sync_res, }pthread_mutex_unlock (res->mad_buffer_mutex); }while (rc ==2 );// while old response. + }Quoted 10 lines
srp_daemon/srp_handle_traps.c static int register_to_trap(struct sync_resources *sync_res, · line 648
Quoted 8 lines
srp_daemon/srp_handle_traps.c +1
-3- }while (rc ==0 && ++counter <3 ); - -if (counter==3 ) { +if (counter ==0 ) {pr_err ("No response to inform info registration\n" );return -EAGAIN ; }
Quoted 5 lines
Given what Nicolas wrote, maybe this should be split into 2 patches with first being refactoring but not changing counter and leave the counter increase for Nicolas.
-- Hal
Yep. I confirm the fix was partly due to the desync between the counter loop and the test for the error message. Your next patch (cleanup without changing counter to 5) makes sense though.
I'll send an updated fix for my issue as soon as I have one !
Nicolas
--
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