From patchwork Wed Sep 18 08:35:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Haakon Bugge X-Patchwork-Id: 13806700 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A484A78276; Wed, 18 Sep 2024 08:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726648571; cv=none; b=C5WOG7WvZfNYi6hnTn6ansDjo+wLS7mAjs5fVSElbTiExeXT8e8SPHgG6zbqwID7cFykTQU86I4pDr+Mc8ro5tbmGZ4U1DI6XhTU+6GT1P0/DJS0xvE0LDsaIGHJfTcyY/2ws1plAY/LNPKoyOO+aB27WblhmgVNBZ+YBi3ewNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726648571; c=relaxed/simple; bh=azTz4oKYtBbwKjhXuZO6bye0svRN1gTi51SYvZZgnpQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uHRuAnPIYZLVDxG6J2yBvt2QgHmjTWK4BbKgMvYRH5wrVzX3TIrKKKVcm8mtm6S62QliZ7sS31vAez7Eh6dhHdpv7t2Y4MSdizlfSS1Ns/NVjWkY8Q9/KXbPlU5URf5SKhxKDDhH//S/k46vDCDVJXDhNybTjk/4Vaj4b2tQvDg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=EfOAsC7y; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="EfOAsC7y" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48I7twYd031866; Wed, 18 Sep 2024 08:36:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s= corp-2023-11-20; bh=SMpGMSK5QiT+EAP4hBegW4Vj7pusBqETJivS3nKKK+w=; b= EfOAsC7y1J9egTsrljq2jCn9iS25HP3l/HwOeNdXg9rjwXADtnzJ4sz1J1igVG40 Q36Q4DOuc/56o4gWgEYWvpF9U8YsP6JznIltE6adOhu8EvrVmfKdbBaEpH+HSF8I WmYx/N0YZKf1Aaq/XRs3cUFrmcpSfawVxbqnV+OEQGsfBdrPcTG+IpI++916tllm 2VihA7zhCnsBcv+dNasy633ThqSzRAjzc4rVfc/2YKa1ZygBrqdMRDYSRSBzB+0a D0Ptg7cT/9c0X2Q1/4q6dt4B+YaBEg36QHhw7QAp9SMYiMHRJQydKgQZ0ml2AGBv CH1xYlCKEwmww5gcUCIRaA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41n3n3gnhp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2024 08:36:00 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 48I7U5Sc010493; Wed, 18 Sep 2024 08:36:00 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41nyb7yt21-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2024 08:35:59 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 48I8Zu48022467; Wed, 18 Sep 2024 08:35:59 GMT Received: from lab61.no.oracle.com (lab61.no.oracle.com [10.172.144.82]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 41nyb7ystx-2; Wed, 18 Sep 2024 08:35:59 +0000 From: =?utf-8?q?H=C3=A5kon_Bugge?= To: Jason Gunthorpe , Leon Romanovsky , Allison Henderson , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, rds-devel@oss.oracle.com Subject: [MAINLINE 1/2] RDMA/core: Enable legacy ULPs to use RDMA DIM Date: Wed, 18 Sep 2024 10:35:51 +0200 Message-ID: <20240918083552.77531-2-haakon.bugge@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240918083552.77531-1-haakon.bugge@oracle.com> References: <20240918083552.77531-1-haakon.bugge@oracle.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-18_06,2024-09-16_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 malwarescore=0 suspectscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409180053 X-Proofpoint-GUID: hOZummPjxIhAd6BLYkzUxpcIZZLKIdmo X-Proofpoint-ORIG-GUID: hOZummPjxIhAd6BLYkzUxpcIZZLKIdmo 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. Signed-off-by: Håkon Bugge --- 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 diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c index a70876a0a2312..8e582eca6987f 100644 --- a/drivers/infiniband/core/cq.c +++ b/drivers/infiniband/core/cq.c @@ -7,6 +7,7 @@ #include #include "core_priv.h" +#include "cq.h" #include /* 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) { diff --git a/drivers/infiniband/core/cq.h b/drivers/infiniband/core/cq.h new file mode 100644 index 0000000000000..c55f7d3f1cbf4 --- /dev/null +++ b/drivers/infiniband/core/cq.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Let other files use rdma_dim_{init,destroy} + * + * Author: Håkon Bugge + * + * 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 diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 473ee0831307c..60a64ea77ae25 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -53,6 +53,7 @@ #include #include "core_priv.h" +#include "cq.h" #include 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; From patchwork Wed Sep 18 08:35:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Haakon Bugge X-Patchwork-Id: 13806702 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E93C176FBD; Wed, 18 Sep 2024 08:36:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726648574; cv=none; b=rUgjselwXs7HNiPgmVnoVwmts85mGIlPDhHRld3P8XbwwQ/WV+w+1aFXM+40YyQ/bhZ4nm3eH18mFDCVNohpNfvk1Zjw/s+c5G+RfkNOKWyLF5JADfDhfSPXXR1P5dWxgfP9EzK5qWwMEbcPfvWnzq0HCrdFpjuyesW/rYEw0XQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726648574; c=relaxed/simple; bh=paGxOo8rTLSZFeKKZm/jIgHewVqTk/eu33ao1YKPDTY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tRihUd9crutv2/jtlNSJ8yGmz0m7CHvURhqfB8P+mwK96ARuxEte00vw3cY1G+C66fuCKR852NedpjROURZFwq+vvq9pnAwHG06qKrAfQoVbhlrnRbnq7tVEShG8xMWH5cnOoLbrpJc2A4wpWwGDT7u/eygCrVh2FfvXGOB3OoM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=HoJZhTjy; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="HoJZhTjy" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48I7u7qC022250; Wed, 18 Sep 2024 08:36:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s= corp-2023-11-20; bh=MlawQVvnOFoj7lyUkDcFz2aMZ6uq5jG66mYF94ynjaU=; b= HoJZhTjyVr7tiFRWtTwWa0RwmOUZOUQrqYllLcuL6d2CVfJrWvNInzvwR8e5UCg7 xRYZUXUQnI4IvnJ9j1DKjMdCiskHhvNZT+fgc2jmJbH/pMuHORjbbjF+p3A6D4+B GyF+5jA4I3ETaYP+RZaEV8fVCBdHUbe04cqMbivDVYMRAUxVsDHblUdY7vamx8F6 6g7bh4VI5cP1pKRwW2+LaNr0diAD5IF0UpX6F8/WwzGQpTTf+fqSITOqGQPuBlX5 sGYAhriDP6apJ0/r0tzRdmNHNyNDI8SgrAERSZ7LO8VH7fO+giho+S3jMS5rqVCS i9lurrtWzf0bfFgIbp4Ahw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41n3sd0pap-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2024 08:36:04 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 48I7P6X0010398; Wed, 18 Sep 2024 08:36:03 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41nyb7yt55-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2024 08:36:03 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 48I8Zu4B022467; Wed, 18 Sep 2024 08:36:02 GMT Received: from lab61.no.oracle.com (lab61.no.oracle.com [10.172.144.82]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 41nyb7ystx-3; Wed, 18 Sep 2024 08:36:02 +0000 From: =?utf-8?q?H=C3=A5kon_Bugge?= To: Jason Gunthorpe , Leon Romanovsky , Allison Henderson , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, rds-devel@oss.oracle.com Subject: [MAINLINE 2/2] rds: ib: Add Dynamic Interrupt Moderation to CQs Date: Wed, 18 Sep 2024 10:35:52 +0200 Message-ID: <20240918083552.77531-3-haakon.bugge@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240918083552.77531-1-haakon.bugge@oracle.com> References: <20240918083552.77531-1-haakon.bugge@oracle.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-18_06,2024-09-16_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 malwarescore=0 suspectscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409180053 X-Proofpoint-ORIG-GUID: Er6aC43qNf_iuriETv9reMtU3vz_rDQJ X-Proofpoint-GUID: Er6aC43qNf_iuriETv9reMtU3vz_rDQJ X-Patchwork-Delegate: kuba@kernel.org With 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 Signed-off-by: Håkon Bugge --- net/rds/ib_cm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c index 26b069e1999df..79603d86b6c02 100644 --- a/net/rds/ib_cm.c +++ b/net/rds/ib_cm.c @@ -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);