Skip to content

Commit 9ffe64b

Browse files
committed
perftest: enable CQ events support for WRITE_IMM operations
Remove the restriction that prevented WRITE_IMM operations from using completion queue events. As WRITE_IMM posts to the reciever CQ, there's no reason not to support the event parameter (-e) as in WRITE. Changes include: - Remove WRITE_IMM exclusion from events parameter parsing - Add CQ notification setup for write_bw and write_lat tools - Implement event notification in run_iter_lat_write_imm() - Update polling logic to respect use_event flag Reviewed-by: Michael Margolin <[email protected]> Reviewed-by: Yonatan Nachum <[email protected]> Signed-off-by: Ramon Fried <[email protected]>
1 parent 9c3ab97 commit 9ffe64b

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

src/perftest_parameters.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
321321
printf(" -D, --duration ");
322322
printf(" Run test for a customized period of seconds. (SYMMETRIC)\n");
323323

324-
if (verb != WRITE && verb != WRITE_IMM && connection_type != RawEth) {
324+
if (verb != WRITE && connection_type != RawEth) {
325325
printf(" -e, --events ");
326326
printf(" Sleep on CQ events (default poll)\n");
327327

@@ -2935,7 +2935,7 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
29352935
}
29362936
break;
29372937
case 'e': user_param->use_event = ON;
2938-
if (user_param->verb == WRITE || user_param->verb == WRITE_IMM) {
2938+
if (user_param->verb == WRITE) {
29392939
fprintf(stderr," Events feature not available on WRITE verb\n");
29402940
free(duplicates_checker);
29412941
return FAILURE;

src/perftest_resources.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4945,7 +4945,7 @@ int run_iter_lat_write_imm(struct pingpong_context *ctx,struct perftest_paramete
49454945
uint64_t scnt = 0;
49464946
uint64_t ccnt = 0;
49474947
uint64_t rcnt = 0;
4948-
int ne;
4948+
int ne = 0;
49494949
int err = 0;
49504950
volatile char *post_buf = NULL;
49514951

@@ -4992,8 +4992,15 @@ int run_iter_lat_write_imm(struct pingpong_context *ctx,struct perftest_paramete
49924992
if ((rcnt < user_param->iters || user_param->test_type == DURATION) && !(scnt < 1 && user_param->machine == SERVER)) {
49934993
rcnt++;
49944994

4995+
if (user_param->use_event) {
4996+
if (ctx_notify_events(ctx->recv_channel)) {
4997+
fprintf(stderr , " Failed to notify events to CQ\n");
4998+
return 1;
4999+
}
5000+
}
5001+
49955002
/* Poll for a completion */
4996-
do { ne = ibv_poll_cq(ctx->recv_cq, 1, &wc); } while (ne == 0 && !(user_param->test_type == DURATION && user_param->state == END_STATE));
5003+
do { ne = ibv_poll_cq(ctx->recv_cq, 1, &wc); } while (!user_param->use_event && ne == 0 && !(user_param->test_type == DURATION && user_param->state == END_STATE));
49975004
if (ne > 0) {
49985005
if (wc.status != IBV_WC_SUCCESS) {
49995006
//coverity[uninit_use_in_call]
@@ -5053,6 +5060,13 @@ int run_iter_lat_write_imm(struct pingpong_context *ctx,struct perftest_paramete
50535060

50545061
if (ccnt < user_param->iters || user_param->test_type == DURATION) {
50555062

5063+
if (user_param->use_event && ne == 0) {
5064+
if (ctx_notify_events(ctx->send_channel)) {
5065+
fprintf(stderr, "Couldn't request CQ notification\n");
5066+
return 1;
5067+
}
5068+
}
5069+
50565070
do { ne = ibv_poll_cq(ctx->send_cq, 1, &wc); } while (ne == 0);
50575071

50585072
if(ne > 0) {

src/write_bw.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,17 @@ int main(int argc, char *argv[])
222222
ctx_print_pingpong_data(&rem_dest[i],&user_comm);
223223
}
224224

225+
if (user_param.use_event) {
226+
if (ibv_req_notify_cq(ctx.send_cq, 0)) {
227+
fprintf(stderr, " Couldn't request CQ notification\n");
228+
goto destroy_context;
229+
}
230+
if (ibv_req_notify_cq(ctx.recv_cq, 0)) {
231+
fprintf(stderr, " Couldn't request CQ notification\n");
232+
goto destroy_context;
233+
}
234+
}
235+
225236
/* An additional handshake is required after moving qp to RTR. */
226237
if (ctx_hand_shake(&user_comm,&my_dest[0],&rem_dest[0])) {
227238
fprintf(stderr," Failed to exchange data between server and clients\n");

src/write_lat.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,17 @@ int main(int argc, char *argv[])
243243
ctx_print_pingpong_data(&rem_dest[i],&user_comm);
244244
}
245245

246+
if (user_param.use_event) {
247+
if (ibv_req_notify_cq(ctx.send_cq, 0)) {
248+
fprintf(stderr, " Couldn't request CQ notification\n");
249+
goto destroy_context;
250+
}
251+
if (ibv_req_notify_cq(ctx.recv_cq, 0)) {
252+
fprintf(stderr, " Couldn't request CQ notification\n");
253+
goto destroy_context;
254+
}
255+
}
256+
246257
/* An additional handshake is required after moving qp to RTR. */
247258
if (ctx_hand_shake(&user_comm,my_dest,rem_dest)) {
248259
fprintf(stderr,"Failed to exchange data between server and clients\n");

0 commit comments

Comments
 (0)