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 DB0ACA034F; Tue, 9 Nov 2021 13:36:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9348C4111C; Tue, 9 Nov 2021 13:36:42 +0100 (CET) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2059.outbound.protection.outlook.com [40.107.102.59]) by mails.dpdk.org (Postfix) with ESMTP id 3623B41109; Tue, 9 Nov 2021 13:36:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fiv0Tv7cFLg/5Z6UWyuPXOZtlDXrqzZVjBxYc+kELOHAFawt4kWKMuwW58Lr3sMSSX1TYevKIqQuU6oPzhWn3kGm8zR6szxw1Kwzc5QnTixKkYJw6LKLOPC6ygQe0t80daakcjB5jHOYkdvfPq814ycwb5wr2so8ucyD6gA7dHr+s2+rrj75nWKNXgCXfE+iN5awYugz1mAQ8mTKgyUUqvgVXN6iRjospAw3oGQPj3VIB0Fcb4BHtqaZdEpEnPrYWNs7LLtDsaN27v2Q9QeoP4KIP5mfzWGW9NJCkZ15waA/gbhJnTegil5cgqQP+eW5RFCoV7rxp6N6gDVB1thSKg== 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=s6N0Copq5V3sEUV30Y6T6XPG3JOVxK0ZqRlrU02hKPA=; b=SsWmpj7VTRb7YOZ2WXbwIg9f5oKexP4Zt1y1+o3VtxN8F2+fsIIDzZ0eO5WkzgLBTYhbKbzJCvQnBkd0r1CC9MLgSufTgrZDkFcKDBDyLV3/43/Ik9c3YZ9IWCZHskJDUuh6CMFYZ+UYoYvTAT8SA0i1ktS/EOoUlLlhClmX2Q2l75NTpoCl7o03aOCmVR7r/MHVjcO1bjNxuWsX7CMNnscIdN6JtPVy/JmXJRwoczGnxoIQ5MuZuPKwH7Vqw4asr0ZwWL/L4YIy2slfh7U/zq3ASr/1APq5nxuZo2mteuIr9gB/cP+SEWB8/76I/BfNEKo3g8QGXmNWyR4J2GP+fg== 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=s6N0Copq5V3sEUV30Y6T6XPG3JOVxK0ZqRlrU02hKPA=; b=PI/JhEC4Dw/NMHHdEJANB9uqqPhs8t6cv0gEQ9DQfHUPQAnpijFKTzahVQdvHOS/OdCbTVtq2oFK+2vNxNabqqt6XP3I4qStiVjOfFRZ+YwrV74E2P0p8VvjO5SWv9Et+B/q8VeO7gBaUYP6x2W4NZlpTM6YHl/y3zAnv+ThhK30s+Xs2LJcSugH+AZu9NHkQSXoSe6vPXVK0fQfr6PRnYBLEDc0EdyImcLQUYT6T8tSgqhGbtb9+2IeO0g6xTO1dwTDe8Iu89a3KWEIoyo4tiBvPm6vrszjGCjkdi9rr5DofXjBPZWuLWX9Sz8wo1PIG/mXVn+1YnhqSEqHOEEiog== Received: from MWHPR15CA0060.namprd15.prod.outlook.com (2603:10b6:301:4c::22) by MWHPR12MB1423.namprd12.prod.outlook.com (2603:10b6:300:14::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Tue, 9 Nov 2021 12:36:37 +0000 Received: from CO1NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:301:4c:cafe::e0) by MWHPR15CA0060.outlook.office365.com (2603:10b6:301:4c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Tue, 9 Nov 2021 12:36:37 +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 CO1NAM11FT065.mail.protection.outlook.com (10.13.174.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Tue, 9 Nov 2021 12:36:36 +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, 9 Nov 2021 12:36:33 +0000 From: Matan Azrad To: Viacheslav Ovsiienko CC: , Thomas Monjalon , , Michael Baum Date: Tue, 9 Nov 2021 14:36:10 +0200 Message-ID: <20211109123612.2301442-4-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211109123612.2301442-1-matan@nvidia.com> References: <20211108172113.2241853-1-matan@nvidia.com> <20211109123612.2301442-1-matan@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: d610061d-d8f4-4b10-5fac-08d9a37d9226 X-MS-TrafficTypeDiagnostic: MWHPR12MB1423: 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: carWCIHUWSquR59jq9pGGOqbNH2K74azLmCCpZ6QMfoABqGCaE9RGkJudgWU6FbcvWUd4CrRjNvhxQjDm2cvviL2BMY+WAh4CfPekI+Bysje/pmM+13tDNLpNqmEDXYtYOL1dMIttJltaY5AzbU4Ec/xfD+Xk165yr8vwNttICAvqcqZbD6aHOmTZ66pqvkaaeiLrEAaWLa0j9OM3A8F9N4IE+NkiiyoOjIg3hWK0ESdahRpg7WXf44HnTALLZ7si1xIViZl/8iV1W2/htfCL0gYRFTQRCK+OlXQ0SiCQrcb0dkiwlYssw6ldjnFgrU47qRI/BkxuNnuBMTb2LIG/m5c/ozWbW5OtOmOakTeMkHfmV8jx/h1wiA5RLR73QwnWu2y0Ul+rfNTHv9IPMwN9bVSb3KKmV8m7MD2WoDqqY8WTJPD8QUxCFxM0/InUIkVZ0yImT/p+wOcvCYK9o9uriqLgGA1QYtj+2BByp3OCqmZyDgHPeT7N9MibXih7sBtupxWYW/StmvimsCD8FBplnBhOxQhqIl34G6g0KFcj+2OvWX8uK2Vi7G/wJVkSMumfSdcQ+rMSghaZVIl5igRaf2t9G9+mVZgEAOqM+Tm9+9TXwb4fgCdhpIMdlO034wpXrKHRrO3z+Aa55ovvyWfQ00gdL1WQpJNZwwyPRGwyX4QqYaWRurI1+nddWnHWse4jIxzBVb6lJv+0vFCYZ6FCFAO30HRRHhBSYqnp5vZCbs= 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)(336012)(2906002)(36756003)(6286002)(83380400001)(4326008)(86362001)(2616005)(54906003)(37006003)(16526019)(26005)(6862004)(5660300002)(186003)(107886003)(426003)(6666004)(7696005)(7636003)(55016002)(316002)(82310400003)(36906005)(1076003)(8936002)(508600001)(8676002)(70586007)(36860700001)(70206006)(6636002)(47076005)(356005)(14143004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2021 12:36:36.6654 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d610061d-d8f4-4b10-5fac-08d9a37d9226 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: CO1NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1423 Subject: [dpdk-dev] [PATCH v3 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 | 38 +++++++------------------------ drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 2 ++ 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h index 62498f87fd..15212a2b30 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..e65e4faa47 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_lm.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_lm.c @@ -36,38 +36,22 @@ 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 *)(uintptr_t)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 +62,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