From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22D9DA0C41; Sun, 7 Nov 2021 16:30:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6AB4C4111C; Sun, 7 Nov 2021 16:30:30 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2073.outbound.protection.outlook.com [40.107.244.73]) by mails.dpdk.org (Postfix) with ESMTP id AB9B141134; Sun, 7 Nov 2021 16:30:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DF5TXrhxLaRe9Aq8M82W01r6DIhaDJ7SKGRW6ALbeHPIDBSRMV6GlqeokRtFjvVz3SW3BS13Uq6wg99Id20AS8MgoeDGUc5xW7yVqDkVQ860S8CI41UpZaYtdj5DJ7HAZuXSXQD/S86LNrX/+/yjsN7suHWFqM948pwhth2hvHl+Dm7zPARQWV0bDNe7O7eIxnvo1jRn0r00YyqDcPMZ97VDJvucFK0dUxNfd8HEbG8DhuIV+X73Y1RNmcaMwmotooR3yGETguYtsXeEBDHEHdtEfLMiHIcwcPnqofqdAD8ymUOb0sPNq7iOLCCIUl5lnbiplGFGRc1irgb8oKjIPA== 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=lmJsMikXnPydeGxO45Kyp2IgVhTo2Nuaf47Bnq7tpDs=; b=OxFLk9w+oKTVu9afWEfrCaIyzrdRf8dTuGt39HhFmurzvW3OdIZHVjCsGYfQ9oTnkXggL7a0gdc/eqyvMdXInWXjQsvZKCHmTAp9blYMPC3/IzIMkcb1KBN3J9Wd48LAEoIb1JCSnicuhRxwS0d5/jRpgLkSnmNHc1EF5/6ARNJ3SYtklL5OpXzTfjkTsBWKokZZiyt8t1kX3Z5sq0oph09dq4Ci8ZYeYx/c32X0QK4X8ETvvBvQUWW0SQc44OqC6ZqvPETDfJbIKghe3dFUqfTs+u12soTCyDqtk8OoyC8zBHOsyXQSieJFSj3rpvxwvs8VvRTnNMEZlzkjIIXycQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org 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=lmJsMikXnPydeGxO45Kyp2IgVhTo2Nuaf47Bnq7tpDs=; b=UwFLzhvlTdSUE/P3IMS0MHQxT4cUOGfUCNZPuGSDrdckefXLl0XYhBvH0b2oro3Ij6Rs5h/eNX433ox2pRIsz9Y7x8WwIgO3mjfW+dTm7x8t1h8DoMn+G2+V01pL2Za/confpCvJE6a3K94x+5XsGl3TynQsbwCxk7Lq3xoiX9NZ1wZ05qvUb8asFty4jZijucZjtHdVEdXmZuY6bk/N4BFxYRzLCKT7zp68qToDdkJZ1IyldGoAiELaSiw9VzAxLmoteCWE6MEJRlotexCLsjOQC7LA9km6TAGz/PfIZJ67J6V9Ag1g0EXcaTJfipuwZ+u/6MB8+fJazA9oLAJbkQ== Received: from MWHPR21CA0041.namprd21.prod.outlook.com (2603:10b6:300:129::27) by DM5PR12MB2344.namprd12.prod.outlook.com (2603:10b6:4:b2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Sun, 7 Nov 2021 15:30:26 +0000 Received: from CO1NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:300:129:cafe::a) by MWHPR21CA0041.outlook.office365.com (2603:10b6:300:129::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.0 via Frontend Transport; Sun, 7 Nov 2021 15:30:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 CO1NAM11FT054.mail.protection.outlook.com (10.13.174.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Sun, 7 Nov 2021 15:30:25 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 7 Nov 2021 15:30:23 +0000 From: Matan Azrad To: Viacheslav Ovsiienko CC: , Thomas Monjalon , , Michael Baum Date: Sun, 7 Nov 2021 17:29:17 +0200 Message-ID: <20211107152919.2158802-4-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211107152919.2158802-1-matan@nvidia.com> References: <20211107152919.2158802-1-matan@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1529d0b9-2425-4540-21d7-08d9a203858b X-MS-TrafficTypeDiagnostic: DM5PR12MB2344: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:38; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hHVuwdbjdoh7aiDbtZXbdUtMpwJBaAZmtnmBIbdarqzVodOCtF3urkxNQVTbNeksEUCjRwkOP8A8PZzneP9BJPqNz5ZRN+coJDjUe35aAi0zHgBS4GeZQBz6g6ERWKlMcxcsH4D2hBIu3wjjlJREcKsX4HWHXChkHHhs6ky5iVBkdi5HkdD9Z5EoPYNoYsEU1hGOevgfZgXwnZ/aZxBFPzelO4ZTqCEjMRJxeWRNgs7O1DP2saY9UwtxbIY794rziE9LdmsX68iwHXP+XsHd5Sv2c/dH8Nj1pJLelS0ZbxOWEyHnwhBI9dOd9oUiESRak8H/1GxjW8gtqZ4ajpYXpKoCBKTsJiIjI2RxS1pk2XPtgm9opsImFXHiX6QYtwk2c1n4eTq70Pp03iWEbReq7Esoa7UUte+gaNln3RN5s14ZDSL6/Gq5b/1YiUg7rhRnUQzMaKw6O/ur84Ej9zAHNE/x5lJUoeDS44GJRbxSZYAZNqpcgdFgA0VPNbtbT8xuG8CUQKSQf0WxU/vEAmbK1/BucG9IdACV76blW8bHoz2vBoiz0ovmrb/xfej2HzCjKXLHH17V/ZKANXGQf9HEX018Kbi+C1PhLENnGWWuQc2cfj3qM02+MPLXVadMfEQI2i+M4uvDr1A8gzOlIT+cb1sIY7iFC6otr33qakpvwNXvcfSogeUCU/4kqzinxPtloTxAYtjYOZTsmHlGnuQo9JsRaB1j1zrVXpKa48hwk1I= 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)(86362001)(37006003)(508600001)(2616005)(316002)(7696005)(36756003)(36906005)(426003)(6862004)(82310400003)(336012)(2906002)(107886003)(1076003)(70206006)(54906003)(70586007)(4326008)(36860700001)(47076005)(83380400001)(5660300002)(26005)(6286002)(16526019)(8936002)(6636002)(186003)(55016002)(8676002)(7636003)(356005)(6666004)(14143004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2021 15:30:25.7735 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1529d0b9-2425-4540-21d7-08d9a203858b 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: CO1NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2344 Subject: [dpdk-dev] [PATCH 3/5] vdpa/mlx5: workaround dirty bitmap MR creation 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" Due to kernel driver/FW issues in direct MKEY creation using the DevX API, this patch replaces the dirty bitmap MR creation to use wrapped mkey instead. Fixes: 9d39e57f21ac ("vdpa/mlx5: support live migration") Cc: stable@dpdk.org Signed-off-by: Michael Baum Signed-off-by: Matan Azrad --- drivers/vdpa/mlx5/mlx5_vdpa.h | 1 + drivers/vdpa/mlx5/mlx5_vdpa_lm.c | 37 ++++++------------------------- drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 2 ++ 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h index a6c9404cb0..3a7cf088b8 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.h +++ b/drivers/vdpa/mlx5/mlx5_vdpa.h @@ -147,6 +147,7 @@ struct mlx5_vdpa_priv { struct mlx5_vdpa_steer steer; struct mlx5dv_var *var; void *virtq_db_addr; + struct mlx5_pmd_wrapped_mr lm_mr; SLIST_HEAD(mr_list, mlx5_vdpa_query_mr) mr_list; struct mlx5_vdpa_virtq virtqs[]; }; diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_lm.c b/drivers/vdpa/mlx5/mlx5_vdpa_lm.c index 3e8d9eb9a2..45a968bb6a 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_lm.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_lm.c @@ -36,38 +36,21 @@ int mlx5_vdpa_dirty_bitmap_set(struct mlx5_vdpa_priv *priv, uint64_t log_base, uint64_t log_size) { - struct mlx5_devx_mkey_attr mkey_attr = { - .addr = (uintptr_t)log_base, - .size = log_size, - .pd = priv->cdev->pdn, - .pg_access = 1, - }; struct mlx5_devx_virtq_attr attr = { .type = MLX5_VIRTQ_MODIFY_TYPE_DIRTY_BITMAP_PARAMS, .dirty_bitmap_addr = log_base, .dirty_bitmap_size = log_size, }; - struct mlx5_vdpa_query_mr *mr = rte_malloc(__func__, sizeof(*mr), 0); int i; + int ret = mlx5_os_wrapped_mkey_create(priv->cdev->ctx, priv->cdev->pd, + priv->cdev->pdn, (void *)log_base, + log_size, &priv->lm_mr); - if (!mr) { - DRV_LOG(ERR, "Failed to allocate mem for lm mr."); + if (!ret) { + DRV_LOG(ERR, "Failed to allocate wrapped MR for lm."); return -1; } - mr->umem = mlx5_glue->devx_umem_reg(priv->cdev->ctx, - (void *)(uintptr_t)log_base, - log_size, IBV_ACCESS_LOCAL_WRITE); - if (!mr->umem) { - DRV_LOG(ERR, "Failed to register umem for lm mr."); - goto err; - } - mkey_attr.umem_id = mr->umem->umem_id; - mr->mkey = mlx5_devx_cmd_mkey_create(priv->cdev->ctx, &mkey_attr); - if (!mr->mkey) { - DRV_LOG(ERR, "Failed to create Mkey for lm."); - goto err; - } - attr.dirty_bitmap_mkey = mr->mkey->id; + attr.dirty_bitmap_mkey = priv->lm_mr.lkey; for (i = 0; i < priv->nr_virtqs; ++i) { attr.queue_index = i; if (!priv->virtqs[i].virtq) { @@ -78,15 +61,9 @@ mlx5_vdpa_dirty_bitmap_set(struct mlx5_vdpa_priv *priv, uint64_t log_base, goto err; } } - mr->is_indirect = 0; - SLIST_INSERT_HEAD(&priv->mr_list, mr, next); return 0; err: - if (mr->mkey) - mlx5_devx_cmd_destroy(mr->mkey); - if (mr->umem) - mlx5_glue->devx_umem_dereg(mr->umem); - rte_free(mr); + mlx5_os_wrapped_mkey_destroy(&priv->lm_mr); return -1; } diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_mem.c b/drivers/vdpa/mlx5/mlx5_vdpa_mem.c index f551a094cd..d7707bbd91 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_mem.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_mem.c @@ -31,6 +31,8 @@ mlx5_vdpa_mem_dereg(struct mlx5_vdpa_priv *priv) entry = next; } SLIST_INIT(&priv->mr_list); + if (priv->lm_mr.addr) + mlx5_os_wrapped_mkey_destroy(&priv->lm_mr); if (priv->null_mr) { claim_zero(mlx5_glue->dereg_mr(priv->null_mr)); priv->null_mr = NULL; -- 2.25.1