From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49C1DC433E0 for ; Tue, 19 May 2020 12:43:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A3F720657 for ; Tue, 19 May 2020 12:43:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726504AbgESMny (ORCPT ); Tue, 19 May 2020 08:43:54 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:42564 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726471AbgESMny (ORCPT ); Tue, 19 May 2020 08:43:54 -0400 Received: from Internal Mail-Server by MTLPINE2 (envelope-from yaminf@mellanox.com) with ESMTPS (AES256-SHA encrypted); 19 May 2020 15:43:49 +0300 Received: from arch012.mtl.labs.mlnx. (arch012.mtl.labs.mlnx [10.7.13.12]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 04JChn9J001676; Tue, 19 May 2020 15:43:49 +0300 From: Yamin Friedman To: Jason Gunthorpe , Sagi Grimberg , Or Gerlitz , Leon Romanovsky Cc: linux-rdma@vger.kernel.org, Yamin Friedman Subject: [PATCH V3 0/4] Introducing RDMA shared CQ pool Date: Tue, 19 May 2020 15:43:32 +0300 Message-Id: <1589892216-39283-1-git-send-email-yaminf@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org This is the fourth re-incarnation of the CQ pool patches proposed by Sagi and Christoph. I have started with the patches that Sagi last submitted and built the CQ pool as a new API for acquiring shared CQs. The main change from Sagi's last proposal is that I have simplified the method that ULP drivers interact with the CQ pool. Instead of calling ib_alloc_cq they now call ib_cq_pool_get but use the CQ in the same manner that they did before. This allows for a much easier transition to using shared CQs by the ULP and makes it easier to deal with IB_POLL_DIRECT contexts. Certain types of actions on CQs have been prevented on shared CQs in order to prevent one user from harming another. Our ULPs often want to make smart decisions on completion vector affinitization when using multiple completion queues spread on multiple cpu cores. We can see examples for this in iser, srp, nvme-rdma. This patch set attempts to move this smartness to the rdma core by introducing per-device CQ pools that by definition spread across cpu cores. In addition, we completely make the completion queue allocation transparent to the ULP by adding affinity hints to create_qp which tells the rdma core to select (or allocate) a completion queue that has the needed affinity for it. This API gives us a similar approach to whats used in the networking stack where the device completion queues are hidden from the application. With the affinitization hints, we also do not compromise performance as the completion queue will be affinitized correctly. One thing that should be noticed is that now different ULPs using this API may share completion queues (given that they use the same polling context). However, even without this API they share interrupt vectors (and CPUs that are assigned to them). Thus aggregating consumers on less completion queues will result in better overall completion processing efficiency per completion event (or interrupt). An advantage of this method of using the CQ pool is that changes in the ULP driver are minimal (around 14 altered lines of code). The patch set converts nvme-rdma and nvmet-rdma to use the new API. Test results can be found in patch-0002. Comments and feedback are welcome. Changes since v2 ---------------- *Minor code refactoring Changes since v1 ---------------- *Simplified cq pool shutdown process *Renamed cq pool functions to be like mr pool *Simplified process for finding cqs in pool *Removed unhelpful WARN prints *Removed one liner functions *Replaced cq_type with boolean shared *Updated test results to more properly show effect of patch *Minor bug fixes Yamin Friedman (4): RDMA/core: Add protection for shared CQs used by ULPs RDMA/core: Introduce shared CQ pool API nvme-rdma: use new shared CQ mechanism nvmet-rdma: use new shared CQ mechanism drivers/infiniband/core/core_priv.h | 3 + drivers/infiniband/core/cq.c | 144 ++++++++++++++++++++++++++++++++++++ drivers/infiniband/core/device.c | 2 + drivers/infiniband/core/verbs.c | 9 +++ drivers/nvme/host/rdma.c | 75 ++++++++++++------- drivers/nvme/target/rdma.c | 14 ++-- include/rdma/ib_verbs.h | 38 ++++++++++ 7 files changed, 253 insertions(+), 32 deletions(-) -- 1.8.3.1