From patchwork Tue Oct 19 20:55:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 102305 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4B68DA0C41; Tue, 19 Oct 2021 22:56:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1BE840142; Tue, 19 Oct 2021 22:56:30 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2042.outbound.protection.outlook.com [40.107.102.42]) by mails.dpdk.org (Postfix) with ESMTP id 299454003E for ; Tue, 19 Oct 2021 22:56:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OowQk5PIh81Od5ELRSKscxiZxQSzQTWzMgtJrZY64LrsgAZkYL8ECn06bjvuVSdKXRsKa11kzUZ+oZdjkbOaJOcSaG+qPnUe8ZTloAGzA/o1OUmU36y+UznVxhc2Qn8Mlnh86DuUWVLcfX1By4UBmVK/iZMEU2T5YfwvJ3vensV8OdwBrX2vwzBXx5KUeGqJ7cKOfRSJyLoPEKnax5iK3yvBHlRZ+JzSbCDV8seEb3SNoAwlgGcsOyQNIUZmezYzgyEpwS+ZAa2NFauflRtFWPtkBiOX5lqNGz6+PE4H367ikhYAiYmX2lqr/bbgTe4hpGItWMcJPK+lbtGKDJZ5bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Utks9hNJpozHleYhyp4g/dmlLx62aEnMyVaNbbuVYc0=; b=OUTejO+2qoqfKqvuJsBsqD5wMKO8MWMFUU6G2eskxil/r0OcaKfuGtzQBvz+AYSYrviy7d6pAOQKaw5cpKOtym9IVKr/j3yfXAPOiOa9VXKk/mJbximUdeTtgL8IxukXg1/VKNw3aKmOLH5Ju+uOX0wOqOBV9Fic2cCKyegfIEcbIqgPyqWKIAl209mo0uMwZV7w9sXpwfIVUURAZ2Q8Yp5311djo8KtJ8nbMBQvOmhpvo3vMt4YD6Bs2WxBQTzGy9E3OJb2tl7IJoQsLz0eiG7OrzggXdXuPBPvqQSX0TlUIQcv9keRTH6wHP//3HmjK2QeD9Tmtie1CFpwEzHzmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Utks9hNJpozHleYhyp4g/dmlLx62aEnMyVaNbbuVYc0=; b=dLu5R9m3cQouEqk1W0fCVz6UcXoMfzUdZ1BMhvzTnoMPTz3a5aEpn473wImBmCBVg8bxe99sM8HCZPb4bxnjNTTHnXi6D1dwGgiMqtzT8AYHsM+BSp6Y1eBGOp2cfSyEi+YL5unhgwc4wXDm73ux5xectlTQtNHdErGA4vsrtxRrKOxzE1rnJZXclLLi23x8uHKiMi+pwrzOWRBGimPU38tvbjgj82unEz+8b+EcFftLUOTm3nL1yF1nPGRsC9/rsca2jUKqPsQ0Xyn/8u60NPrHhhp9m17cbSrKi9EjDqCznheAL3TEge0EkJzBNRB3J2iWgxod7Prhm+sX8qf5Fw== Received: from BN9PR03CA0785.namprd03.prod.outlook.com (2603:10b6:408:13f::10) by DM6PR12MB4944.namprd12.prod.outlook.com (2603:10b6:5:1ba::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 20:56:27 +0000 Received: from BN8NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13f:cafe::83) by BN9PR03CA0785.outlook.office365.com (2603:10b6:408:13f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Tue, 19 Oct 2021 20:56:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT012.mail.protection.outlook.com (10.13.177.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 20:56:25 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 19 Oct 2021 20:56:20 +0000 From: To: CC: Matan Azrad , Thomas Monjalon , Michael Baum Date: Tue, 19 Oct 2021 23:55:44 +0300 Message-ID: <20211019205602.3188203-1-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211006220350.2357487-1-michaelba@nvidia.com> References: <20211006220350.2357487-1-michaelba@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 74418a55-c782-4434-0e7b-08d99342eafb X-MS-TrafficTypeDiagnostic: DM6PR12MB4944: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Jx+XrUhiGzO+h3VRaH0SzmYPIVVkteN6yQCcOGZYKeLgesRI/8KCvUdZXdICxFVCpR8444POA4m3DrfeI0ytlfjjdNjGsXy4bdzdwOs+Pe/rBcvpWzJKyGfp92a06BC7OWDwqUozXyfpRfslVZVPPD5MB93JMZij63plTrkq6WfVtaAzBeI88U31g+zL58kDyLvarthOJqUIh6ZXY5inW1zBZ1WnjQsfD5yGrrzL+519Ob3rZPwQrp1oucm5E8bDGh4npsQSiZ2l6pCXrouC+4AWVsSWVYTeOOadye5CUf5X3lbS8cKS+KJ+aYz0eg26EXG0KnOKyQsq5BKst16sSkzmvP3za/IyrbLx9lOOcOehZ+N+aDckzkGcXm9lwSkZvVdViYjh1vbStNGmfWNW2ZzCdfXGnpxFSU2UWA8JW9inT6IDXW6rn1JLXvUV1INhsc0HdcTEiyAGzYxghibMSkn1eJ/o/YVtJSrmxk1f0wHV1jxv1XifoaHvMnxYmPJIrwMaWG2mwkTui28ylvL4Uar13L4bCeCqxXJ1XIW4/qdFoY85gLYjA4crvLdfdTpoZWEEl9Fnv/fY2UdZCy2YXqQFCHthQ6ND2y5dUhnTLzrz6tLer/Fbw7Tf9ihww8FQ83DxSFxGNW4ZhIS0WN08I9LGvIlRiPNvUS8F3iW9PBvaPqb7wHnpZv3vu40nwG0GVbTRCXCyDhv704c1IVvuQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(47076005)(5660300002)(26005)(82310400003)(1076003)(6916009)(7696005)(8676002)(16526019)(70586007)(54906003)(86362001)(316002)(4326008)(508600001)(36860700001)(55016002)(6666004)(186003)(8936002)(83380400001)(2876002)(336012)(356005)(6286002)(426003)(2906002)(7636003)(2616005)(107886003)(36756003)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 20:56:25.9287 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74418a55-c782-4434-0e7b-08d99342eafb X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4944 Subject: [dpdk-dev] [PATCH v3 00/18] mlx5: sharing global MR cache between drivers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Michael Baum The MLNX PMD supports 5 classes (net, RegEx, vDPA, Compress and Crypto). The various drivers are registered under the common driver, and managed by it. In the common driver probing, it calls in a loop the probe function of each driver registered to it. Each driver creates for itself all the objects required for communication with the hardware, as well as a global MR cache that manages memory mappings. The management of the caches separately by the different drivers, is not very efficient. In fact the same memory is managed several times and each caching handle is done by doubling the number of drivers, so we want to manage this cache jointly by the common driver. This feature will move management to common driver in two phases. Phase 1: sharing HW objects between drivers (11 patches) The communication with the hardware - for any MR handle - is conducted by the Protection Domain, so we are motivated to share it between the drivers. However, to create it we need to give the context of the device, so the context must also be shared between the drivers. At this point we will share between the drivers the next trio (CTX, PD, pdn) to create an infrastructure that will allow sharing of dependent objects, and in particular the global MR cache. The common driver itself will create this trio individually for all drivers, before calling their probe function. As a parameter to the probe function, it will give them a pointer to the structure containing the trio. Phase 2: sharing global MR cache between drivers (7 patches) The common driver will add to the structure containing the trio also the structure that manages the global MR cache, and will keep a list of such structures for memory management. In each driver, each queue will manage its own local MR cache. If the queue does not find its cache, it will switch to searching the global MR cache shared by all. Caching access will be through the pointer that the driver received as a parameter in probing. v2: rebase v3: fix compilation issue Michael Baum (18): net/mlx5/windows: fix miss callback register for mem event common/mlx5: share basic probing with the internal drivers common/mlx5: share common definitions common/mlx5: share memory related devargs net/mlx5/windows: rearrange probing code common/mlx5: move basic probing functions to common net/mlx5: remove redundant flag in device config common/mlx5: share device context object common/mlx5: add ROCE disable in context device creation common/mlx5: share the protection domain object common/mlx5: share the HCA capabilities handle net/mlx5: remove redundancy in MR file common/mlx5: add MR ctrl init function common/mlx5: add global MR cache create function common/mlx5: share MR top-half search function common/mlx5: share MR management common/mlx5: support device DMA map and unmap common/mlx5: share MR mempool registration drivers/common/mlx5/linux/mlx5_common_os.c | 280 +++++++- drivers/common/mlx5/linux/mlx5_common_os.h | 16 +- drivers/common/mlx5/linux/mlx5_common_verbs.c | 96 ++- drivers/common/mlx5/linux/mlx5_nl.c | 2 +- drivers/common/mlx5/linux/mlx5_nl.h | 6 +- drivers/common/mlx5/mlx5_common.c | 596 +++++++++++++++--- drivers/common/mlx5/mlx5_common.h | 96 +-- drivers/common/mlx5/mlx5_common_defs.h | 45 ++ drivers/common/mlx5/mlx5_common_mp.h | 11 + drivers/common/mlx5/mlx5_common_mr.c | 192 +++++- drivers/common/mlx5/mlx5_common_mr.h | 76 ++- drivers/common/mlx5/mlx5_common_private.h | 6 - drivers/common/mlx5/mlx5_devx_cmds.h | 12 +- drivers/common/mlx5/mlx5_malloc.h | 1 - drivers/common/mlx5/version.map | 29 +- drivers/common/mlx5/windows/mlx5_common_os.c | 245 ++++++- drivers/common/mlx5/windows/mlx5_common_os.h | 9 +- drivers/compress/mlx5/mlx5_compress.c | 245 ++----- drivers/crypto/mlx5/mlx5_crypto.c | 209 +----- drivers/crypto/mlx5/mlx5_crypto.h | 6 +- drivers/crypto/mlx5/mlx5_crypto_dek.c | 5 +- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 6 +- drivers/net/mlx5/linux/mlx5_mp_os.c | 12 +- drivers/net/mlx5/linux/mlx5_os.c | 511 ++++----------- drivers/net/mlx5/linux/mlx5_verbs.c | 99 +-- drivers/net/mlx5/linux/mlx5_verbs.h | 2 - drivers/net/mlx5/meson.build | 1 - drivers/net/mlx5/mlx5.c | 241 ++----- drivers/net/mlx5/mlx5.h | 57 +- drivers/net/mlx5/mlx5_defs.h | 22 +- drivers/net/mlx5/mlx5_devx.c | 39 +- drivers/net/mlx5/mlx5_flow.c | 6 +- drivers/net/mlx5/mlx5_flow_aso.c | 50 +- drivers/net/mlx5/mlx5_flow_dv.c | 66 +- drivers/net/mlx5/mlx5_flow_verbs.c | 4 +- drivers/net/mlx5/mlx5_mr.c | 397 ------------ drivers/net/mlx5/mlx5_mr.h | 26 - drivers/net/mlx5/mlx5_rx.c | 16 +- drivers/net/mlx5/mlx5_rx.h | 20 +- drivers/net/mlx5/mlx5_rxq.c | 11 +- drivers/net/mlx5/mlx5_rxtx.c | 1 - drivers/net/mlx5/mlx5_rxtx.h | 27 - drivers/net/mlx5/mlx5_rxtx_vec.h | 1 - drivers/net/mlx5/mlx5_trigger.c | 8 +- drivers/net/mlx5/mlx5_tx.c | 1 - drivers/net/mlx5/mlx5_tx.h | 30 +- drivers/net/mlx5/mlx5_txpp.c | 23 +- drivers/net/mlx5/mlx5_txq.c | 10 +- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 12 +- drivers/net/mlx5/windows/mlx5_os.c | 402 ++---------- drivers/regex/mlx5/mlx5_regex.c | 144 +---- drivers/regex/mlx5/mlx5_regex.h | 27 +- drivers/regex/mlx5/mlx5_regex_control.c | 19 +- drivers/regex/mlx5/mlx5_regex_fastpath.c | 47 +- drivers/regex/mlx5/mlx5_rxp.c | 62 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 212 +------ drivers/vdpa/mlx5/mlx5_vdpa.h | 5 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 25 +- drivers/vdpa/mlx5/mlx5_vdpa_lm.c | 6 +- drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 13 +- drivers/vdpa/mlx5/mlx5_vdpa_steer.c | 11 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 15 +- 62 files changed, 2083 insertions(+), 2787 deletions(-) create mode 100644 drivers/common/mlx5/mlx5_common_defs.h delete mode 100644 drivers/net/mlx5/mlx5_mr.c delete mode 100644 drivers/net/mlx5/mlx5_mr.h