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 BD6E0A0C4E for ; Mon, 8 Nov 2021 18:22:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3A9741170; Mon, 8 Nov 2021 18:22:02 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) by mails.dpdk.org (Postfix) with ESMTP id D7A2441151; Mon, 8 Nov 2021 18:21:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eo5pcBez9wCYN1wMuDoLLZePdoPxN0TMs8hrJ/IvrY8LygGjRO0EWCBZBkIz+8nqPzvseWGauAsdmI9WKocDxkCtT1za3F82TpKWmS6zD7zE8gHgYZ9xRJeyGI4hX7OJiN+j+DdNnM4kWoIJJns5NseoAYYCEdBmet4l5mRoDdY0eksyCOYj9BrAJn+Qzo0HIfL/FzUm5SyCu8vGP2bpL78gN12+6Wkt7qWh0ElCgUGtr53+2a+hQVX24k7YCyGcKfpuZI8p72CivjKwk6MF+Cquc7UECcpG91+n2ZyDAADSax18Y6DvQfZTNXtb3sGqZut1T0AO1HloPYiK7CFTCw== 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=TPV6HybYVyuA9wS3fqTTrpAMGiGGevjEwai9dvL/9krZCtyf2/Wn/nO8qjrdsja2dj7xgXu/MAHqOqfHdiFDJJYcLEjAOEIbjjCrx5Sj8QeAQKSMGsDvX0iiDRwg1CunvlCdLCgXmoOY/VX4B2c5w4teGHomyok5UclN6qFNrTIIERtAxYXJJiZfXVKaIbh+QRwQLDR/GkmHa6LkRfRJ6pj5CiqcGmGa2Hs79ZvplZkdq6wwckIw8FvjfhiLv8WkSlY7eLwF8xAxyB2OchDn9D351bsEBsxWqFXiBuIsUQVhtwuLBIYtdFimdPziGAh8YBOItA3C+tlCMM2YVZ034g== 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=AKKpc9hbVZgGplNoIJD3fGkN730kQ5TDIgw2DcG3o+WQ76rXEb+z71IKUmf67r+mNxfWKOPKxfkn7wp+AmuhH64/qs8ClLgfZFqe4HeRfwMS+Vjqk1F3OUg6lQ19/g6QPZu8VGW8rIDEvbvtxkGgJMnjGF6lXEVIHtaoOtQelBwUodN3qcx9VnVXGOq85n45r3Kzd6Zuw9OaucSBwjq91CwmjORUg/a+0j882v+gUZ5H/fHRhaM53SXxDgpOdDMjQJwewri/D8Z400/Ins/cQCMt8dFYmWoui8DHleH+CcnlTll7mPOmxTlYJUuDKM4nLx/3YoQaAJEwdxwDS4s9yA== Received: from BN9PR03CA0280.namprd03.prod.outlook.com (2603:10b6:408:f5::15) by BY5PR12MB3971.namprd12.prod.outlook.com (2603:10b6:a03:1a5::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Mon, 8 Nov 2021 17:21:54 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f5:cafe::63) by BN9PR03CA0280.outlook.office365.com (2603:10b6:408:f5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13 via Frontend Transport; Mon, 8 Nov 2021 17:21:54 +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 BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 17:21:53 +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; Mon, 8 Nov 2021 17:21:39 +0000 From: Matan Azrad To: Viacheslav Ovsiienko CC: , Thomas Monjalon , , Michael Baum Date: Mon, 8 Nov 2021 19:21:11 +0200 Message-ID: <20211108172113.2241853-4-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108172113.2241853-1-matan@nvidia.com> References: <20211107152919.2158802-1-matan@nvidia.com> <20211108172113.2241853-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: 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: 1c81c36d-f4b5-46bc-2fe7-08d9a2dc422f X-MS-TrafficTypeDiagnostic: BY5PR12MB3971: 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: 0VZlJypsWH0ObQpW4+rpbqjCVa1/73aj18E4fYKglUQOXuJn0ZFUBx0sSjYGitRoZipZtH6/cgYtfqfgCuO1quftiYYYziyCniuOHWMQAIU/qYYILs+oKCv0K75wHjk5u7W+P+dhbdZ1iHv3nJSCmgNQmXJT4SOUIUvmQqPGvszUV9xhtV55fW0KcMO5P5LA6I00clZiCskvnlD5RwoZR6jy9DF8VY0MOr139+3oIBwwY1U+gQ0T/l+naiATwlldeRu6qI8dl4MedhsYhMwM9DIsV3Yt+/c1lXP7JEwdru16d83keil/ZngarmWFtdWXtaKGzCsAGWNBtSC+mFoJ2h/TZ69cCulmx+bkD+ngKidNf61TKWtVrUpoAqiMWvqXV8PjvLrWGkprQ47oL938yb9S0JAnCYm2GQcZqexctwPyKRhJcm2cCgLrurv9VaLxWGkSPjDRT2R1pLmWfHOzSYGwP66v0LCYCG/yACvuw4viGM/RWBHU4zlX0Z/01DxqAAS+ODTupXyg9DKqGOltfHsR5qPw+d8uFVgZQ4xSe4yMurX2+yVqCjX3ug0l1aJO7J6XBcSvfDQ1cX+EmrWkElb9mKt0X4cZOMb8aCcxfiV+pL29KIIAfUAX61R5QVrRdS2RZovLiM7PFFjj2np3b+98kX+9JNmYV57R4cnxbrSDwf+jtjydRGpslQq/qvMTK+muUU8nU9yJMs/aUeAbAuKaKI6fK864x+vdy0wGhfM= 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)(2616005)(6286002)(2906002)(336012)(4326008)(83380400001)(36756003)(26005)(54906003)(107886003)(6862004)(426003)(6666004)(186003)(5660300002)(16526019)(55016002)(37006003)(7636003)(316002)(36906005)(7696005)(82310400003)(8936002)(36860700001)(1076003)(70586007)(8676002)(508600001)(70206006)(6636002)(47076005)(356005)(14143004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2021 17:21:53.4600 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c81c36d-f4b5-46bc-2fe7-08d9a2dc422f 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: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3971 Subject: [dpdk-stable] [PATCH v2 3/5] vdpa/mlx5: workaround dirty bitmap MR creation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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