Enable DIM for legacy ULPs and use it in RDS
Subsystems (4)
cover Enable DIM for legacy ULPs and use it in RDS
The Dynamic Interrupt Moderation mechanism can only be used by ULPs using ib_alloc_cq() and family. We extend DIM to also cover legacy ULPs using ib_create_cq(). The last commit takes advantage of this end uses DIM in RDS.
Håkon Bugge (2):
RDMA/core: Enable legacy ULPs to use RDMA DIM
rds: ib: Add Dynamic Interrupt Moderation to CQs
drivers/infiniband/core/cq.c | 7 +++++-- drivers/infiniband/core/cq.h | 16 ++++++++++++++++ drivers/infiniband/core/verbs.c | 6 ++++++ net/rds/ib_cm.c | 10 ++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 drivers/infiniband/core/cq.h
--
2.43.5
PATCH 1/2 RDMA/core: Enable legacy ULPs to use RDMA DIM
The RDMA DIM mechanism is not available for legacy ULPs using ib_create_cq(). Hence, enable it in ib_create_cq_user() if IB_CQ_MODERATE is set in cq_attr.flags.
This way, legacy ULPs can take advantage of RDMA DIM.
--- drivers/infiniband/core/cq.c | 7 +++++-- drivers/infiniband/core/cq.h | 16 ++++++++++++++++ drivers/infiniband/core/verbs.c | 6 ++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 drivers/infiniband/core/cq.h
drivers/infiniband/core/cq.c +5 -2
@@ -7,6 +7,7 @@#include <rdma/ib_verbs.h> #include "core_priv.h" +#include "cq.h" #include <trace/events/rdma_core.h> /* Max size for shared CQ, may require tuning */
@@ -50,7 +51,7 @@ static void ib_cq_rdma_dim_work(struct work_struct *w) cq->device->ops.modify_cq (cq, comps, usec); } -static void rdma_dim_init (struct ib_cq *cq) +void rdma_dim_init (struct ib_cq *cq) {struct dim *dim;
@@ -70,8 +71,9 @@ static void rdma_dim_init(struct ib_cq *cq)INIT_WORK (&dim->work, ib_cq_rdma_dim_work); } +EXPORT_SYMBOL (rdma_dim_init); -static void rdma_dim_destroy (struct ib_cq *cq) +void rdma_dim_destroy (struct ib_cq *cq) {if (!cq->dim)return ;
@@ -79,6 +81,7 @@ static void rdma_dim_destroy(struct ib_cq *cq)cancel_work_sync (&cq->dim->work);kfree (cq->dim); } +EXPORT_SYMBOL (rdma_dim_destroy);static int __poll_cq (struct ib_cq *cq,int num_entries,struct ib_wc *wc) {
drivers/infiniband/core/cq.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Let other files use rdma_dim_{init,destroy} +* +* Author: Håkon Bugge <[email protected]> +* +* Copyright (c) 2024 Oracle and/or its affiliates. +*/ + +#ifndef CQ_H +#define CQ_H + +void rdma_dim_init (struct ib_cq *cq); +void rdma_dim_destroy (struct ib_cq *cq); + +#endif
drivers/infiniband/core/verbs.c +6 -0
@@ -53,6 +53,7 @@#include <rdma/lag.h> #include "core_priv.h" +#include "cq.h" #include <trace/events/rdma_core.h> static int ib_resolve_eth_dmac(struct ib_device *device,
@@ -2161,6 +2162,9 @@ struct ib_cq *__ib_create_cq(struct ib_device *device,return ERR_PTR (ret); } +if (cq_attr->flags &IB_CQ_MODERATE ) +rdma_dim_init (cq); +rdma_restrack_add (&cq->res);return cq; }
@@ -2187,6 +2191,8 @@ int ib_destroy_cq_user(struct ib_cq *cq, struct ib_udata *udata)if (atomic_read (&cq->usecnt))return -EBUSY ; +rdma_dim_destroy (cq); + ret = cq->device->ops.destroy_cq (cq, udata);if (ret)return ret;
Signature · 1 line
2.43.5
PATCH 2/2 rds: ib: Add Dynamic Interrupt Moderation to CQs
In reply to Håkon BuggeWith the support from ib_core to use Dynamic Interrupt Moderation (DIM) from legacy ULPs, which uses ib_create_cq(), we enable that feature for the receive and send CQs in RDS.
A set of rds-stress runs have been done. bcopy read + write for payload 8448 and 16640 bytes and ack/req of 256 bytes. Number of QPs varies from 8 to 128, number of threads (i.e. rds-stress processes) from one to 16 and a depth of four. A limit has been applied such that the number of processes times the number of QPs never exceeds 128. All in all, 61 rds-stress runs.
For brevity, only the rows showing a +/- 3% deviation or larger from base is listed. The geometric mean of the ratios (IOPS_test / IOPS_base) is calculated for all 61 runs, and that gives the best possible "average" impact of the commits.
In the following, "base" is v6.11-rc7. "test" is the same kernel with the following two commits:
* rds: ib: Add Dynamic Interrupt Moderation to CQs (this commit)
* RDMA/core: Enable legacy ULPs to use RDMA DIM
This is executed between two X8-2 with CX-5 using fw 16.35.3502. These BM systems were instantiated with one VF, which were used for the test:
base test
ACK REQ QPS THR DEP IOPS IOPS Percent
256 8448 8 1 4 634463 658162 3.7 256 8448 8 2 4 862648 997358 15.6 256 8448 8 4 4 950458 1113991 17.2 256 8448 8 8 4 932120 1127024 20.9 256 8448 8 16 4 944977 1133885 20.0 8448 256 8 2 4 858663 975563 13.6 8448 256 8 4 4 934884 1098854 17.5 8448 256 8 8 4 928247 1116015 20.2 8448 256 8 16 4 938864 1123455 19.7 256 8448 64 1 4 965985 918445 -4.9 8448 256 64 1 4 963280 918239 -4.7 256 16640 8 2 4 544670 582330 6.9 256 16640 8 4 4 554873 597553 7.7 256 16640 8 8 4 551799 597479 8.3 256 16640 8 16 4 553041 597898 8.1 16640 256 8 2 4 544644 578331 6.2 16640 256 8 4 4 553944 594627 7.3 16640 256 8 8 4 551388 594737 7.9 16640 256 8 16 4 552986 596581 7.9
Geometric mean of ratios: 1.03
--- net/rds/ib_cm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/rds/ib_cm.c +10 -0
@@ -259,6 +259,7 @@ static void rds_ib_cq_comp_handler_recv(struct ib_cq *cq, void *context)static void poll_scq (struct rds_ib_connection *ic,struct ib_cq *cq,struct ib_wc *wcs) { +int ncompleted =0 ;int nr, i;struct ib_wc *wc;
@@ -276,7 +277,10 @@ static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_mr_cqe_handler (ic, wc); } + ncompleted += nr; } +if (cq->dim) +rdma_dim (cq->dim, ncompleted); }static void rds_ib_tasklet_fn_send (unsigned long data)
@@ -304,6 +308,7 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,struct ib_wc *wcs, struct rds_ib_ack_state *ack_state) { + int ncompleted = 0;int nr, i;struct ib_wc *wc;
@@ -316,7 +321,10 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_recv_cqe_handler (ic, wc, ack_state); } + ncompleted += nr; } +if (cq->dim) +rdma_dim (cq->dim, ncompleted); }static void rds_ib_tasklet_fn_recv (unsigned long data)
@@ -542,6 +550,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_scq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_send_ring.w_nr + fr_queue_space +1 ; cq_attr.comp_vector = ic->i_scq_vector; + cq_attr.flags |=IB_CQ_MODERATE ; ic->i_send_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_send, rds_ib_cq_event_handler, conn, &cq_attr);
@@ -556,6 +565,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_rcq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_recv_ring.w_nr; cq_attr.comp_vector = ic->i_rcq_vector; + cq_attr.flags |=IB_CQ_MODERATE ; ic->i_recv_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_recv, rds_ib_cq_event_handler, conn, &cq_attr);
Signature · 1 line
2.43.5
Re: [MAINLINE 2/2] rds: ib: Add Dynamic Interrupt Moderation to CQs
Quoted 3 lines · Håkon Bugge
With the support from
ib_coreto use Dynamic Interrupt Moderation (DIM) from legacy ULPs, which usesib_create_cq(), we enable that feature for the receive and send CQs in RDS.
Hi, Haakon
I am interested in this patch series. I just wonder if the performance of rds is increased after DIM is used in legacy ULPs? That is, is there any benefit to legacy ULPs after DIM is used?
Do you have any test results about this DIM?
Thanks,
Zhu Yanjun
Quoted 109 lines
A set of rds-stress runs have been done. bcopy read + write for payload 8448 and 16640 bytes and ack/req of 256 bytes. Number of QPs varies from 8 to 128, number of threads (i.e. rds-stress processes) from one to 16 and a depth of four. A limit has been applied such that the number of processes times the number of QPs never exceeds 128. All in all, 61 rds-stress runs.
For brevity, only the rows showing a +/- 3% deviation or larger from base is listed. The geometric mean of the ratios (
IOPS_test/IOPS_base) is calculated for all 61 runs, and that gives the best possible "average" impact of the commits.In the following, "base" is v6.11-rc7. "test" is the same kernel with the following two commits:
* rds: ib: Add Dynamic Interrupt Moderation to CQs (this commit)
* RDMA/core: Enable legacy ULPs to use RDMA DIMThis is executed between two X8-2 with CX-5 using fw 16.35.3502. These BM systems were instantiated with one VF, which were used for the test:
base test ACK REQ QPS THR DEP IOPS IOPS Percent 256 8448 8 1 4 634463 658162 3.7 256 8448 8 2 4 862648 997358 15.6 256 8448 8 4 4 950458 1113991 17.2 256 8448 8 8 4 932120 1127024 20.9 256 8448 8 16 4 944977 1133885 20.0 8448 256 8 2 4 858663 975563 13.6 8448 256 8 4 4 934884 1098854 17.5 8448 256 8 8 4 928247 1116015 20.2 8448 256 8 16 4 938864 1123455 19.7 256 8448 64 1 4 965985 918445 -4.9 8448 256 64 1 4 963280 918239 -4.7 256 16640 8 2 4 544670 582330 6.9 256 16640 8 4 4 554873 597553 7.7 256 16640 8 8 4 551799 597479 8.3 256 16640 8 16 4 553041 597898 8.1 16640 256 8 2 4 544644 578331 6.2 16640 256 8 4 4 553944 594627 7.3 16640 256 8 8 4 551388 594737 7.9 16640 256 8 16 4 552986 596581 7.9Geometric mean of ratios: 1.03
Signed-off-by Håkon Bugge <[email protected]>--- net/rds/ib_cm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)net/rds/ib_cm.c +10
-0@@ -259,6 +259,7 @@ static void rds_ib_cq_comp_handler_recv(struct ib_cq *cq, void *context)static void poll_scq (struct rds_ib_connection *ic,struct ib_cq *cq,struct ib_wc *wcs) { +int ncompleted =0 ;int nr, i;struct ib_wc *wc;@@ -276,7 +277,10 @@ static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_mr_cqe_handler (ic, wc); } + ncompleted += nr; } +if (cq->dim) +rdma_dim (cq->dim, ncompleted); }static void rds_ib_tasklet_fn_send (unsigned long data)@@ -304,6 +308,7 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,struct ib_wc *wcs, struct rds_ib_ack_state *ack_state) { + int ncompleted = 0;int nr, i;struct ib_wc *wc;@@ -316,7 +321,10 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_recv_cqe_handler (ic, wc, ack_state); } + ncompleted += nr; } +if (cq->dim) +rdma_dim (cq->dim, ncompleted); }static void rds_ib_tasklet_fn_recv (unsigned long data)@@ -542,6 +550,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_scq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_send_ring.w_nr + fr_queue_space +1 ; cq_attr.comp_vector = ic->i_scq_vector; + cq_attr.flags |=IB_CQ_MODERATE ; ic->i_send_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_send, rds_ib_cq_event_handler, conn, &cq_attr);@@ -556,6 +565,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_rcq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_recv_ring.w_nr; cq_attr.comp_vector = ic->i_rcq_vector; + cq_attr.flags |=IB_CQ_MODERATE ; ic->i_recv_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_recv, rds_ib_cq_event_handler, conn, &cq_attr);
Re: [MAINLINE 2/2] rds: ib: Add Dynamic Interrupt Moderation to CQs
Quoted 9 lines · Zhu Yanjun
Quoted 3 lines · Håkon Bugge
With the support from
ib_coreto use Dynamic Interrupt Moderation (DIM) from legacy ULPs, which usesib_create_cq(), we enable that feature for the receive and send CQs in RDS.
Quoted 6 lines
Hi, Haakon
I am interested in this patch series. I just wonder if the performance of rds is increased after DIM is used in legacy ULPs? That is, is there any benefit to legacy ULPs after DIM is used?
Do you have any test results about this DIM?
Yes, please see the cover letter of this commit.
Thxs, Håkon
Quoted 100 lines
Thanks,
Zhu YanjunQuoted 95 lines
A set of rds-stress runs have been done. bcopy read + write for payload 8448 and 16640 bytes and ack/req of 256 bytes. Number of QPs varies from 8 to 128, number of threads (i.e. rds-stress processes) from one to 16 and a depth of four. A limit has been applied such that the number of processes times the number of QPs never exceeds 128. All in all, 61 rds-stress runs.
For brevity, only the rows showing a +/- 3% deviation or larger from base is listed. The geometric mean of the ratios (IOPS_test/IOPS_base) is calculated for all 61 runs, and that gives the best possible "average" impact of the commits.
In the following, "base" is v6.11-rc7. "test" is the same kernel with the following two commits:
* rds: ib: Add Dynamic Interrupt Moderation to CQs (this commit)
* RDMA/core: Enable legacy ULPs to use RDMA DIM
This is executed between two X8-2 with CX-5 using fw 16.35.3502. These BM systems were instantiated with one VF, which were used for the test:
base test
ACK REQ QPS THR DEP IOPS IOPS Percent256 8448 8 1 4 634463 658162 3.7 256 8448 8 2 4 862648 997358 15.6 256 8448 8 4 4 950458 1113991 17.2 256 8448 8 8 4 932120 1127024 20.9 256 8448 8 16 4 944977 1133885 20.0 8448 256 8 2 4 858663 975563 13.6 8448 256 8 4 4 934884 1098854 17.5 8448 256 8 8 4 928247 1116015 20.2 8448 256 8 16 4 938864 1123455 19.7 256 8448 64 1 4 965985 918445 -4.9 8448 256 64 1 4 963280 918239 -4.7 256 16640 8 2 4 544670 582330 6.9 256 16640 8 4 4 554873 597553 7.7 256 16640 8 8 4 551799 597479 8.3 256 16640 8 16 4 553041 597898 8.1 16640 256 8 2 4 544644 578331 6.2 16640 256 8 4 4 553944 594627 7.3 16640 256 8 8 4 551388 594737 7.9 16640 256 8 16 4 552986 596581 7.9Geometric mean of ratios: 1.03
Signed-off-by Håkon Bugge <[email protected]>--- net/rds/ib_cm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)net/rds/ib_cm.c +1
-0@@ -259,6 +259,7 @@ static void rds_ib_cq_comp_handler_recv(struct ib_cq *cq, void *context)static void poll_scq (struct rds_ib_connection *ic,struct ib_cq *cq,struct ib_wc *wcs) { +int ncompleted =0 ;int nr, i;struct ib_wc *wc; @@ -276,7 +277,10 @@ static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_mr_cqe_handler(ic, wc); }+ ncompleted += nr;
}
+ if (cq->dim)
+rdma_dim(cq->dim, ncompleted);
}
static voidrds_ib_tasklet_fn_send(unsigned long data)net/rds/ib_cm.c +1
-0@@ -304,6 +308,7 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,struct ib_wc *wcs, struct rds_ib_ack_state *ack_state) { + int ncompleted = 0;int nr, i;struct ib_wc *wc; @@ -316,7 +321,10 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_recv_cqe_handler(ic, wc, ack_state);}
+ ncompleted += nr;
}
+ if (cq->dim)
+rdma_dim(cq->dim, ncompleted);
}
static voidrds_ib_tasklet_fn_recv(unsigned long data)net/rds/ib_cm.c +2
-0@@ -542,6 +550,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_scq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_send_ring.w_nr + fr_queue_space +1 ; cq_attr.comp_vector = ic->i_scq_vector; + cq_attr.flags |=IB_CQ_MODERATE ; ic->i_send_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_send, rds_ib_cq_event_handler, conn, &cq_attr);@@ -556,6 +565,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_rcq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_recv_ring.w_nr; cq_attr.comp_vector = ic->i_rcq_vector; + cq_attr.flags |=IB_CQ_MODERATE ; ic->i_recv_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_recv, rds_ib_cq_event_handler, conn, &cq_attr);
Re: [MAINLINE 2/2] rds: ib: Add Dynamic Interrupt Moderation to CQs
Quoted 9 lines · Haakon Bugge
Quoted 9 lines · Zhu Yanjun
Quoted 3 lines · Håkon Bugge
With the support from
ib_coreto use Dynamic Interrupt Moderation (DIM) from legacy ULPs, which usesib_create_cq(), we enable that feature for the receive and send CQs in RDS.
Quoted 8 lines
Quoted 6 lines
Hi, Haakon
I am interested in this patch series. I just wonder if the performance of rds is increased after DIM is used in legacy ULPs? That is, is there any benefit to legacy ULPs after DIM is used?
Do you have any test results about this DIM?
Yes, please see the cover letter of this commit.
Which Oracle Linux distro includes this feature?
And what is the kernel version?
Zhu Yanjun
Quoted 105 lines
Thxs, Håkon
Quoted 100 lines
Thanks,
Zhu YanjunQuoted 95 lines
A set of rds-stress runs have been done. bcopy read + write for payload 8448 and 16640 bytes and ack/req of 256 bytes. Number of QPs varies from 8 to 128, number of threads (i.e. rds-stress processes) from one to 16 and a depth of four. A limit has been applied such that the number of processes times the number of QPs never exceeds 128. All in all, 61 rds-stress runs.
For brevity, only the rows showing a +/- 3% deviation or larger from base is listed. The geometric mean of the ratios (IOPS_test/IOPS_base) is calculated for all 61 runs, and that gives the best possible "average" impact of the commits.
In the following, "base" is v6.11-rc7. "test" is the same kernel with the following two commits:
* rds: ib: Add Dynamic Interrupt Moderation to CQs (this commit)
* RDMA/core: Enable legacy ULPs to use RDMA DIM
This is executed between two X8-2 with CX-5 using fw 16.35.3502. These BM systems were instantiated with one VF, which were used for the test:base test ACK REQ QPS THR DEP IOPS IOPS Percent 256 8448 8 1 4 634463 658162 3.7 256 8448 8 2 4 862648 997358 15.6 256 8448 8 4 4 950458 1113991 17.2 256 8448 8 8 4 932120 1127024 20.9 256 8448 8 16 4 944977 1133885 20.0 8448 256 8 2 4 858663 975563 13.6 8448 256 8 4 4 934884 1098854 17.5 8448 256 8 8 4 928247 1116015 20.2 8448 256 8 16 4 938864 1123455 19.7 256 8448 64 1 4 965985 918445 -4.9 8448 256 64 1 4 963280 918239 -4.7 256 16640 8 2 4 544670 582330 6.9 256 16640 8 4 4 554873 597553 7.7 256 16640 8 8 4 551799 597479 8.3 256 16640 8 16 4 553041 597898 8.1 16640 256 8 2 4 544644 578331 6.2 16640 256 8 4 4 553944 594627 7.3 16640 256 8 8 4 551388 594737 7.9 16640 256 8 16 4 552986 596581 7.9Geometric mean of ratios: 1.03
Signed-off-by Håkon Bugge <[email protected]>--- net/rds/ib_cm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)net/rds/ib_cm.c +1
-0@@ -259,6 +259,7 @@ static void rds_ib_cq_comp_handler_recv(struct ib_cq *cq, void *context)static void poll_scq (struct rds_ib_connection *ic,struct ib_cq *cq,struct ib_wc *wcs) { +int ncompleted =0 ;int nr, i;struct ib_wc *wc; @@ -276,7 +277,10 @@ static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_mr_cqe_handler(ic, wc); } + ncompleted += nr; }+ if (
cq->dim)
+rdma_dim(cq->dim, ncompleted);
}
static voidrds_ib_tasklet_fn_send(unsigned long data)net/rds/ib_cm.c +1
-0@@ -304,6 +308,7 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,struct ib_wc *wcs, struct rds_ib_ack_state *ack_state) { + int ncompleted = 0;int nr, i;struct ib_wc *wc; @@ -316,7 +321,10 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_recv_cqe_handler(ic, wc, ack_state); } + ncompleted += nr; }+ if (
cq->dim)
+rdma_dim(cq->dim, ncompleted);
}
static voidrds_ib_tasklet_fn_recv(unsigned long data)net/rds/ib_cm.c +2
-0@@ -542,6 +550,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_scq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_send_ring.w_nr + fr_queue_space +1 ; cq_attr.comp_vector = ic->i_scq_vector; + cq_attr.flags |=IB_CQ_MODERATE ; ic->i_send_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_send, rds_ib_cq_event_handler, conn, &cq_attr);@@ -556,6 +565,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_rcq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_recv_ring.w_nr; cq_attr.comp_vector = ic->i_rcq_vector; + cq_attr.flags |=IB_CQ_MODERATE ; ic->i_recv_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_recv, rds_ib_cq_event_handler, conn, &cq_attr);
Re: [MAINLINE 2/2] rds: ib: Add Dynamic Interrupt Moderation to CQs
In reply to Håkon BuggeQuoted 97 lines · Håkon Bugge
With the support from
ib_coreto use Dynamic Interrupt Moderation (DIM) from legacy ULPs, which usesib_create_cq(), we enable that feature for the receive and send CQs in RDS.A set of rds-stress runs have been done. bcopy read + write for payload 8448 and 16640 bytes and ack/req of 256 bytes. Number of QPs varies from 8 to 128, number of threads (i.e. rds-stress processes) from one to 16 and a depth of four. A limit has been applied such that the number of processes times the number of QPs never exceeds 128. All in all, 61 rds-stress runs.
For brevity, only the rows showing a +/- 3% deviation or larger from base is listed. The geometric mean of the ratios (
IOPS_test/IOPS_base) is calculated for all 61 runs, and that gives the best possible "average" impact of the commits.In the following, "base" is v6.11-rc7. "test" is the same kernel with the following two commits:
* rds: ib: Add Dynamic Interrupt Moderation to CQs (this commit)
* RDMA/core: Enable legacy ULPs to use RDMA DIMThis is executed between two X8-2 with CX-5 using fw 16.35.3502. These BM systems were instantiated with one VF, which were used for the test:
base test ACK REQ QPS THR DEP IOPS IOPS Percent 256 8448 8 1 4 634463 658162 3.7 256 8448 8 2 4 862648 997358 15.6 256 8448 8 4 4 950458 1113991 17.2 256 8448 8 8 4 932120 1127024 20.9 256 8448 8 16 4 944977 1133885 20.0 8448 256 8 2 4 858663 975563 13.6 8448 256 8 4 4 934884 1098854 17.5 8448 256 8 8 4 928247 1116015 20.2 8448 256 8 16 4 938864 1123455 19.7 256 8448 64 1 4 965985 918445 -4.9 8448 256 64 1 4 963280 918239 -4.7 256 16640 8 2 4 544670 582330 6.9 256 16640 8 4 4 554873 597553 7.7 256 16640 8 8 4 551799 597479 8.3 256 16640 8 16 4 553041 597898 8.1 16640 256 8 2 4 544644 578331 6.2 16640 256 8 4 4 553944 594627 7.3 16640 256 8 8 4 551388 594737 7.9 16640 256 8 16 4 552986 596581 7.9Geometric mean of ratios: 1.03
Signed-off-by Håkon Bugge <[email protected]>--- net/rds/ib_cm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)net/rds/ib_cm.c +8
-0@@ -259,6 +259,7 @@ static void rds_ib_cq_comp_handler_recv(struct ib_cq *cq, void *context)static void poll_scq (struct rds_ib_connection *ic,struct ib_cq *cq,struct ib_wc *wcs) { +int ncompleted =0 ;int nr, i;struct ib_wc *wc;@@ -276,7 +277,10 @@ static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_mr_cqe_handler (ic, wc); } + ncompleted += nr; } +if (cq->dim) +rdma_dim (cq->dim, ncompleted); }static void rds_ib_tasklet_fn_send (unsigned long data)@@ -304,6 +308,7 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,struct ib_wc *wcs, struct rds_ib_ack_state *ack_state) { + int ncompleted = 0;int nr, i;struct ib_wc *wc;@@ -316,7 +321,10 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,rds_ib_recv_cqe_handler (ic, wc, ack_state); } + ncompleted += nr; } +if (cq->dim) +rdma_dim (cq->dim, ncompleted); }static void rds_ib_tasklet_fn_recv (unsigned long data)
net/rds/ib_cm.c static int rds_ib_setup_qp(struct rds_connection *conn) · line 553
Quoted 4 lines
net/rds/ib_cm.c +1
-0@@ -542,6 +550,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_scq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_send_ring.w_nr + fr_queue_space +1 ; cq_attr.comp_vector = ic->i_scq_vector; + cq_attr.flags |=IB_CQ_MODERATE ;
cq_attr.flags is added IB_CQ_MODERATE here.
net/rds/ib_cm.c static int rds_ib_setup_qp(struct rds_connection *conn) · line 568
Quoted 8 lines
net/rds/ib_cm.c +1
-0ic->i_send_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_send, rds_ib_cq_event_handler, conn, &cq_attr);@@ -556,6 +565,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) ic->i_rcq_vector =ibdev_get_unused_vector (rds_ibdev); cq_attr.cqe = ic->i_recv_ring.w_nr; cq_attr.comp_vector = ic->i_rcq_vector; + cq_attr.flags |=IB_CQ_MODERATE ;
Why is cq_attr.flags add IB_CQ_MODERATE again?
Is this cq_attr.flags changed before this line?
Zhu Yanjun
Quoted 3 lines
net/rds/ib_cm.c +0
-0ic->i_recv_cq =ib_create_cq (dev, rds_ib_cq_comp_handler_recv, rds_ib_cq_event_handler, conn, &cq_attr);
Quoted 4 lines · Håkon Bugge
The Dynamic Interrupt Moderation mechanism can only be used by ULPs using
ib_alloc_cq()and family. We extend DIM to also cover legacy ULPs usingib_create_cq(). The last commit takes advantage of this end uses DIM in RDS.
I would much prefer if you could move RDS off that horrible API finally instead of investing more effort into it and making it more complicated.
Hi Christoph,
Quoted 10 lines · Christoph Hellwig
Quoted 4 lines · Håkon Bugge
The Dynamic Interrupt Moderation mechanism can only be used by ULPs using
ib_alloc_cq()and family. We extend DIM to also cover legacy ULPs usingib_create_cq(). The last commit takes advantage of this end uses DIM in RDS.I would much prefer if you could move RDS off that horrible API finally instead of investing more effort into it and making it more complicated.
ib_alloc_cq() and family does not support arming the CQ with the IB_CQ_SOLICITED flag, which RDS uses.
Thxs, Håkon
Quoted 4 lines · Haakon Bugge
Quoted 2 lines
I would much prefer if you could move RDS off that horrible API finally instead of investing more effort into it and making it more complicated.
ib_alloc_cq()and family does not support arming the CQ with theIB_CQ_SOLICITEDflag, which RDS uses.
Then work on supporting it. RDS and SMC are the only users, so one of the maintainers needs to drive it.
Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Haakon Bugge
Quoted 2 lines
I would much prefer if you could move RDS off that horrible API finally instead of investing more effort into it and making it more complicated.
ib_alloc_cq()and family does not support arming the CQ with theIB_CQ_SOLICITEDflag, which RDS uses.Then work on supporting it. RDS and SMC are the only users, so one
Some other open source projects are also the users.
Zhu Yanjun
Quoted 2 lines
of the maintainers needs to drive it.
Quoted 10 lines · Zhu Yanjun
Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Haakon Bugge
Quoted 2 lines
I would much prefer if you could move RDS off that horrible API finally instead of investing more effort into it and making it more complicated.
ib_alloc_cq()and family does not support arming the CQ with theIB_CQ_SOLICITEDflag, which RDS uses.Then work on supporting it. RDS and SMC are the only users, so one
Some other open source projects are also the users.
What are these projects? I see only RDS and SMC.
Thanks
Quoted 7 lines
Zhu Yanjun
Quoted 2 lines
of the maintainers needs to drive it.
Quoted 10 lines · Zhu Yanjun
Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Haakon Bugge
Quoted 2 lines
I would much prefer if you could move RDS off that horrible API finally instead of investing more effort into it and making it more complicated.
ib_alloc_cq()and family does not support arming the CQ with theIB_CQ_SOLICITEDflag, which RDS uses.Then work on supporting it. RDS and SMC are the only users, so one
Some other open source projects are also the users.
I'm not sure what you mean with "open source projects", but the only thing that matters is users in the kernel tree.
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Zhu Yanjun
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Haakon Bugge
Quoted 2 lines
I would much prefer if you could move RDS off that horrible API finally instead of investing more effort into it and making it more complicated.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
ib_alloc_cq()and family does not support arming the CQ with theIB_CQ_SOLICITEDflag, which RDS uses.Then work on supporting it. RDS and SMC are the only users, so one
Some other open source projects are also the users.
I'm not sure what you mean with "open source projects", but the only thing that matters is users in the kernel tree.
The users that I mentioned is not in the kernel tree.
Best Regards,
Zhu Yanjun
Quoted 1 line
Quoted 1 line · Zhu Yanjun
The users that I mentioned is not in the kernel tree.
And why do you think that would matter the slightest?
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · Zhu Yanjun
The users that I mentioned is not in the kernel tree.
And why do you think that would matter the slightest?
I noticed that the same cq functions are used. And I also made tests with this patch series. Without this patch series, dim mechanism will not be invoked.
Zhu Yanjun
Quoted 1 line
Quoted 10 lines · Zhu Yanjun
Quoted 3 lines · Christoph Hellwig
Quoted 1 line · Zhu Yanjun
The users that I mentioned is not in the kernel tree.
And why do you think that would matter the slightest?
I noticed that the same cq functions are used. And I also made tests with this patch series. Without this patch series, dim mechanism will not be invoked.
Christoph alluded to say: Do not modify the old cq_create_cq() code in order to support DIM, it is better to change the ULP to use ib_alloc_cq(), and get DIM enabled that way.
Thxs, Håkon
Quoted 4 lines · Haakon Bugge
Quoted 4 lines · Zhu Yanjun
Quoted 8 lines
Quoted 6 lines · Christoph Hellwig
Quoted 3 lines · Zhu Yanjun
Quoted 1 line
The users that I mentioned is not in the kernel tree.
And why do you think that would matter the slightest?
I noticed that the same cq functions are used. And I also made tests with this patch series. Without this patch series, dim mechanism will not be invoked.
Christoph alluded to say: Do not modify the old
cq_create_cq()code in order to support DIM, it is better to change the ULP to useib_alloc_cq(), and get DIM enabled that way.
Hi, Haakon
To be honest, I like your original commit that enable DIM for legacy ULPs because this can fix this problem once for all and improve the old ib_create_cq function.
The idea from Christoph will cause a lot of changes in ULPs. I am not very sure if these changes cause risks or not.
Thus, I prefer to your original commit. But I will follow the advice from Leon and Jason.
Zhu Yanjun
Quoted 4 lines
Thxs, Håkon
Quoted 20 lines · Zhu Yanjun
Quoted 4 lines · Haakon Bugge
Quoted 4 lines · Zhu Yanjun
Quoted 8 lines
Quoted 6 lines · Christoph Hellwig
Quoted 3 lines · Zhu Yanjun
Quoted 1 line
The users that I mentioned is not in the kernel tree.
And why do you think that would matter the slightest?
I noticed that the same cq functions are used. And I also made tests with this patch series. Without this patch series, dim mechanism will not be invoked.
Christoph alluded to say: Do not modify the old
cq_create_cq()code in order to support DIM, it is better to change the ULP to useib_alloc_cq(), and get DIM enabled that way.Hi, Haakon
To be honest, I like your original commit that enable DIM for legacy ULPs because this can fix this problem once for all and improve the old
ib_create_cqfunction.
Quoted 5 lines
The idea from Christoph will cause a lot of changes in ULPs. I am not very sure if these changes cause risks or not.
Thus, I prefer to your original commit. But I will follow the advice from Leon and Jason.
Christoph was very clear and he summarized our position very well. We said similar thing to SMC folks in 2022 [1] and RDS is no different here.
So no, "old ib_create_cq" shouldn't be used by ULPs.
Thanks
[1] https://lore.kernel.org/netdev/YePesYRnrKCh1vFy@unreal/
Quoted 9 lines
Zhu Yanjun
Quoted 4 lines
Thxs, Håkon
Quoted 21 lines · Leon Romanovsky
Quoted 20 lines · Zhu Yanjun
Quoted 4 lines · Haakon Bugge
Quoted 4 lines · Zhu Yanjun
Quoted 8 lines
Quoted 6 lines · Christoph Hellwig
Quoted 3 lines · Zhu Yanjun
Quoted 1 line
The users that I mentioned is not in the kernel tree.
And why do you think that would matter the slightest?
I noticed that the same cq functions are used. And I also made tests with this patch series. Without this patch series, dim mechanism will not be invoked.
Christoph alluded to say: Do not modify the old
cq_create_cq()code in order to support DIM, it is better to change the ULP to useib_alloc_cq(), and get DIM enabled that way.Hi, Haakon
To be honest, I like your original commit that enable DIM for legacy ULPs because this can fix this problem once for all and improve the old
ib_create_cqfunction.
Quoted 8 lines
Quoted 5 lines
The idea from Christoph will cause a lot of changes in ULPs. I am not very sure if these changes cause risks or not.
Thus, I prefer to your original commit. But I will follow the advice from Leon and Jason.
Christoph was very clear and he summarized our position very well. We said similar thing to SMC folks in 2022 [1] and RDS is no different here.
Thanks, Leon. I will read this link carefully.
Quoted 2 lines
So no, "old
ib_create_cq" shouldn't be used by ULPs.
Got it. I have replaced ib_create_cq with ib cq pool APIs. Perhaps drivers/infiniband/ulp/srpt/ib_srpt.c is a good example to use ib cq pool APIs.
Best Regards,
Zhu Yanjun
Quoted 14 lines
Thanks
[1] https://lore.kernel.org/netdev/YePesYRnrKCh1vFy@unreal/
Quoted 9 lines
Zhu Yanjun
Quoted 4 lines
Thxs, Håkon
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Haakon Bugge
Quoted 2 lines
I would much prefer if you could move RDS off that horrible API finally instead of investing more effort into it and making it more complicated.
ib_alloc_cq()and family does not support arming the CQ with theIB_CQ_SOLICITEDflag, which RDS uses.Then work on supporting it. RDS and SMC are the only users, so one of the maintainers needs to drive it.
I took a quick look at what it would take, and adding IB_CQ_SOLICITED support to the cq API looks pretty trivial, you'll just need to pass it to ib_cq_pool_get by adding a new argument and the pass it down to __ib_alloc_cq. So yes, please get started at moving RDS out of the stone age.
Quoted 11 lines · Christoph Hellwig
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Haakon Bugge
Quoted 2 lines
I would much prefer if you could move RDS off that horrible API finally instead of investing more effort into it and making it more complicated.
ib_alloc_cq()and family does not support arming the CQ with theIB_CQ_SOLICITEDflag, which RDS uses.
Quoted 8 lines
Quoted 2 lines
Then work on supporting it. RDS and SMC are the only users, so one of the maintainers needs to drive it.
I took a quick look at what it would take, and adding
IB_CQ_SOLICITEDsupport to the cq API looks pretty trivial, you'll just need to pass it toib_cq_pool_getby adding a new argument and the pass it down to__ib_alloc_cq. So yes, please get started at moving RDS out of the stone age.
Agree. I'll work on that. I am also inclined to improve it by having designated CPUs where the worker threads polling the CQs execute, as that often improves cache hit rates. But that will come as another commit.
Thxs, Håkon
Quoted 28 lines · Haakon Bugge
Quoted 19 lines
On 24 Sep 2024, at 09:01, Christoph Hellwig <[email protected]> wrote:
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Haakon Bugge
Quoted 4 lines
I would much prefer if you could move RDS off that horrible API finally
instead of investing more effort into it and making it more complicated.Quoted 6 lines
Quoted 2 lines
ib_alloc_cq()and family does not support arming the CQ with theIB_CQ_SOLICITEDflag, which RDS uses.Then work on supporting it. RDS and SMC are the only users, so one
of the maintainers needs to drive it.Quoted 8 lines
I took a quick look at what it would take, and adding
IB_CQ_SOLICITED
support to the cq API looks pretty trivial, you'll just need to pass
it toib_cq_pool_getby adding a new argument and the pass it down to __ib_alloc_cq. So yes, please get started at moving RDS out
of the stone age.
Quoted 8 lines
Agree. I'll work on that. I am also inclined to improve it by having designated CPUs where the worker threads polling the CQs execute, as that often improves cache hit rates. But that will come as another commit.
Thxs, Håkon
Ok, sounds like a good plan then. Thanks for working on this Haakon!
Allison