From patchwork Mon Jul 8 12:00:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726476 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2080.outbound.protection.outlook.com [40.107.100.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0168E6EB56; Mon, 8 Jul 2024 12:01:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440104; cv=fail; b=pzCQJOK5pMuVfRpsJiUWTP/KkZAG0kRy4dlNQSk9Zv2p5uI+UteGmBWlF/GYBCpxQjk5Kp26Kjnqdcvyy3KTPIfB1OnwCHpGL3uBp8w6Scj8VI25zpF1c8NGJKUnSXUTIMvZCLLxx2+ORjnewyGH+CjvQfIHHOsBMKmNhVv1Jc8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440104; c=relaxed/simple; bh=IqeLVexVBlX9F1rF2WSaF+uD1fvYZxPdsQ60WnFj6bU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=oSLwPVcEobOIdhKRLHpalltyPf+pNGUfqTDqjjC7bQKUFZtFEe5QT+SuWonbKOZGH1tw2Yjx1VOUFAzklU9VU0DoON0QDHJqfdYGMPeM5QspwF6ZX/jWpXu/YP6WcWrYINzfG2FN2ooSRjHnJA0vhyoGk19P0bbfWqvbUrBG8yI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=BkjgGAbS; arc=fail smtp.client-ip=40.107.100.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="BkjgGAbS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XjO2dJH6Upj4WgbhOExE3X7Wnz/CHp1pWJ0LTYtoa6fQrzsQOkKpDKbG9qmBHlMs9EmC1R4xCRumAPFKt7Em3cUBWRZqNsJ01X0Tq8wbP1XStXCDiOF9aiwdDE+oW2W1W4hEbJM3DeX2WCISsld83FLx/DR60FvJLSBr75F5njiUcJP302wOiZ4ngK0+rDM0zXqYsFyuRTlTDkp71no+bQzi3U71kRTJWMhqgRfJggpPY4/ixhOlcIZ5o7dLJBcmfqvvNHp7Q/Emt9mSuorxgY8QteoN6lP4Xxi1NFgwfxQGZDstLzHEk7Ef3sxZQrhVEY4uz3SLghFEzDGla0Qe1Q== 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=zfCxGhgeAMmGsKMCKIQFjGTMsYwr/Q+ANHCkhluJ9ec=; b=ES923z47//M7IWo6GMpjCFnz8hk+BPQ/V5nBddEwfs8MKqoOvZ7JUfJnLG3UiNdDqA8wJB3jgjXvTBMkWDQcvum5Mhy5ZowO3wlF/vPo8eFjtnZcKbBcw4gL9MbggEA8/TVXe/7IsBzYYtRpuKxXbop71EiUkWguromSZ3aEnAWQkorcR+IEr7x7Q3GrVPzByMeOQZxJ9cHVJ4W2QRfelntvqXO5g9Urj45iR3PWISUoPxrtYGqUt3zeWj0AwaXN5mNfCApmuZykl7LctUwoLRxUPMHmedJ+1rYVOg36Z7Grug6l8hKwq/U959LiJDOtk+dUznuNbqTyPdijx2GI6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=zfCxGhgeAMmGsKMCKIQFjGTMsYwr/Q+ANHCkhluJ9ec=; b=BkjgGAbS8MYrtD4irzPQ7Yw5GabCtiClXe2IP9sv05X8eiTMbhq/4LB7lDjuJwhnxRwDN8uGLTSXxThj4i7LoqKPSetXjCrS8JCdh4EL82bRAYPosEK+LbeoGO743dlDXBxclGPHxy34UlpdDm4qPm75AL7wUgHhE3pO442xvEXhRBdXRJoIVNDAQwG4+FXRw+3GrQUAoSsFHrdS5JpZKxKOAJM/4U02/Rmkf7qSKx8lrpqv95ST9ywF7zW6OM9argXyfciCTmBEFR0z7USNJPUcazY2Jr6fwS/5JqdyK4S642zM+lH6m2za5rPLKYypszRY3El3m4Lr/jYyyqCE0Q== Received: from BL0PR05CA0014.namprd05.prod.outlook.com (2603:10b6:208:91::24) by SA1PR12MB7365.namprd12.prod.outlook.com (2603:10b6:806:2ba::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Mon, 8 Jul 2024 12:01:37 +0000 Received: from BL6PEPF00020E64.namprd04.prod.outlook.com (2603:10b6:208:91:cafe::c) by BL0PR05CA0014.outlook.office365.com (2603:10b6:208:91::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.18 via Frontend Transport; Mon, 8 Jul 2024 12:01:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E64.mail.protection.outlook.com (10.167.249.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:01:37 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:04 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:03 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:00 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:25 +0300 Subject: [PATCH vhost v3 01/24] vdpa/mlx5: Clarify meaning thorough function rename Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-1-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E64:EE_|SA1PR12MB7365:EE_ X-MS-Office365-Filtering-Correlation-Id: 53a9e13f-9f5d-4eac-64e5-08dc9f45b83f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?mGEGdGjwIN6AvkkZqQpKjAbPAKNDI4z?= =?utf-8?q?1/B+2QrJzKda1tVA52H7RGmXdUmW8hQoglFy6WBmwZiu6r0umgJuTyPhTQWeVD4Gv?= =?utf-8?q?0xGmHu6UtqLwembgSzQFIGMpXw8YqiDveCBUmYBjujAuvWBE2mOVt+zmFb2jbfczU?= =?utf-8?q?FQYvWlNLwa1fL47BNIQOncKsajMVz6eCwiToZBkt6PUVC5LK4TgCaV5RzerOHa65e?= =?utf-8?q?gOW1BwYEVAFcEcCmMY7YJu3VracDuK/VvQEmDVIvx71jSJYzLRf+CFP1fp/nGrE5i?= =?utf-8?q?bo68+6ZLg1rkyNe2djD32/d5BtkeGQ11N52E2QXLATo2tful4QwmSre5NnWum16JW?= =?utf-8?q?ZwLBvtcYp0fmk3CGm/7OxuF0n2kSDkVN+jk81Ky0TmbyEctXNIxX5YMe0WGc+Zy5K?= =?utf-8?q?8Swl9Z2RM50xOyDuvCDJJEQT2MYFqnX5ABYAVmN0che9avtcnV2aqvtbyA7m6DTwO?= =?utf-8?q?MzT9a+oFO2LpNXf6xsaQBQK3eWeQI5pEFP4ZMkHKr2VUXxUimCOv6tdqc9uaKNZIn?= =?utf-8?q?ata53k/uYckiFJoU8Pp56Qw1metVDkagFP8w+C6crDmURtcEM4CCUT+o+QYcqw9pN?= =?utf-8?q?Eg4lrzdA2jeCv8bSLizoQqZ2d64KtTpav21nNOhV0wVP/XWs4vCFQ5g39wtKxygLk?= =?utf-8?q?03SyWlEqA6PXp2tSnl94zToGtQ9F+lF/1oCUfACJL+6i4/9bbJ5jlcy0+RGUxK/t6?= =?utf-8?q?8O53kZwvQGv5JFaoktNoktGzC4i15ms4982AWuLolQ8LqAzIKP5K/0NgpbTQBwl6y?= =?utf-8?q?C3wIX9adDpsHwSXsUeqSyOW50smXy6eL57P103a6K5ha6nmpr5QuDfixRquh5KL+8?= =?utf-8?q?bRbW4OC/TAAcXL9x4IPfZWGkss6+hz8y6C6Ev+2e+XoMMNP109RXwAkinCV/jEwHY?= =?utf-8?q?OmO+HpaC1BD4GpBAL4kmqFH0lDomSHMkPluV9OxNr7Z1B1j84JtzSrfH9R2KV7Wz/?= =?utf-8?q?zZfo7Hbwq+KM4hTK/EEk3mZd4e23N37pLLXWfj9A4YgUAhPGWegEMz+KLpNNXB2qe?= =?utf-8?q?/3r54c7Uy9eI2Ka9AqaWDeXgo0jvYBXh5191ndJ0kHrZwJ0ht8Lppib9TLvPh8tpK?= =?utf-8?q?TQY+eDAxvIe3HN4EOq5RhiPNliHP0lvNzZwgZ5Jr2tklsM5YwszZVQl+FmZzhLrrF?= =?utf-8?q?kK+xnWs8pe4jmxrS3Pg3sj8dqyfwqNCLKwFYzk6drHGK0EKoG6InhR/gIxxC8y0HQ?= =?utf-8?q?1Cts14UenbItS+cED1lRHMF6oxPMHdKdqr4B8j0Cudfl9VxNLh2W823X3566FkNCJ?= =?utf-8?q?TwDQf/XLO2nzHsMVmANmYJpz0V3DlNG+5LJ+8ljGihnLSAOTjLwxMIfcad+4A9Iss?= =?utf-8?q?s0weIqgsODEL0XzFsjXzdmMrhOX0ytl+EwVeDnoCQEPAuOfpQcG0GWjRXKtc9yRu1?= =?utf-8?q?ZpUXh3+YPZV?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:01:37.0458 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53a9e13f-9f5d-4eac-64e5-08dc9f45b83f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E64.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7365 setup_driver()/teardown_driver() are a bit vague. These functions are used for virtqueue resources. Same for alloc_resources()/teardown_resources(): they represent fixed resources that are meant to exist during the device lifetime. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index ecfc16151d61..3422da0e344b 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -144,10 +144,10 @@ static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx) return idx <= mvdev->max_idx; } -static void free_resources(struct mlx5_vdpa_net *ndev); +static void free_fixed_resources(struct mlx5_vdpa_net *ndev); static void init_mvqs(struct mlx5_vdpa_net *ndev); -static int setup_driver(struct mlx5_vdpa_dev *mvdev); -static void teardown_driver(struct mlx5_vdpa_net *ndev); +static int setup_vq_resources(struct mlx5_vdpa_dev *mvdev); +static void teardown_vq_resources(struct mlx5_vdpa_net *ndev); static bool mlx5_vdpa_debug; @@ -2848,7 +2848,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, if (err) return err; - teardown_driver(ndev); + teardown_vq_resources(ndev); } mlx5_vdpa_update_mr(mvdev, new_mr, asid); @@ -2862,7 +2862,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, if (teardown) { restore_channels_info(ndev); - err = setup_driver(mvdev); + err = setup_vq_resources(mvdev); if (err) return err; } @@ -2873,7 +2873,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, } /* reslock must be held for this function */ -static int setup_driver(struct mlx5_vdpa_dev *mvdev) +static int setup_vq_resources(struct mlx5_vdpa_dev *mvdev) { struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); int err; @@ -2931,7 +2931,7 @@ static int setup_driver(struct mlx5_vdpa_dev *mvdev) } /* reslock must be held for this function */ -static void teardown_driver(struct mlx5_vdpa_net *ndev) +static void teardown_vq_resources(struct mlx5_vdpa_net *ndev) { WARN_ON(!rwsem_is_locked(&ndev->reslock)); @@ -2997,7 +2997,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); - err = setup_driver(mvdev); + err = setup_vq_resources(mvdev); if (err) { mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); goto err_driver; @@ -3040,7 +3040,7 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) down_write(&ndev->reslock); unregister_link_notifier(ndev); - teardown_driver(ndev); + teardown_vq_resources(ndev); clear_vqs_ready(ndev); if (flags & VDPA_RESET_F_CLEAN_MAP) mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); @@ -3197,7 +3197,7 @@ static void mlx5_vdpa_free(struct vdpa_device *vdev) ndev = to_mlx5_vdpa_ndev(mvdev); - free_resources(ndev); + free_fixed_resources(ndev); mlx5_vdpa_destroy_mr_resources(mvdev); if (!is_zero_ether_addr(ndev->config.mac)) { pfmdev = pci_get_drvdata(pci_physfn(mvdev->mdev->pdev)); @@ -3467,7 +3467,7 @@ static int query_mtu(struct mlx5_core_dev *mdev, u16 *mtu) return 0; } -static int alloc_resources(struct mlx5_vdpa_net *ndev) +static int alloc_fixed_resources(struct mlx5_vdpa_net *ndev) { struct mlx5_vdpa_net_resources *res = &ndev->res; int err; @@ -3494,7 +3494,7 @@ static int alloc_resources(struct mlx5_vdpa_net *ndev) return err; } -static void free_resources(struct mlx5_vdpa_net *ndev) +static void free_fixed_resources(struct mlx5_vdpa_net *ndev) { struct mlx5_vdpa_net_resources *res = &ndev->res; @@ -3735,7 +3735,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, goto err_res; } - err = alloc_resources(ndev); + err = alloc_fixed_resources(ndev); if (err) goto err_mr; @@ -3758,7 +3758,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, err_reg: destroy_workqueue(mvdev->wq); err_res2: - free_resources(ndev); + free_fixed_resources(ndev); err_mr: mlx5_vdpa_destroy_mr_resources(mvdev); err_res: From patchwork Mon Jul 8 12:00:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726483 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2088.outbound.protection.outlook.com [40.107.92.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4D08824B5; Mon, 8 Jul 2024 12:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440113; cv=fail; b=rCPk1NTRscrpeudRsO13D6SPMvYvEjWxvzxvN9VqPtrTHmfPXWeDJJhiID3S+8DVdwwNXL4TaGEDXO4H7OO9XZy2DdTgOKDI+e19cw/2lJMylfF653ujoukT8ItTLpG8vFFtelawxEfpalcjSthPQ7Y42J7QO0mnw3Lbi0l0Rmk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440113; c=relaxed/simple; bh=1hvRehAXZDVhCW7uc7+JCoX47DALhabAhghNikm7DZk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=bPWOnVBW9WhnJDdCKHRp4Gji3QmfQTNcnW5TDBo43qJrquBN5YdLNypvxA+cUQYLBBC3ltu2kSobmj3dDp9O3In3HFSjvU1BZa0A/n0Ud9ZqixZSGBhCajpqF06SL+q3pBZvmEtdu/g/toviDaS9KNRDi7wFWvWxdpjYLb66ReA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=ZmADDVzj; arc=fail smtp.client-ip=40.107.92.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="ZmADDVzj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O4g0oE/m0cvNS1hZG90CnJ/+8Cd2d6DHwTDRxdZmEq6Zdo9uGPSmLnk1fqYVuAM5Bj76CbHghnXfewH4gSNwRE4aMCwnHHDr00PKT97zYwt9Fi2dq4IJIry69Xy2lvzYCsHKkQ64EmeytuhKtG239AjgOL7yioRTxWy7d2S14sq692t/a0IJSNimm0QVNpQMq+RZKysEwchx37PjmJKVyH0T0/9ci8fDFH+4BOcrT2FRL9ERhM/OiBhDYpVGJEuggMD3uzJiaOsDDlkNnYUdPRjNyCbAjePO1GdVC97AVb4FSKdZIKJswZT9w4KCfPZ/FcdCfOm7tZL5bTaGgWI3RQ== 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=teXHsE8IPOQawmuB6+cxetBZFmw6RHnXZPiujYDUvus=; b=ToiS3QnmvcMRq3UNNXdo19HkzypbIpgqFeppI11VwQitwKNY4WLKdNB3p+E0WrLts5UjFqHfpIppLjdlM/OtH3wwWd8XvSToI7ZR/wqS/aYJp/MVj8A7NfTxJgV+3d4P23X/GZcdbcWIWMgCv3iHE4u3sVlSrZLWOFAeZcpYY33PbRchhtucX5v9FEMxHAdJqeXKBcUhMkymr5NIPVSDnhXttKTSPuPLqp1hr9KWSS80Nj0+CMvNrDMrL0X8kdYF8eVkZevIejMef2+4SNiTkuDuHGQb7lXpugUM2kXTLwaNzBnm3/6dJA33vyO9cEnCv/zELC49ImqciYPGs9jbQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=teXHsE8IPOQawmuB6+cxetBZFmw6RHnXZPiujYDUvus=; b=ZmADDVzjL/lL4wk/o5PqzPzMtgqjZJpBnvmkszVkOMJOJzefnDe6XDXboTqgYHwuUqX+xBuRZvj8vF6wUdXjCiPOVdthuYWDeGoOJh8c1+Uw+DPqMv8oOic0ogKdUjPI82UJgfFSNQBYOttwFQcY0Uu90pMjhYi9kmnnM1FHpQOsL/cz1pKr7ohzAQ3urIAhx0PLbocLslFdeSFRUZaQwG/5eQU1lS5BnCHvzY+vlBoQaH37vbVkT4vwWHwmeGZkrAEYdAKb2LZM5nKxNeG9c0hfP/pTlibEU7Btey7MGLyQRMxJLfbIIHo1l8/klrlgQ5uCoFONFDsgBTn3cW+2rg== Received: from BLAPR03CA0021.namprd03.prod.outlook.com (2603:10b6:208:32b::26) by SN7PR12MB7809.namprd12.prod.outlook.com (2603:10b6:806:34e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:01:48 +0000 Received: from BL6PEPF00020E63.namprd04.prod.outlook.com (2603:10b6:208:32b:cafe::95) by BLAPR03CA0021.outlook.office365.com (2603:10b6:208:32b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 12:01:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E63.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:01:48 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:08 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:07 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:04 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:26 +0300 Subject: [PATCH vhost v3 02/24] vdpa/mlx5: Make setup/teardown_vq_resources() symmetrical Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-2-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E63:EE_|SN7PR12MB7809:EE_ X-MS-Office365-Filtering-Correlation-Id: 4deaa71a-4e10-48b9-9936-08dc9f45bee0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ELgRPa2XE3YyXjpdDKNz6fVzLqx3cTY?= =?utf-8?q?2SG15PJkFv71LOG35Xu+ZnVqR4GkRIx1UR3H3wVZaOZ0d81t/3tBm1KmCl9+9TEb+?= =?utf-8?q?XGFf4y+k+y6d1yVgekyRnS8bb4ZkTokEQtvAIG7NPwO0szNfygE8sQ4lCCMtsuxFR?= =?utf-8?q?VVuxN3+anclUsS9/J19X6acLCeF6CMxIZRM9GIwY8XdDoysWuzA68QhUJ54CzuqW9?= =?utf-8?q?Z4TjJKm8Pu+7gP/iFyyS4IeOFe/F7yYG5OIDxYs/qZGMiU0VDT7VfnuFQo3jn6KjB?= =?utf-8?q?Vo3F+BtAdqgFGTSkFUM66wOIL6wpHdnEaZ4cszPSbuIrSyStndfIb5QqivDLngBqj?= =?utf-8?q?Y7PUt9R7XZZVtXuUuj32hl++EzxDdC80jyiwDfFqWTFmc4NbQkk/qv5dpZM/4+8YL?= =?utf-8?q?MGb4vRuX0L4LULvvIGjVrUfudZa8ZjJLSdH/ohxg9VU4uGUX5tx18ZGuWB9gECXq3?= =?utf-8?q?5SyWioHfA2wf/XHLeIUpC6/kyPS1LWi9sctDPq/Hqvb3bs9XUZwX2Vxs6VEHEdJlX?= =?utf-8?q?ebiB6yjapiwwthjUEUmN36PEinSJcARLr6QfXz7gT9ytg+ATcOBM91QvuC+oPYBvy?= =?utf-8?q?c3eZJTQPp85O3QlHjksWIywW30Idwpd2VY0ce9J+9olzHrMSAedLonP566cGh51o0?= =?utf-8?q?I63CZosB7TqRQgkF+UzvyTWq1n2ylFohm/vwoUjtG2XycIZu5Ys9PvJjiCG+AvOt6?= =?utf-8?q?I6AwnTJy3EiJOzJE1F8RUsoDAItUPj+/ZzUec1HMvJ5wAeF+DGq9MTLPtaH9BNgSo?= =?utf-8?q?nROTT6pjfounD0OxCiRH6H1IqfxEHp+BL+p6a6zkqZBtmaSbpRAqRKwj7U231LIUR?= =?utf-8?q?yNOIJis+8wX5Av39ry7bmPNChDM+CWoO9KoSgJqm+Jhq0nnEG7zcAkbj3CYxfXK/5?= =?utf-8?q?WV7w+QbuxxFNkEyUMNYQCVA4ZKQi/5aR3QBrdHTWHI0WCwupm1Pdbhlui0T5UCHZm?= =?utf-8?q?/sqqan9KBKKd403+SNTdcRtsmupFaEiiScZquJ2nwOkbE3MqnVlIWKzVLiMYW3QyS?= =?utf-8?q?J132Xyqa67ScBSTVDWqDkg644C5FUD6vMNsQKOFYjWN1B7/xIVLCNrJp7T8iECEh9?= =?utf-8?q?UlViS2OFI7oHTgSwWQwL1ET9gVyLv8kgaLg5jLB/RUKFNQ9VaqVzJGdg81Ii1Ybfn?= =?utf-8?q?OEOKXyuJAY+k97pNTAYcM4XwWFOp8VXfwzkHy+bmJblr+ItPyTSTPu/kbBq8VwY8g?= =?utf-8?q?1pb0ac21bX7d8Y8CmZL0o9pGsw4ZAsAZDt+nMd5zH/yLoIYos8bEm1i+HCkmC1d7G?= =?utf-8?q?Wfi3CGjUWfkmBDS+Q2jN4+ixem4xLYaQoM1GUqwoIc5xd5UJ06RlqWZJPt6MxrXkY?= =?utf-8?q?9X9EfFFhABkvJbj74/ItY9D8jEd3lP4aXL4jZdiJ/4zwO67iEArDj26bSFfBx+VYJ?= =?utf-8?q?JWzOwlJxwcQ?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:01:48.1686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4deaa71a-4e10-48b9-9936-08dc9f45bee0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7809 ... by changing the setup_vq_resources() parameter type. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 3422da0e344b..1ad281cbc541 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -146,7 +146,7 @@ static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx) static void free_fixed_resources(struct mlx5_vdpa_net *ndev); static void init_mvqs(struct mlx5_vdpa_net *ndev); -static int setup_vq_resources(struct mlx5_vdpa_dev *mvdev); +static int setup_vq_resources(struct mlx5_vdpa_net *ndev); static void teardown_vq_resources(struct mlx5_vdpa_net *ndev); static bool mlx5_vdpa_debug; @@ -2862,7 +2862,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, if (teardown) { restore_channels_info(ndev); - err = setup_vq_resources(mvdev); + err = setup_vq_resources(ndev); if (err) return err; } @@ -2873,9 +2873,9 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, } /* reslock must be held for this function */ -static int setup_vq_resources(struct mlx5_vdpa_dev *mvdev) +static int setup_vq_resources(struct mlx5_vdpa_net *ndev) { - struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + struct mlx5_vdpa_dev *mvdev = &ndev->mvdev; int err; WARN_ON(!rwsem_is_locked(&ndev->reslock)); @@ -2997,7 +2997,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); - err = setup_vq_resources(mvdev); + err = setup_vq_resources(ndev); if (err) { mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); goto err_driver; From patchwork Mon Jul 8 12:00:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726490 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2074.outbound.protection.outlook.com [40.107.100.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3366613E033; Mon, 8 Jul 2024 12:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440135; cv=fail; b=lxJIT8i7sf3TPUA/jpFbbHsIipNkGFG9g0ZGYnFeuPmZ9JFgo4SASYpgGfe1Qvg14kN5fwsoiz0fUKq6Hsiwih5+zsY26JsPssEZftQSzMAYI/se9/uPrO82lnOT59tGuBtYUj+7oG+KPAf7EOylIcvenLyJkULyR/+toShbq7s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440135; c=relaxed/simple; bh=HZPdJHo98IJDyiIE+59nkgVbHCaUJjoE88a8e4zhErw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=dh6+w64qGelwZ1muIlWUf0512bm/e/Emyy5bYYIfIN8pZIs8CE6Ehgzl5Ke5hT6mVK7A0jR69kVYTS4VhUGywaRDBHH17b7XXW30JUhQSk1ID/i3Kiy3XiOobgvsiqrCVklhgmESf55JcA3BzsjSW6Nurz+fc2cafnbS0qH/vts= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Ih1npZSt; arc=fail smtp.client-ip=40.107.100.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Ih1npZSt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RI1JQnOxOwRuoKnQ0sn6LuOBaZXCrJNzchsfc9YOmkMyVRcxJRrKCV/JNzPBo2yXeLL6u88GFKNbk0ZNlX2TRABVBhue9FD+q+Ggcb/4Zyrq0ow9gM55pACmQ4SOd1AFI/s0qEJTHut5e86hMz8+TjyW2viGN/CTfER+84noxGqmffhJcNmD1rQokb4scwJK9PMGMnS3HW3s4HZWOwh0MEbyy+BcanRSsL8ERaSg+/+px9v54qc0Sd5SpzsxTfTJmxlrevvJ5VKL327xADnzaivwrMHu18osCThe1/BabHV55q/jqkeZuIcLsieKwtIsAsiBIkqLB1/artSp+HnetA== 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=cREcdg83i+E91FcU03gHGtmMztmDrz+EkM71cwATqWE=; b=gl2eks/8XwM9ZUiO6CCLq8Be9ZUl/cSrXxMvSbDi92prBZLqmfUqygljAF8ZipO1BmOnArGkZTy7PuQEw7jUVMhymEkbKJZBIvKA/x57txcaVbuszoopMNaM65iR7R3CtgUIaf2tmWwE1dPaVZPqfbMMrWBy8k4/ptpYqlSzZZUEV1waYUkxQGzzT8uMqucPe64kfDE7tmKQL/hBqhBexP0j7t+a8FyI9sFeZQr7i6tl9LhmYx6xwiQdsQiYpvta7pQBT3wV92Ay+120LvLExVCTbi7pRizILWWv2niOpJUwyBaVOCmJpFT7xCHkRsfxBi4MPjGyFzpRiiWHU/xx2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=cREcdg83i+E91FcU03gHGtmMztmDrz+EkM71cwATqWE=; b=Ih1npZStdL0ipL36df7pqXXdPHSxQshSyZg8EEeERdYvmCI9rF/pgwNRmrvaN1EIqeI8a3dxbnJQeLFskyoWW/y9b2idHs5YglsQUxVUgAW7tcV9L/ZZMippvGT76rb/rPJ0DgM1Ohd1R0mORJPcAHu6fWolN3Wqgg8SH3EwK3h41QHx68lwej+dnCzPwVqJMGdCMI8GRFSPzOFEUuyxoxyJak8TNR23n75MoL69w1LteHQPJL6TvTDWkYLYKsMC5Rm8O7vm0YejfHcputEsk1udV+rN7DVh9X+m1Ws3ETR/zX1z8OFjmCtOHSFrzKZs5UfrliFQ0l6yIdAWYkqE+w== Received: from MN2PR05CA0021.namprd05.prod.outlook.com (2603:10b6:208:c0::34) by CYYPR12MB8731.namprd12.prod.outlook.com (2603:10b6:930:ba::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.34; Mon, 8 Jul 2024 12:02:10 +0000 Received: from BL6PEPF00020E62.namprd04.prod.outlook.com (2603:10b6:208:c0:cafe::12) by MN2PR05CA0021.outlook.office365.com (2603:10b6:208:c0::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.18 via Frontend Transport; Mon, 8 Jul 2024 12:02:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E62.mail.protection.outlook.com (10.167.249.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:01:55 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:12 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:11 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:08 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:27 +0300 Subject: [PATCH vhost v3 03/24] vdpa/mlx5: Drop redundant code Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-3-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E62:EE_|CYYPR12MB8731:EE_ X-MS-Office365-Filtering-Correlation-Id: f859f6e2-e1f6-42cb-7357-08dc9f45c330 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?eY84rRx8LtUXGFYy/THBNoTA/C5UbIg?= =?utf-8?q?mwvZehu0TL9ZY3HyQOerZlulefes6hBID14v5Y7bDWS7j+/BIAZxqe5CZUiB7xYSB?= =?utf-8?q?qZniLsqYsZxuFD6hh+Pi3VWjkpqlUVJc2wnrYF+MyN+YwB+lMAeuBC6ua1DRafwFR?= =?utf-8?q?osTFC1HNxd9cm7zB0ijsGQMF8eHUPCnrZ83blufv0p8j+azIFvcsGhVQh2/7eV3+K?= =?utf-8?q?Lpball75SCBxONvfJtU1mQ9MM30c7cKn01mjfDNmgLDT9ydlQL2/s7ZjYt8OzcKNQ?= =?utf-8?q?ho0LmM4TDkrJAmyCkwyDiAUleO1vqjFy4JLJMaq0yQrSR/Sow5KevN/XHJs0atCgZ?= =?utf-8?q?kBa8j1u1HQpYIx2mpWfrJEWzMfNwLwBp1BiUjVO1AP8/Z2bC+b2slRygg11slGO8e?= =?utf-8?q?053qxNuMp2ReW/TNh1atpYNPIdc2Abn/hjRqifCK/VlIGk86FjQfSdt5ZhMshpszy?= =?utf-8?q?yMI9yT8lbrckh/nZ8RP9WZv1ww7akDScgCkXmRq2CYWcHuEMmrRiBqNRC8We6OLRJ?= =?utf-8?q?+cWBwkIT6hkfAbsBXcvMY+7775UGP/GVoZuKUqFBbbI5d3RiygpgZVkNLqYcepd/m?= =?utf-8?q?6yo4FKUzB+paiZ/94eFWmhSVlK5kleV7ebYsxkYBfDistGaqAL60eU423a3cLeYeC?= =?utf-8?q?3CZEmAJLXzOYCx8rRmUd9lM4AuG1EyDxtaGVtYmlggouUnTw4QlirjDoT/HA/UFMp?= =?utf-8?q?jdP1m85kxt2ADpEA/tHMx0Wju1d6z1/ASz0XD+ncHWx9ngt/2+pWGteXOgO23j4IB?= =?utf-8?q?K9EadRkZDrZ1WaUCBL7MjXuT1Iri0NkrcG4i0525ZWnUQzpIZDDsS+WLb7kyCL9ok?= =?utf-8?q?k7/cisJK4AQiwfoU5Hbew+RgBKv72t4pzIS2+yUvmzmDxHNnJWNbTksZypIMJQx2Q?= =?utf-8?q?V0dSAUDy0N2eF/D/+sYsOX6gf67HLeVFH/a3g2Qx7kni9YseybCVv6sNqJ4LAUkC4?= =?utf-8?q?g4zpVxPNSGSo0eAEt5yDR4Xuek3KsnB7OihPO2Ys0lRBbF+ba9se6JiWc5V7G+jeI?= =?utf-8?q?RnC2qqicWsUev3tbWNkK4r6pPVQWu3CEd/IGcGiCHyF7Ebie1Xt+TWhebK5CbYOXV?= =?utf-8?q?fwUB9R5EqKJuXFJfzyoJR8EsxVyR/C6PGOwoX0hQZ0NoguVulHFRlDABq8SFligB/?= =?utf-8?q?O2G+PTb3ag00uPLseHPPXBj/b/GxZoT+BBOfqYs/Vt5S/uODap+w1qH5jA2b91piR?= =?utf-8?q?6xYCl7j5bm7LhxYV2JXPdG4ghb3D2I1gZhYrbK+8YoO0fk+aloVK6IdnOFDKZRiX/?= =?utf-8?q?b6aTVs1bBuswu8C9R+jzInNWBstZ8CRjOBsaef9mBzoi4rFCYRixsNO6lyZUSr0WW?= =?utf-8?q?M5Woc/Q/NMC6QyeHa8LCoBk6lRIiWpuqTjr30MdCiAa1clLO2p9/2/Z4JkpiBEoSZ?= =?utf-8?q?byR5xiBNvK0?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(7416014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:01:55.4028 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f859f6e2-e1f6-42cb-7357-08dc9f45c330 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E62.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8731 Originally, the second loop initialized the CVQ. But (acde3929492b ("vdpa/mlx5: Use consistent RQT size") initialized all the queues in the first loop, so the second iteration in init_mvqs() is never called because the first one will iterate up to max_vqs. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 1ad281cbc541..b4d9ef4f66c8 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -3519,12 +3519,6 @@ static void init_mvqs(struct mlx5_vdpa_net *ndev) mvq->fwqp.fw = true; mvq->fw_state = MLX5_VIRTIO_NET_Q_OBJECT_NONE; } - for (; i < ndev->mvdev.max_vqs; i++) { - mvq = &ndev->vqs[i]; - memset(mvq, 0, offsetof(struct mlx5_vdpa_virtqueue, ri)); - mvq->index = i; - mvq->ndev = ndev; - } } struct mlx5_vdpa_mgmtdev { From patchwork Mon Jul 8 12:00:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726486 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2067.outbound.protection.outlook.com [40.107.236.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B232137757; Mon, 8 Jul 2024 12:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440125; cv=fail; b=OkciuMgzfm3JuwuxmIiOVcigXsbrR0PqdG45gkHErPQ+rH1porb5te4/AcLDPpeI28DJdQm/+iR2eqU10QxHoDQKoXK+in0YgmcTUgrgJ6qV6QtulR/8w2IU+Tkxjm9cOH5/hG9rMWm2B3kPOJGo3tp43eKDYNoqtBu5su80wPU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440125; c=relaxed/simple; bh=8ApW7OmELEMo0ain9rf9IjXR5AkLDNuT5HIwCyqy1sQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=NQiUlgrJfvOKMkcyutJvKWaOHz+k4jYLiwR6MisebJ8oraWgsQjrZ9BsaheeY0P0cv1JrikI80Gq6VCc5e0UPy3y4wbWCfrrw1YJzZ3iirsKu6G4hFiRp5ljGMAQusC4X5Tq/lO5PLgao2KdPeqyrn0+tyS+C+07gMUhttaTSFI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=FOoTnw0V; arc=fail smtp.client-ip=40.107.236.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="FOoTnw0V" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y3aDq6WQw3XD6ddrNW0qzS+9n3XqoLHYkuCUJzyOlw52j2siwKE9g8BIJsqtBg2sf7sH42m0dDcBqhKiYrX+M7jQr+UoY9Z6uFRJo9bChrplyCi3GsKQsorlXHvi6u2yqecJNUyx3uhbsQl0lxrn+kEap1lzAQCf0PMFgQDCWPE1gaDGT9MKH+XD8EfAjbOXrmegs6u8dA0Df4KPs49gIkauH8bFxc6MXexxxuM5WxhOfhzX6gw7c0EC3veRZzLqz7M5iCowhfSmwco8zwZyecQix7kJD+KTMKS7VI/ePhrWolcCZbpy2IlW7yBJt9A6WKTkSTzkKSX/1Lf+At03Wg== 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=CouM1YReqN2302FiAFOOXi8BwoSBAwgDUI3sFbbK/Nc=; b=ez1ByrwVzFoi8KCwkjVmnN/yK+l/MVtwBH0cAtv01Xsg6rfhTnLvPpiqNlCXnKVL1C94/Z3S1wkyvzzMcwGPcAs0Mz+eSi5TObZlaRYnkKR/Pl8EpCO7f9cXNzu9tkHBqXgk6vx+kMMjOiyZyVpOLP1cG82M45kGodwyfOqccLvptIiQpY191A4GNPoJx/FaR4G54r0/up+jGBLWrR/l2UloyKDybfIPDfEEnaxyKXymWViWBAvHEP7dtHjcutwQwagFnmiK0WkEwnzR1XaEJljubJhKKPKaNkji5ld+i6uuMx+mtBoItyinEXAnSVF5hALcH+mUWcLZVwrnj16cgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=CouM1YReqN2302FiAFOOXi8BwoSBAwgDUI3sFbbK/Nc=; b=FOoTnw0VuXxpaxGRNrYwwotSlmf/H9H8krmWL7TpKo1q07H+mZ31icQxZaLKn3hAOmJueVoozHabEykMhquhoBqh/ODZzjuMXvq80zqoc00GzPy8OnCMxqPTFndiXoH0P7z9ii7s/PyQeQ4woUv5vyQGkR/n6FTPTTu59dTC9rRpKuKVYHYX3vhJd0cz0f9UbDusrY4xC+43Sy1iw7yMSQQ2lNn2Op0cU8kTQJR9xYlKWeSifq6rw13yZxt4IE92twc7gHcrPx0OTymrYhoolqEu9wMQVaWFzlhOCiMdrL1LstNktM/7z9rPEq4ICRWpgfqCmURCke1MdYKT/JJbkQ== Received: from BLAPR03CA0008.namprd03.prod.outlook.com (2603:10b6:208:32b::13) by PH8PR12MB6793.namprd12.prod.outlook.com (2603:10b6:510:1c4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:01:59 +0000 Received: from BL6PEPF00020E63.namprd04.prod.outlook.com (2603:10b6:208:32b:cafe::97) by BLAPR03CA0008.outlook.office365.com (2603:10b6:208:32b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 12:01:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E63.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:01:58 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:16 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:15 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:12 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:28 +0300 Subject: [PATCH vhost v3 04/24] vdpa/mlx5: Drop redundant check in teardown_virtqueues() Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-4-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E63:EE_|PH8PR12MB6793:EE_ X-MS-Office365-Filtering-Correlation-Id: 40e1ba43-65f6-4810-fd2b-08dc9f45c53c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+GMfXlU1Gv7pGybrzIQscj4mw6rSkuh?= =?utf-8?q?+HpKpvEu8Tdn9T2KILjdPwtamJGy7ZktG1KH4UHTE8eprUX2h0YqpmemfvZSKFzK3?= =?utf-8?q?4t5wYRGEqXoLXJYtDBKRHI3ZrSNAz9UbMXFzorRCjRzcz/NdLFf9kFBrCM6bDyX9j?= =?utf-8?q?pK0sf5P6N8JMXnRMNJEiENoOGSuG0+oQiCKOCRJMm7rr9L3Zapy1ONCDKlYrTeD9P?= =?utf-8?q?yJ8OzI2z3VMnubczW5D1etBvzZV97alusQxCgZ+XMvPFR760UzyWR+ffmdERJbyGN?= =?utf-8?q?EN4iQV2/JmI688xe+8vLL6xmWeibCWlmLeT1cnwvwEkACxo3+ydbKrvOiimrN+P5C?= =?utf-8?q?mj1oWtnI7mO6DOh7MFQKnqzVbhGhPk9sbl7R1PZ7GYeGqgj8bhatztOhhewerU04+?= =?utf-8?q?guvidx+Dk+7GPhCnm3OPIz981zOr8SQPgFZMxODh2mi3JFH8Q4Dnc3y1wnXsAI0O6?= =?utf-8?q?ai2xkWoxubMMZ3wfXlujys0aRJjlSQdOZxfbtAn7FCWhj1gBiMdMD6JbdzVTPbEgn?= =?utf-8?q?uH6pZFZR0fgZ4s8DT6JV/CmPej0lLo5u4L8zmelgy/nUVLAJ4CaacfHQHCLNxaxhG?= =?utf-8?q?m1/WtcMsmcLq+k6xp7cAfHtmf9mZ3zXGcnN9JPzC8EWTVTq/eDh2zUhpiH7GDvEwE?= =?utf-8?q?40CqLTgaoEMsTnN59EiIDnBenV4WzmjK+H74dGP8NDJCKSSXIR0qDL1O6oFUsxcSB?= =?utf-8?q?2lhW0hXxUs40aMtf5Zy+hbCmG0uNWw33WBwXdrpHJNLqoKkavVpckSZjrLEDG2T3C?= =?utf-8?q?3DslJaiUdclSH/galYY7wyVp6/7irrnfyEc9VZ5KHfFNv46UlPflQetFheCFMU7sv?= =?utf-8?q?wWSwP0LwKAfzVr0f01eYUeVW751U1ljwWDg3n4zIwttjlWnNxtXgJUIME3Jth6rg/?= =?utf-8?q?BGMcEOT0rr6IJiEwrsLk1i9Binugh/cGaXkazrZIUcEFF2w9ahW4k1mm+GAx2qGck?= =?utf-8?q?1VidbLFmcs0FK1u4cqg34lmtTwz1JBvDrkLujgTi8PorvYmBt7vwY0Do4Kz+04vB9?= =?utf-8?q?mWON2AyCoNeBWyNcunTyFfT6EBUgRkKYl32MuP/dAM6GjUWNoH/3wj2psnF9u/FgL?= =?utf-8?q?VyMjtm6KVASGcIdw6nwOpNcRZd2i61mE4hDQwF0X8Dpc1nRna+72ypfasO/7kF56z?= =?utf-8?q?sFlZi28WSOMjePIcbKCIMjbZTjOHLA0rSfvaFxQhQwIEYwYra8/OMG34Q3lpf5WAN?= =?utf-8?q?ZGiVY6ewlB3lR0jyQ+MjIqGtI9y9coIdZ6NsOBm7Flr4DCBi4VPzYnXOTCEVIPbfK?= =?utf-8?q?l+AofGM9HF3mZldkJXFMdvEuLMASWU2PxcZoNjhducCOail2I3Ybl+yTwJUIilbkN?= =?utf-8?q?WMkCm4CCX3XS2c1SrcQJ/yh1o7pKa63lG0+9dYKMrPXOw9iV/Sxc9eYk8OG+oBa8q?= =?utf-8?q?26nM5dkOPa/?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(7416014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:01:58.8404 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40e1ba43-65f6-4810-fd2b-08dc9f45c53c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6793 The check is done inside teardown_vq(). Reviewed-by: Cosmin Ratiu Reviewed-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index b4d9ef4f66c8..96782b34e2b2 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2559,16 +2559,10 @@ static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev) static void teardown_virtqueues(struct mlx5_vdpa_net *ndev) { - struct mlx5_vdpa_virtqueue *mvq; int i; - for (i = ndev->mvdev.max_vqs - 1; i >= 0; i--) { - mvq = &ndev->vqs[i]; - if (!mvq->initialized) - continue; - - teardown_vq(ndev, mvq); - } + for (i = ndev->mvdev.max_vqs - 1; i >= 0; i--) + teardown_vq(ndev, &ndev->vqs[i]); } static void update_cvq_info(struct mlx5_vdpa_dev *mvdev) From patchwork Mon Jul 8 12:00:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726482 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2049.outbound.protection.outlook.com [40.107.220.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1259280BF0; Mon, 8 Jul 2024 12:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440110; cv=fail; b=ELuhbpi+7ESW/6YTUfIYoOiGArvLiLnk2dwdjpyAl7fDVinBsa3nGXEO48WjeMQ1L8IO7BnPEZnCzzv0VVZLiH6TDlOiZe1Ij8xpn7Qo6KzqmvQKRU/Gt1z8gJSnhxd00fWkvJOlnrE4E/tP41dRcXpxTy4y1EQ1No1YXgPhVTk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440110; c=relaxed/simple; bh=DHrXSEe+RknvJt1MkdZLHqGjn7NQF9NlApBfwGP6yGc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=tD/5jHHCSFSyZ3mywhUrD8ftxlyS2kS4xZWSG77meuHoMLBqfhxUCvDrYgOehMBk76oQqQ+RI6o9eVX0sMTg30gu72dJ1zDfGuG2VfXVIOcI8kbcOlba46m/CXVCcJGfqb85SAu5IHTBz5MXRAXtJiIFZvTV99pW1wtcBjE1mmk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=KuTpTviA; arc=fail smtp.client-ip=40.107.220.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="KuTpTviA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NA8m2i94hPo7gzcR/a8U8cpTw256QSiN2d0XrO5g8BCMiwjeo/N3C8Yqwt9HaDJBm8VmrDSqGtv9C7ClMjacME79YiPcIv5MCL8gPfll5rhjyrbKQ0g5nXtrBHMVDHFRMGcP/HZSYC8gKiITT6NFx/0x6H/w3zL5EuED6sfnsjx8PM+sYzjVHnYoYJ3XXM92ODj5OJtPoEqU9G0zQPK6nUDVP7tQCN4BL2Qgib439T4mGfUSBOOCOMX6OPZ2qkiFo4hpYEs26XSjkowN7Mj88i27dKPJAdlgKfTUIONZJmT18426LZ/Xfk1vDPCdWkNORHqFK87gXE0XbJ3QXwlF/g== 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=2z72/tMu8L9qHHmtikas5vtPUfaEPquPR1NHlmrecis=; b=OnaW0dsDl5g4GohV3UzNYSn9EX8k1r9VzqGR3G2QtWj0Sf9hXondq+3STsCWU4pfkZKNzNwjpCLw3aZ5n23eQLNkgpwnaeaU6CTiFIeSMv9veavVe80h/ZeaRYfnP9XxJQe+oDSelcK+fb/b37NkqozcHYHoXXMCM1K0d798J7/y3jzfYl/MyIF1SVZLZsDfxubs8h2svV5F9wfbZUK6bBvNdTs054h3p1BiYtbtOvtRQ9yFRjochas7/YjozD7CEyIJKtEGGD9PnicX46+3RTg8PXg48W+emoTxqdd70L2EdXpcdSWVVRdO6spSXwRNjKIgoFpczz6aDwn1cN7ffg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=2z72/tMu8L9qHHmtikas5vtPUfaEPquPR1NHlmrecis=; b=KuTpTviAgcbRPt4PNmDmaXqGTMdszXI/ZCBmMXvU2lkrBRqHqVltU/V1W+tJGkiorIZP5/p20NItlUDbv1vbkPMtO85CoH1liF3Gy6OJTdYRSl2B6A4lloN8kAXmcew9fIhVMFsfBC5tR8I3QzY7KdriJzZaNR5sCHOKsMwdTltlHHM0xLgX9xBL33y9UgIeWLAx3K3ROB8HxdF7T0ENdUnPE+n3A6a/9t8xmGz9lKvoVVqMyLabIY9JPc7pDqlA3U1U4QHaFiGAgpf0GqZWlhLc4YATr/Dz/SpEvCplebjoP3jbzpXNF6DFQLXCt9oN9//kEWlm118KgYF387ib5Q== Received: from BL1PR13CA0372.namprd13.prod.outlook.com (2603:10b6:208:2c0::17) by PH8PR12MB7133.namprd12.prod.outlook.com (2603:10b6:510:22e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.29; Mon, 8 Jul 2024 12:01:44 +0000 Received: from BL6PEPF0001AB78.namprd02.prod.outlook.com (2603:10b6:208:2c0:cafe::75) by BL1PR13CA0372.outlook.office365.com (2603:10b6:208:2c0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.18 via Frontend Transport; Mon, 8 Jul 2024 12:01:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL6PEPF0001AB78.mail.protection.outlook.com (10.167.242.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:01:43 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:20 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:19 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:16 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:29 +0300 Subject: [PATCH vhost v3 05/24] vdpa/mlx5: Iterate over active VQs during suspend/resume Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-5-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB78:EE_|PH8PR12MB7133:EE_ X-MS-Office365-Filtering-Correlation-Id: f72a974b-5df0-4326-6a19-08dc9f45bbed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?af7bMD29pLnTJqBZFCeWVJpaGIGqc4X?= =?utf-8?q?tKJvKNFeht7a/goZIkjp2toJHLYrtU9UdNbpaVzGV+PShSUmGEwp29keaXvkScUGE?= =?utf-8?q?h7FaAEwN+DbbZcI9g43/KWQ0UGjkBOT1ZKydiuHi6L08fDXz+acfBL9IV97nPciyz?= =?utf-8?q?OqOfsynyld52X0il9bjkXmGOeADeSYOtkA4KNqWAZ7jSvouphG8mwXcTQsxkUILF5?= =?utf-8?q?ej4rWNgjfeQJxgaI0gwhoro1Wx1aZUpDhEp68UkYfnVxFg5oGfskFZfsZSFwjXhvG?= =?utf-8?q?OmBgTYTfaP61eDyMao5ylnn8l2yKMXaOoGn4i2Eef+Lo0+DclCEerQQTDmpW4ssev?= =?utf-8?q?7I+JDtsQp4GO6aS0Lszj/iADq6YD2PXQCwFXeh1eMOD284uROKzZ/B1LE2nkfcLC5?= =?utf-8?q?xiMKlVEX3jNPcSSD3TECJQo41v9sVL9jsC+zDML7lQHFk2ZGQy91UT/0Q68VogEJn?= =?utf-8?q?nkFFB+blPeV1Asmit2FQMQyUIEOOLgPtkVdP6VcsggfemiPIoe+lbx3O1jaIXgist?= =?utf-8?q?WL8ERBsRvggzkFpZkkyYwIXsThXFol5LLneSSEsipIvU1vlK0lEiZN4Q50P2Vsejh?= =?utf-8?q?9Ze7fgV/Y29b545eugPfCRBq6+JpvX9Zni96+8ZBsYeLOAZiaaXuuYWSjdWc1ZUg/?= =?utf-8?q?1KuDiue4JSWmkyFrvJMJ0WjtOVkjT2gTq558LM4Msdjlw8WKwb1eoxO148tXd1iev?= =?utf-8?q?A0sljezZ0nOEpKsC8mG4e3LJQSQHI9WQDo+12jExjRP29WWvi3eA2TF6RPdZ8cfeo?= =?utf-8?q?sz7P3GwFjv788TAFn3Tvctr8cWhobBAJ1rQ1Y6bQJ6EBpRcXyiGnXBzCn0WW9Qf7A?= =?utf-8?q?p9mROhk88hufObwiOvdoDMAmq3iZ51UFxn/IqbJAjQnQFlcRuBhbcqtVb/Zk/xEeh?= =?utf-8?q?OrUUqzgHt7AJXLcGvY4HkXpV7Vfvz9gRkDcmu65NRTljwdWp3+PfEJX9qumUbWyNK?= =?utf-8?q?N04BRYl4Ux1fkF+kv3nRd/tCcS2bE8BuKi15WmF7CxAWKkkQKoccbCqXFd7tyLzs1?= =?utf-8?q?nH32K2sHYxv18YMh4e3ZZpuxg04ah7AF/2+faUpO6h0qvneLQ+bSOB88wIIkta1cb?= =?utf-8?q?36LgtrELmEOBiiRZvOdb9kBavL6Nqxlgu1vng04ByiHsHWhIJDn0vRZLis6OkWbIB?= =?utf-8?q?24oKK74A+5wXDU/ScVo4pyAmd2JWq2taI1rqnBlm8q3t9XAdf2FZJZXeZTDdwQiKm?= =?utf-8?q?8MjKbLZFSmVAwQ42EMB23vdeDHQYiYQvdudXWFKTDOe8IV3z3+lrcNmuYLr2nQQl6?= =?utf-8?q?atjHHC5gQ8vB7NMO8xrJH+Q11qDwq+ICrGAFyVlwq8zYxxBv2LPXCLuOaDGpvA8+h?= =?utf-8?q?MBgZdIKnKACoXQKevHCjATIq4/dUsC5wYhXg96NdrhbNgdNkznBwfW3KkxlL8BnN3?= =?utf-8?q?68A6UkyFus+?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(7416014)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:01:43.2351 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f72a974b-5df0-4326-6a19-08dc9f45bbed X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB78.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7133 No need to iterate over max number of VQs. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 96782b34e2b2..51630b1935f4 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1504,7 +1504,7 @@ static void suspend_vqs(struct mlx5_vdpa_net *ndev) { int i; - for (i = 0; i < ndev->mvdev.max_vqs; i++) + for (i = 0; i < ndev->cur_num_vqs; i++) suspend_vq(ndev, &ndev->vqs[i]); } @@ -1522,7 +1522,7 @@ static void resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mv static void resume_vqs(struct mlx5_vdpa_net *ndev) { - for (int i = 0; i < ndev->mvdev.max_vqs; i++) + for (int i = 0; i < ndev->cur_num_vqs; i++) resume_vq(ndev, &ndev->vqs[i]); } From patchwork Mon Jul 8 12:00:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726489 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2042.outbound.protection.outlook.com [40.107.223.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7588A13D8B8; Mon, 8 Jul 2024 12:02:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440132; cv=fail; b=rl72wJ7NNw26ETwZ635ADchaNtLIlUTtNYcPgnBEia2gze8SIyfUpXS0+FI71efOvsXzRkrmpqSh74vOV+Df2WTdGliS6uRMyAofOEYZn3mEbNVIvCOSgAfkdYmdJ5oI+NG10G2TGwJr8ud7FC4N9L62PS8wmLAkN7jpeiq06Wo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440132; c=relaxed/simple; bh=nJTWuacp/PSwLXmNgypOE6XPWF8/NdP5C298zb5GcC0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=f4jbSwnyIqcpJN1m1uJFRbG9xy84HhWyL0ycVPBKmTVGkLIYIGMiiPyAme+Xvdfv+nRdTdsywful7Elsjq5YUuz0oSKYO8RthFkO6FD/hvtPOtqUm+9hQTgcgmmPOxMbckvGrDoKg52T1vwojUBb0bmM2Gf1RBEfJZDF69qglws= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=XhDDr+B0; arc=fail smtp.client-ip=40.107.223.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="XhDDr+B0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bWUM8FRgR6cxgdmj571sWPBsEO3px/oibMDytIdDu/E1LxEd3BcTgk5qiogYg8xfW/C9pyPjxFA81Cf1TKGs6Ps+EICpGjcLhtp2nIIpq3bj0y3KY+hQ9FUJxWSdSwc5YWF+rjKqiqwz02P7Ac8MCh4UZvDC+VDYsgKDRVIuvC27RKmHdHVHvgGxsjruOqBBqQSGxByCWG6BlAjkkAmqwsO3r3T1EGom10jSxiVdCNml7334x3y8N0U6zAl1a1Vpn2+RXWNvp9Rsybr1woWOvJgzMOcI9GHLooAy/cpO0GRRR2T8i1J9XU2oJgRdo++SRxaeGd0pR82YyyljnqCNtA== 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=mniGeUGEPsgHLRktUjpUAyHPIq75TXH8m7Krz8Zo9Y4=; b=Iyj0OVVoIqzT/QlTjlWRZv4BX80NCSlw0qYH4peGT8D87jNzyu1ASZq/h3sNhMNHSeVQ5IfCuttoabb4w3t96T8UawULOwTZ0WBUSua2Jk7W5oBAjvlyGh63RVkEF1uDFmqV8U+MxwBKvhXb70Fs+J4ZdRfZ/Acc0aExcghoCxFm9e1nzp7uYsqwrWwH3nwNhxOuduFQR9z3Ss7Xq3mXK5f+ups/Oa+C97vt60hqvwyUJfwJcRHDCLMRcnPF9HXYhbztjCd5OWMomtoOBCLDAthxwbXFHxHbnO45j0h6NCYA6EXSk1aPIBsUWKHJ2NCyi2P2TC8b8rIpLJzqQ0RBtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=mniGeUGEPsgHLRktUjpUAyHPIq75TXH8m7Krz8Zo9Y4=; b=XhDDr+B0pTscTGESM0vOgSyuw+Ff835vI7fkgsqQDB0wZuJvkTH6hri8VJ0SIqzdxUnjY4vwV2EhobImtxKD5Zoca8ymWf3szKGIwWad6s/a3K0C5DrpxtqIpbAOuKfM4ELZ7Vf5Q1vFEfjaOyjI+c0bGAHNubd/jS8gidmkTk/i9Y0Bdk/aRniu8ENkXoKGxtgKPqX7lhYj3+i4f5S/hlyfyUB9vWNi80EAyVRWKB00RGeGZEIWbpMOw6jy/z7yUByjDdozunmQsC3AT+hsV9t20hfp7BQLAmXp8jk0xU9yxXqVWQsxrcZDME0WwkvBH6BzNFecLRJJxmT9ybmOIA== Received: from BLAPR03CA0007.namprd03.prod.outlook.com (2603:10b6:208:32b::12) by DS0PR12MB6440.namprd12.prod.outlook.com (2603:10b6:8:c8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.34; Mon, 8 Jul 2024 12:02:05 +0000 Received: from BL6PEPF00020E63.namprd04.prod.outlook.com (2603:10b6:208:32b:cafe::4a) by BLAPR03CA0007.outlook.office365.com (2603:10b6:208:32b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 12:02:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E63.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:04 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:23 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:23 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:20 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:30 +0300 Subject: [PATCH vhost v3 06/24] vdpa/mlx5: Remove duplicate suspend code Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-6-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E63:EE_|DS0PR12MB6440:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f256d34-44fb-4455-477d-08dc9f45c8d5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|7416014|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NxpECEFNgzuvnaEdFmM/bOtZHKbgF3q?= =?utf-8?q?T7fwxpgWVm6oUPa3m+a5zOypH4aTbuufRwf4EuipDpwX+if2H1fwMBGeMLjkiYRY9?= =?utf-8?q?y5eQY7mgmZuSp9KHVnkLXTjSIqFMKay5pLehqVq7RF26lbTyVBsaQtugb8balLMX5?= =?utf-8?q?kxilfclH5hNlq41Zou1dhxSu1Z/JkgWVBSPBStK9mzHmSrnH8EY2zlQ1cr2765lyz?= =?utf-8?q?b98EnB3oEkTFP76KkYoQUijO+M/S3+ynjfmOnz1AR0kfl8KOpGqoiAVeQmF2Z9DSk?= =?utf-8?q?yXP1pJJoSATJy2+Mf21OT1X20BfhjKl/OnbI361NoIBWQK/KQRuwmbA0Bs3czSQRe?= =?utf-8?q?JphY5nghPxjkbETtcjiCoGS7gftPAJAaVzC2i4kwulpfDnwNrf1xVdtKcTLb5LdOK?= =?utf-8?q?Zux8ggu3/TX0Il178Vpiszecz2ZGzpUgDT9fjqBUwrp71f+wYx0B57BRebm6jiY1c?= =?utf-8?q?MQpbuYnlc4WbK/FFbRMssSmCzIrcQbbryBuqOMfgjbXscnRfT8955d3hZseRUApTO?= =?utf-8?q?12P27HsdfewRxBY4cfDRdrPNDcnghNgap5h1a+ks9Cz85jm31sPS5dxILfGhM7phQ?= =?utf-8?q?yhwyRcTDuqviRzq2I42mhze+9Rd1xi3tRtVdkjMtSDOU0paCXnXdwQcuoDD+TFlHr?= =?utf-8?q?XOPxHXLStArO6OaF94oW3EIJNhyCt41TannQEzrNAIDnuU/8+DIiZ8hLuQ3ErmpQC?= =?utf-8?q?yLPEzTQU9Gy6TwoCiS7/AtpSZMHD5a2/H807XuRzdrizZkemwCw0L2XTznx81gY+b?= =?utf-8?q?/SlCfsNbsY/grmag67w7CqH200KfvShCs83/VClpNNAtIXu2Emu0/uaytBL6RupED?= =?utf-8?q?RPQqEBX6Pp6k0d3OWVmt5j8aKOyHCjcljo52EWvO0sLnokSCrVHYWC8Vl9tpNtToS?= =?utf-8?q?tBJkOqFtmus+9OfYqZc3kFdcpNdQZXVVcD1tTWicucJEcmTxKe5hEQDJ1s3gHRCWR?= =?utf-8?q?jBY24FQmHJ54OEJZJJv64l+gwEhioPzmbA2j16JCnRA3dj/s/wBNvShhRQlbK9Z/Q?= =?utf-8?q?CBCOharz1V8+V39XRS9kmJVTNtBJs5FW97paS1GekyN2vXx0yTzMbLdco6zD4Wr2t?= =?utf-8?q?W1vsLryZsLArSbvmhvMbnDgqij6ShEm6XJ4Z7OMongTT+ZQ5IRkmcCobf6M4gp1RY?= =?utf-8?q?QONO69LsnbcccmwcwKNHcKyZcneWKUMkL1j156jy0IbWfoBY/MS72gyYzbXjJKVhd?= =?utf-8?q?yoAvN8ITz363P8RzIA1ZBa395YQiP/+81T9krRB1TcWJJznaYwDeQPL+81coO9q7h?= =?utf-8?q?N5uKZygvVomXIM08mzGq34SlBVv4NfkDltky3/xq8MOrcwLnzGg97epBCUBzI6PYQ?= =?utf-8?q?QTq4wx3AXgfsnLxTEx3uK9/3Zfo9RKLcm9UerKLgc/S5yUXUVRzM6SRw14VYSNfNg?= =?utf-8?q?9+h9jvDaMX2?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(7416014)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:04.8873 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f256d34-44fb-4455-477d-08dc9f45c8d5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6440 Use the dedicated suspend_vqs() function instead. Reviewed-by: Cosmin Ratiu Reviewed-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 51630b1935f4..eca6f68c2eda 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -3355,17 +3355,12 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); - struct mlx5_vdpa_virtqueue *mvq; - int i; mlx5_vdpa_info(mvdev, "suspending device\n"); down_write(&ndev->reslock); unregister_link_notifier(ndev); - for (i = 0; i < ndev->cur_num_vqs; i++) { - mvq = &ndev->vqs[i]; - suspend_vq(ndev, mvq); - } + suspend_vqs(ndev); mlx5_vdpa_cvq_suspend(mvdev); mvdev->suspended = true; up_write(&ndev->reslock); From patchwork Mon Jul 8 12:00:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726491 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2087.outbound.protection.outlook.com [40.107.236.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9031B13E3E3; Mon, 8 Jul 2024 12:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440138; cv=fail; b=axi2YH2pDwo2mvq0FwkLze2ak+fgNgIRVkFUkvYwCOXo4UlMilfUimYW00PmJ/HwDQBIkVAvyv3t+QRLQ2t7yphLITxGzThJZcYTUB3a80vEFxkQc+1kqi7u7kDBRyjMEzRp+VmubmoWGv+eD003DUNIbUwtunuXxUYuwcXwITM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440138; c=relaxed/simple; bh=TVHfjxmSt5akHn4s/rVliwdUCFm+KTHasMQySnLZlTw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=OPcOvviWIssFfwLmaVgVCwdOdLITHyphW6+L0ywQc+rJdBmJxLH+suSQStGcUWONt0t6VUH4cG0p66zWSVGbSE1zeYaar4l7zz5hlz/Rb54ehESoAklRCgVQBGQdgNqVY2fjbI3KhRsqQju0BbeVMJMoPOELHeZQQpOoi8WwcVA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=baJeHqVs; arc=fail smtp.client-ip=40.107.236.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="baJeHqVs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jAyRg0InXuJXyQll0Iz4EidK+42ElrIpAd0TSXj7azXfXe+K1uksFjLEzeEdQcrZhZuJM7pXGwC+GaDolNBXWGVCzOVbhPx/W8BqV4f7WzydYEnB7bFIwQcKxxluazMWAxd4HxlOs2/tlRONXroOT8NaTQ/blzLp8Ex0MM8tzypRk1qXc0PL2cXP6yIwAZEUS8Q79zuL0bJi2PhaBaemLvsvMhG1uB+Mh9FgPspSy4fLgBNBJ/N1f8GIuqvik3Cq8Q5B6SDqsDQ0TtW74tWBaJUdgN7zfF/W5qvA1tgnYFdVfXLcfKurLDJECEvqD2Al4cb8imxmNdnzxGhWrabUzg== 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=Oi29vWT4QU7y52dtIFY8mr1iiukNC8OZ2PeGectkxR8=; b=jPOglGwkDEWd02De37Rp7wxhJtyWY7udL7sVZheNKg9X8Zki5J7YmGluTLE1K45npo3psqcSpswQU6LJ47BY1j7R9I8a/pgkciPhkJFdXAWcc3IgFPdx4Fv+AnfAKdykk6uXAqZB8DGOoGY+e+z7R/SShZ1RNsCH8+8to0s8JH/tst7s3UJlRcp3JN6uwgbp1BdTZkBNqUWNppwN1OF3PsAbl5nhYPObCpEREdEYOqny2a8sFHmkdKFewiutnuKLunhn9eSSBlM6Zxs9r3zLuakd+AkepD4/F1cEaY6Ks+QMiAmGDCgXx8ug2kfmqgH5wANRueKN4z7MpNaBNJeSaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=Oi29vWT4QU7y52dtIFY8mr1iiukNC8OZ2PeGectkxR8=; b=baJeHqVsNDSpG4s3ZULSxUmJA9IZa1FsCP6cm68gMY4Tc9Mmvso9kkl2e8eOTUMzwnebTfHCazugdgryWQ7e6ybnsRHK8JmwGYQRLFEde+aZ+FvbZUjP3pBbtZma0ul7+inTaYVAPNotCqJdrDt2yDfV8ujUfrX7JvQDb5Z0FMxbyjS348bcTmISPLA+F64VsufCoWsH9LLpKMOXGDH58UFIRQ0D9y8V0787M5Au/AU7e+Zn64zfDf0QYgsZylaxyNJ8227ajxgTH/w6BjGQLzYLUEJtLpmvk0d2LaxZ8Q1BR5LfGs91uIxL5GaaAvJ3YKB4DUd/2UrsE2cvBj4h1w== Received: from BL0PR0102CA0005.prod.exchangelabs.com (2603:10b6:207:18::18) by PH7PR12MB6668.namprd12.prod.outlook.com (2603:10b6:510:1aa::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:12 +0000 Received: from BL6PEPF00020E5F.namprd04.prod.outlook.com (2603:10b6:207:18:cafe::ea) by BL0PR0102CA0005.outlook.office365.com (2603:10b6:207:18::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 12:02:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E5F.mail.protection.outlook.com (10.167.249.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:11 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:27 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:27 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:24 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:31 +0300 Subject: [PATCH vhost v3 07/24] vdpa/mlx5: Initialize and reset device with one queue pair Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-7-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E5F:EE_|PH7PR12MB6668:EE_ X-MS-Office365-Filtering-Correlation-Id: b527ada5-177b-4513-a74d-08dc9f45cca0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Ve2xpi62J1mRWxm7GU/MYSu82tbqcIQ?= =?utf-8?q?4u0e3s6EbLuCjcEE+jx3+hA/9XPfXzYPclKfVgrDNtP9D4SDhjHG7Zu+4Uucis4re?= =?utf-8?q?sN98UNshATCNhPHmJlbM2ZlBwiiDWL0NxTL6aJNqBUr8LMu7b5s7bfzr1OjWO2fK+?= =?utf-8?q?gmNAuSPb1KCdmVIQIx+HxYEDwSeki0/LFHjZ1nP80Fd10+oe2jmbPD5QgHEgb3ipt?= =?utf-8?q?/a4qpFJhZq6U8S9sidSBrSUMzm+Ph20d24Gig1lR6d5y5ftQTIqJf0A6YO4wJ96PL?= =?utf-8?q?VE660GgXkgC1FNUQk87HwaZpKMFZ7tVLY5R+RSj6x1FBnkdBne9WKA/VyEUijehG9?= =?utf-8?q?9Bu8QqJsilbM3OumIxe9dGwPE0UHsL/HAVbbHjzAS0d+S+voKPvgrukPXCs4BRNal?= =?utf-8?q?FWkF96Hn5WU1rnKWy6D6x7go1qNl0kGZXUjI8LBBDNkp12WhGJYKSBt2AJNdePLry?= =?utf-8?q?uKx1F+sGXh+ZjXbG64PJS8ukfmPIUHdaZ/BgONRS9pZUaRdTNSu07cU7z3xW/DjwO?= =?utf-8?q?1LbbRfoa1hgt0EmqKWx2pLUoduqvHQX1RqV7fZnLuNVUBxeH3UV3ZOxexnDIvCqhz?= =?utf-8?q?iugeiaOu9j+neq4KsRbjWxBXUSOuzVN+RB2vtaAxEuP1XctdhPxJqgP14Zq/59qfq?= =?utf-8?q?qKMw/mL0PiCL7wDGMMxzoWYAlg/vLpZe2LrZCsI0QkeFdDaOIBJST5y4CoOi1TkPY?= =?utf-8?q?kb5tldJZe0V5qlqgRybDx7L4jtBOLo5DCBIGxWGOuguOnaoUTrAgyjj5FgQHvE2Qs?= =?utf-8?q?AwYreudU71F2PmPUYDO3TLKsyVf5ThWJZXzdEsKY/qWqgpVi2q2XHWREyyqWjI3+N?= =?utf-8?q?t5A6qRpUB/rMfalac77Yq3wDQ4avS654oPn18a/q1PgT519DOcuYLJZ1pr04t7gXN?= =?utf-8?q?Brc3W+4p4lb2dP5kA4tyeCgBYJ0pERKiq1xPEcGmXBsEaHy4ARfEeKLHaV8WoouFf?= =?utf-8?q?jTRBBbm67pSKRXo//c8FQRQ+CPeAAtXDrgGfDRtzr9cRa6Ku1ByVBJez9jMemTzFe?= =?utf-8?q?g21UabC5jjIdbPu1BnLpnB6m/PKlkVfm82wpI9GxuU15Ps0ohmG+rI6RXtjMMFTbT?= =?utf-8?q?FS4D+JJ2Rw/V2jMfXsYBfY2YMwJQSa9+HVDyZxnxDhkM3hYwf8HjCRNhXxJWz3tqJ?= =?utf-8?q?PgIe33vcB0rReOCzexOk9QyMQA80KmsCrtEqMP5DhBhXlkXj+UgoOQbzUXeBhA86x?= =?utf-8?q?tJe0Jf6geZnrzvXGNxgRpBJszS+R7y6bxvfe6HYA7lOKDLCPi+XzHPd7VKsUdMgYQ?= =?utf-8?q?0+TNIIYHGSX9/kMcsrVgHihzRGGH4XOasZWv6aj27JTi4rmpbV1pQSTMdsKrbQ51W?= =?utf-8?q?xfVZ/3F5jAQRLqWW09GHHyZHgF6iu2yReEEa3ZA/XRN3gcknJVvz3Ey4V2irxOr8f?= =?utf-8?q?bhc6KPVcjWK?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(36860700013)(7416014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:11.1595 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b527ada5-177b-4513-a74d-08dc9f45cca0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E5F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6668 The virtio spec says that a vdpa device should start off with one queue pair. The driver is already compliant. This patch moves the initialization to device add and reset times. This is done in preparation for the pre-creation of hardware virtqueues at device add time. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index eca6f68c2eda..c8b5c87f001d 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -48,6 +48,16 @@ MODULE_LICENSE("Dual BSD/GPL"); #define MLX5V_UNTAGGED 0x1000 +/* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section + * 5.1.6.5.5 "Device operation in multiqueue mode": + * + * Multiqueue is disabled by default. + * The driver enables multiqueue by sending a command using class + * VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue + * operation, as follows: ... + */ +#define MLX5V_DEFAULT_VQ_COUNT 2 + struct mlx5_vdpa_cq_buf { struct mlx5_frag_buf_ctrl fbc; struct mlx5_frag_buf frag_buf; @@ -2713,16 +2723,6 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) else ndev->rqt_size = 1; - /* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section - * 5.1.6.5.5 "Device operation in multiqueue mode": - * - * Multiqueue is disabled by default. - * The driver enables multiqueue by sending a command using class - * VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue - * operation, as follows: ... - */ - ndev->cur_num_vqs = 2; - update_cvq_info(mvdev); return err; } @@ -3040,7 +3040,7 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); ndev->mvdev.status = 0; ndev->mvdev.suspended = false; - ndev->cur_num_vqs = 0; + ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; ndev->mvdev.cvq.received_desc = 0; ndev->mvdev.cvq.completed_desc = 0; memset(ndev->event_cbs, 0, sizeof(*ndev->event_cbs) * (mvdev->max_vqs + 1)); @@ -3643,6 +3643,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, err = -ENOMEM; goto err_alloc; } + ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; init_mvqs(ndev); allocate_irqs(ndev); From patchwork Mon Jul 8 12:00:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726484 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2047.outbound.protection.outlook.com [40.107.93.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FF6A84DE0; Mon, 8 Jul 2024 12:01:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440116; cv=fail; b=b9+HHZG8dw/9QzrRJa9NFTfEs3P/IPZPpm5AboWYzfzWwf6Eo7sFFbSoB5He5k0hc0gs4tUizYxddMA9vKZDrUJcWgdEYwKt4dYLY5jVLE8eCrbkmIJgpwlW4ywTtYZgIp0qTts8EY710wRDRldh53Nh51IlI9h9E/2pHRTMXI4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440116; c=relaxed/simple; bh=dzufAnZLV9C8YeB28Txk4NRcR/9Q1yOXE+3er4oywEI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=DxXWc3zerbEZY/FyPWeepZ8UZmhyXDJXW2mjkN8gqM2jlrqrLzWaRqetQWnB4MBOKSrAWs0c/SBBfkplppdCq+ev9WxwjqxJHtRkHS0wGJfsXP4uzA9GfFrJ7w08hjxuzVLsnD76562Si4DIqhrDzJzE+Z3yx0SrEoSmfhJdY2g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=sLg6NJ9p; arc=fail smtp.client-ip=40.107.93.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="sLg6NJ9p" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N8fAHWwGA7oLvDi5J0OOHe3j+sJHs1h/S5fTiQlhepXiTz7sn6G6Phx0ebyQ2IAAUqpLaART1Oevf+9mq3AFjMid1RgLwTp8tryH1G/1b6KBHogs1HCRBzQjBX3wN/+pZGv8ot2qAYgpApLoM205SSpisL4fck97dwIMF+j9EX1F+ods9cyWj+zsHoNnIm65iev8SMUtwsqQBCHMby68hZSo6q1yhvdh7BKuvZz+LUvL4VUIGUMINAb/nv01QKgwrNXFFrH9F/FYy13dj2iFxzrfgu4gmqHFGmYS+DxWwMm3j0svSHKrjRI1ncUTeY7/cVX2nnuMtrujkZlS10WLQQ== 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=6bcDravm1b1q7vkUfcUHo8y2CZ41fChrQGwof1Uwntc=; b=nwWftXM4TgwXE5ZgeMw6BJaQF3dqRO9jxWAt/wghdaoLSbnP5p/Cbq5HVzeiFfi0H7WeXXmHbIHrnlftppO8Ek0MASZ9MsZJzqeai4xIHAm2R055e9HtDHjHJnhrpk3xLpKmRxwcDDN6G486EtUrjSsERQ/hGZp/NkZAC4N0ka7qn79CtBp6llOtBELTfYQ4mHovQyAZQXLbvZqBR1JcWJv0SKdHoahITPe4lrCxfkOzDt1DhO71xUJCr10FPBLL9LKIhmUUEBXjqvdCh/prhZ3aLjWP9GarMy5CeBAuWCPAP1v06FNND2G5TA6lR31QuLNuKhDGvXBnLpkfKP2Y1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=6bcDravm1b1q7vkUfcUHo8y2CZ41fChrQGwof1Uwntc=; b=sLg6NJ9pnDJhJzE524FP36ERrcoW/VHHKi83bZiwGNKuZkkPf6PjHL2GfjzZ8IOuvHhdJGSFr+tOof3d/QVSAOXwuqgGusxZa4lo0dWl7vM2zJuwMez4prx1JFlC4YWgb3JsnzYGDU5+QT4Vo8gTiSO0+/+o+vGtsdKAulkVfrLk8LdXbwy6c1Ur7ImouzUtgA3TBVayCxPAIPWpLudoMhplKD2ck4DhEC4bWwQ1UQrt29awNyb2wO/ZWzAuFYpvbGUpr/a4U7AM6o/Fg+MwgM5XIg6UokVKxIstjvSFdrMsyHUDS9ForVHflGXOtBY0lKjLDp0YGWqRUD7J6zA8Uw== Received: from BLAPR03CA0063.namprd03.prod.outlook.com (2603:10b6:208:329::8) by DS0PR12MB8368.namprd12.prod.outlook.com (2603:10b6:8:fe::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:01:50 +0000 Received: from BL6PEPF0001AB73.namprd02.prod.outlook.com (2603:10b6:208:329:cafe::f5) by BLAPR03CA0063.outlook.office365.com (2603:10b6:208:329::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 12:01:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL6PEPF0001AB73.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:01:50 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:31 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:31 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:27 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:32 +0300 Subject: [PATCH vhost v3 08/24] vdpa/mlx5: Clear and reinitialize software VQ data on reset Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-8-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB73:EE_|DS0PR12MB8368:EE_ X-MS-Office365-Filtering-Correlation-Id: d98d9366-b098-4650-649a-08dc9f45c055 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?H/di6i53ieVbfnY9xDwMmdTF86kW/mm?= =?utf-8?q?JCxl/Ou48kZquj8yJrTubPS5fNeWiLeEEAW4UolY2dyttxW/HL0AtqhZXG78ZEpYo?= =?utf-8?q?mmApYvqKAMzPoVipuk820C+u4UZxj4bScQLAqvkwCsRsGfhVNNUQPocJImvGKB6jk?= =?utf-8?q?DH3PDKOVIiBQRMssCUJKcrMn7EQi6Urha2drAJ93ZNmBMwiJdXfhi/tXetidHiOQZ?= =?utf-8?q?Rz1HswyodZ2+l1IIyEwjtPfWG4TDbn3BdJCYImk/SEHflh/2+ciVK/NBEO7Qt5Xk4?= =?utf-8?q?oel7dh1cPzY+xxtMBkE6PUlrlheB5WGx6ORRehnP0spFC+UPtKuR4Tt+McQ2UTaXo?= =?utf-8?q?fZk8LLDObjXxcOeWsMsQIhy8YdZDMW1WQUNGpyGtJv/s8wLksbEtnW0domjxoNlGi?= =?utf-8?q?S8L/9HVqtwf263xUiLUHGykaChL3hROPGIpeCGtTY49YCQWK9kwdO4xMBxextlnvg?= =?utf-8?q?PssibWcJNli2PpG6f1gxxZhHhenU85/qdXue0C4udiyPIBRTroXTyxfeSvCDXUkNA?= =?utf-8?q?HcakM7rMJh8emaIQAhqYkWlQ2LNs3YnSmiCjDa1APLIyaMN9K5llKq0b6euN40wcF?= =?utf-8?q?OcZNVfEYBZERHPdmIXffG/7FBeK7L0xbfq407TLvxXDKUbVqF/PgF+0BtK8UIq/+/?= =?utf-8?q?B865gMRKPw7O0+DxOHJwDYPiktXE/KC1Mynnyf9YRk4tFsPz5+CyyrXYuzHlAWsi0?= =?utf-8?q?f/pXuI6PYunhiEeVBfmtB70dgECVqKfRAEj9vn2eq5Q3GsOuvotGBnQE2LeeVidh5?= =?utf-8?q?wHqgdVXUjp63nzez9c8uxGYCRZL5VusFmPu9usX7QBVpS/NBRQynXofOksR/QYaKK?= =?utf-8?q?HVoZZSBu+tF/99uaoOWYGR4JBwfVg9FV7QJO5DfQ85f9Im7wWKZybY7Fzy/KBa9gm?= =?utf-8?q?gQlf/7yzb3U6z2ta1mzsutPXzL+dmC44QpulkoknsSmeWhCuTTlkToYUkuLnH5E3y?= =?utf-8?q?6tlBcrOzZ4lf5DYeYnlQuvZxVMTFIAGzHhQVafPlrXCzzfeMOuLKTebfnJA2Vlr5m?= =?utf-8?q?WFSWEpw7kpuUtf6AXWVBhJ5FYtO2q4mXDdKZUYnLfcXi1OjWvarVTCII83/tQmn2C?= =?utf-8?q?O/yw0M58l8jx51vIhaDQYSbsYgs5l0zslbiohgGXzz82S2BLgZBD7mwy1pEK6gvpZ?= =?utf-8?q?RBBpCtw5KeW/ZDckyv4X67EOV8te+PAb1emsDA8mcnko0JJESbJMN9BLMYbIFURSo?= =?utf-8?q?Paam90sFUvTEfh0LJAbqBcKcxQQYjQ57TGx7hQtO0jsnCvSIvFgL92Z6uXOU5PSV6?= =?utf-8?q?2Lx/0/OzWF6rikLB76HtqVplbCDSGGL8lIhGP7yZNLt6KPE1V9CvijdXQ2IflX+lh?= =?utf-8?q?fUpOFxqpyZDlQ77YzTSE5NOFa70hGgsFNlaSpH6r+XufqvAC0fmfuRHXhwZTi1Ba+?= =?utf-8?q?upsNniPGam+?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(7416014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:01:50.6899 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d98d9366-b098-4650-649a-08dc9f45c055 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB73.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8368 The hardware VQ configuration is mirrored by data in struct mlx5_vdpa_virtqueue . Instead of clearing just a few fields at reset, fully clear the struct and initialize with the appropriate default values. As clear_vqs_ready() is used only during reset, get rid of it. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index c8b5c87f001d..de013b5a2815 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2941,18 +2941,6 @@ static void teardown_vq_resources(struct mlx5_vdpa_net *ndev) ndev->setup = false; } -static void clear_vqs_ready(struct mlx5_vdpa_net *ndev) -{ - int i; - - for (i = 0; i < ndev->mvdev.max_vqs; i++) { - ndev->vqs[i].ready = false; - ndev->vqs[i].modified_fields = 0; - } - - ndev->mvdev.cvq.ready = false; -} - static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev) { struct mlx5_control_vq *cvq = &mvdev->cvq; @@ -3035,12 +3023,14 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) down_write(&ndev->reslock); unregister_link_notifier(ndev); teardown_vq_resources(ndev); - clear_vqs_ready(ndev); + init_mvqs(ndev); + if (flags & VDPA_RESET_F_CLEAN_MAP) mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); ndev->mvdev.status = 0; ndev->mvdev.suspended = false; ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; + ndev->mvdev.cvq.ready = false; ndev->mvdev.cvq.received_desc = 0; ndev->mvdev.cvq.completed_desc = 0; memset(ndev->event_cbs, 0, sizeof(*ndev->event_cbs) * (mvdev->max_vqs + 1)); From patchwork Mon Jul 8 12:00:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726485 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2069.outbound.protection.outlook.com [40.107.244.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BDD681204; Mon, 8 Jul 2024 12:02:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440122; cv=fail; b=V4RBkKmbQNxGho+hacVclba4lh4HbAT5kSHwUo1hjbvIaai0vbmB2MBCtCb0APZ3S7inmUoE8GT/wRn/t/fwi172AgKT8eS1NatgzRoD0YbDsXh/fymr4gnDscsUuR9vVtCIkZbBe4KJ6a/K9nAK1VuZjalKZqbjYxon+64+Opg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440122; c=relaxed/simple; bh=12Dr6zuEz2nc2bE2dCzdzt24pNdY8ZFBxTyO1Ij5xvQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Vht5y/7RzrnixXvQHoRAwfJ7MjP4+Ku2+5qIBFPF4K+yuP9gIrm9cfAmf2rn6QtB6+xDOoE998nJE7ivu+DXMt0mpmcDJM/3R4UJKOiC/PHMlJtZhxmlElvfO6h7DsqOBJ43U+drJ1kQnUkGtaBCxdqcXpeqVYuLdfLBrHHPwBs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=rojzHguT; arc=fail smtp.client-ip=40.107.244.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="rojzHguT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ws7OBmJRKvKfngzUd1YYWZnDCp5lmEHhvgf+TbpDaxDX1sl50TuM1JTcQKiMcyFRNMSjufd7ORgTQBJ3OG7ZmmsiQz2OiqrfuEDFXPJyh9I/96PJTSwyT0SguPSdDDmsAJ/Pvojfmc+x4GXbOs6QSP0wOFH8w40ECNuuR2RSmaLTzTQsAtVr6oJmk0LJZIJ1hjSCZ6qvdbPo1rt7Iait0AhWgo8hUVCewjPIMTN3P9RqVosjykKswNOMor9+x9WEiZUEiL42DWWLgnX1fh+OhvevVN4CBdxU1aHAyOy9lssn5EBo+Ww66B5N2+H6nBb98Y6Gx2ud9SBOYBcNyPjeSQ== 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=FCmX+zWkXUAYQ6ml53q+Q3AVZGrx6w5R19RLYsqCCsU=; b=PL+6f1NKTsEYG259Q1jOzgC+veJzBhFrZlSfDtTqhsmlgEsyF3eg0B5wraQlonQiPLfbIjgGSB2Yv69pOopcIU4E/e0/FrXYP8D831vDypxBrDz8c8+GHrzcLUY8rZVCebTC2UwXBTjSZDbRLK3f1V37n/q/XRoNWCBdDg0uHUpkfRD9gQ13illaO+ZdTjYkaYQmzPD482UFpjFK4BEe/BsNZy5wb8HMBrOJfwWUxxR/Djh4wOEAebtsLJ0TwUP6xG/zyDNKPE9BQtpMR1uoMut/CNcOVJ9TYXTKURk84S8A1Yq0earDg90hoPRyT6UUvZ34OyYk3+Tr+VooljX1Gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=FCmX+zWkXUAYQ6ml53q+Q3AVZGrx6w5R19RLYsqCCsU=; b=rojzHguTX3e/K/u/VgnxqHUozpjFf979FXswyJWLf8AwY2/DRx7NpE2GNtNiYtQA6oD3lZ0Q8X24bj8pZCecJL99W+alKm9cW+zyEflUObH9gNGYYS/BgZixT77aUzJNMJwo7d1kWY+WkONSLy43ZzJVngX4wcnQ+IJkftJ2oGrdDE4VQeCSMtVG8tqzK6mPJo9xq5AoHu4KBb6/1BdMELkbWgI9/mJz3ZG48IXIykdaS6n9lzRjOWmWBAJ1j7akrzCCX0XScg263VHoUkpM26fBu1oGuA72vx1q0+1Mx39YqtM2e1hG9YCZPqnz2WLZfiQdn2B/0On5iEanZW1nfw== Received: from BL1PR13CA0181.namprd13.prod.outlook.com (2603:10b6:208:2be::6) by SJ2PR12MB8182.namprd12.prod.outlook.com (2603:10b6:a03:4fd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:01:57 +0000 Received: from BL6PEPF0001AB72.namprd02.prod.outlook.com (2603:10b6:208:2be:cafe::4d) by BL1PR13CA0181.outlook.office365.com (2603:10b6:208:2be::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.19 via Frontend Transport; Mon, 8 Jul 2024 12:01:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL6PEPF0001AB72.mail.protection.outlook.com (10.167.242.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:01:57 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:35 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:35 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:31 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:33 +0300 Subject: [PATCH vhost v3 09/24] vdpa/mlx5: Rename init_mvqs Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-9-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB72:EE_|SJ2PR12MB8182:EE_ X-MS-Office365-Filtering-Correlation-Id: 8380f6ff-d29a-4da9-fbdb-08dc9f45c47d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?FHxbKMPqA6WGcwEEiTY/LyQZPsGScdc?= =?utf-8?q?b4WKugPXR7qK4wftVvuwria7vwHxTT/HVr21ATHp18XaIlriRiOLE0yzsUj2ktLye?= =?utf-8?q?IraR3v7N9zsb5hMQe8eNt7R8rANF3Gn/gPBL9KmfoaBlIdV6M6FTUiK9dXXqV1zo3?= =?utf-8?q?MlXTJxPDCeYno+FdRuxfjO/+qMsXTsYxtKAkIocblfCmTt2uVPPG7XTZhUBVtjHth?= =?utf-8?q?cSaxZ96vDpVcKjqHEyTEHKqCg69Y2lSFsvM3c5zSIX/E234G5YxDOvt6z3vw/fQX3?= =?utf-8?q?O81huEjfHb955o9wPVFTkPK7vI94cqYtEJot+0WbIT3as/Qhw2Z01uONZ8HmZ6iIW?= =?utf-8?q?AEoFc8QFhGTEsVd+qLY/ec0CgJ8ttm4bp96veAW3VlJTRsCHjgtFg+WsVZngBc3lF?= =?utf-8?q?D9tiKizn4PYWlQLv7Mcvzqr8ZJ04wDg6K9A+J3YMV7iW/oRGJup9i5cmP8R9OPkSp?= =?utf-8?q?rNiqFmgY7YjpoDIZlG+BRc7w2pG9X7MjOXwPYC5j9gfV3L43AAulVp2qgAYBG6zU2?= =?utf-8?q?y7x4+8Vx1tpOZLEMzLGOl5ynIb3qA0rEXA/WGTpl4LfgSekF3xVj++q/BIBondgye?= =?utf-8?q?e9R1aYpPIcwSXO01jqEm+2o/Xvvj14P+r8DqFX3RPQL3r6maI9uG8LGMTdgS5YkOc?= =?utf-8?q?BmuFOAwCNOaPmE4YZwQfW16jBTeryjObFQ9Xmc5WGdEDt37ephFsmLCfyxt7yWY4j?= =?utf-8?q?vfe8a9aDowIFcJ38gJDWz4/1fmWotc/zMA5BIloUTmTerBIJGn2Tb+181UIYVV20R?= =?utf-8?q?k4iYL3VzVgHbp3pXaoxLSjbh7UhgX3ZRK1R7QZL/uHZkwscGmZATEDE24eCZr1rq+?= =?utf-8?q?ZzIqB5fbp2HzZbRiK7rSyPpeFwVM2GIMb5mwHW3RDHpQSLYSXuXCESVGsDAsIs3mB?= =?utf-8?q?/7Ig0V/HpjY3GWXQ4gRtgqHPDwH6Xrk3iUDYOSBI8UEFYlbBlGhl0LFp0iEf7ACMA?= =?utf-8?q?xs+ItoFq61/r0jFgwPni6Ph4tyw13FSokESIH3HORxlVfYMpT112fNGaim8G1k5hx?= =?utf-8?q?lToC8aFNuGiwWbwawcyr0pAxTiPewoARCiW2ofsjUERkT3gFEmEIaUEG/Dd/UCXb7?= =?utf-8?q?Z1jiX2clYc1QbdBIdo//qUei5cf53XXpvs/rwpkPsMQ5SML0k1JsrYTukgafjmdrZ?= =?utf-8?q?/5s5lRheJKe1hky859MfdtI4OFLxd31VQesfQ9FmwP9syh6gI7tlYPa1arpnbmHo7?= =?utf-8?q?KXMgCUb2s5Nz6S8wdiX4WbH9lUnZPxJtAcz82eXRyXXZeD6x+Jj1qak7mbiAQU5bv?= =?utf-8?q?HeEhXcNtHwLUVkBeFetp1GiWBPI66Fx70/wlPilQolyezyi5R0Q+fpWhsswIAC+gC?= =?utf-8?q?5s/rvXVvxsBTVlzOQeTZX6X5U981NA6k3Vin7hegBBY43PM7G0gLAt/whmOxwWE9V?= =?utf-8?q?kJSC+v6HfSi?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(376014)(7416014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:01:57.5730 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8380f6ff-d29a-4da9-fbdb-08dc9f45c47d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB72.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8182 Function is used to set default values, so name it accordingly. Reviewed-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index de013b5a2815..739c2886fc33 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -155,7 +155,7 @@ static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx) } static void free_fixed_resources(struct mlx5_vdpa_net *ndev); -static void init_mvqs(struct mlx5_vdpa_net *ndev); +static void mvqs_set_defaults(struct mlx5_vdpa_net *ndev); static int setup_vq_resources(struct mlx5_vdpa_net *ndev); static void teardown_vq_resources(struct mlx5_vdpa_net *ndev); @@ -2810,7 +2810,7 @@ static void restore_channels_info(struct mlx5_vdpa_net *ndev) int i; mlx5_clear_vqs(ndev); - init_mvqs(ndev); + mvqs_set_defaults(ndev); for (i = 0; i < ndev->mvdev.max_vqs; i++) { mvq = &ndev->vqs[i]; ri = &mvq->ri; @@ -3023,7 +3023,7 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) down_write(&ndev->reslock); unregister_link_notifier(ndev); teardown_vq_resources(ndev); - init_mvqs(ndev); + mvqs_set_defaults(ndev); if (flags & VDPA_RESET_F_CLEAN_MAP) mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); @@ -3485,7 +3485,7 @@ static void free_fixed_resources(struct mlx5_vdpa_net *ndev) res->valid = false; } -static void init_mvqs(struct mlx5_vdpa_net *ndev) +static void mvqs_set_defaults(struct mlx5_vdpa_net *ndev) { struct mlx5_vdpa_virtqueue *mvq; int i; @@ -3635,7 +3635,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, } ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; - init_mvqs(ndev); + mvqs_set_defaults(ndev); allocate_irqs(ndev); init_rwsem(&ndev->reslock); config = &ndev->config; From patchwork Mon Jul 8 12:00:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726487 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2052.outbound.protection.outlook.com [40.107.101.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4285137905; Mon, 8 Jul 2024 12:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440125; cv=fail; b=o678P4lHIjssdl2GDAGZ77eDKuYTrQWp7Ud0wmEvV65jaJaGsU2aLjBM6/OVJNGOoY0dGeOOAjye6gezTLErFd7920Lc7Vf73mZufvIPOqZ4r/niBsPzqdYPV52qLaIOfwX3Te/sFLnU1HxRlOUfz8bTIctlySJ0/4Vnu+FzCjU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440125; c=relaxed/simple; bh=zbvR064F158vGkW71AjcuFOO/I2BUq0oz2eUDxbT+08=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=DJwPMTfAeBscBaQK6cZviNstuKlhCua2cvBuyuVCoY5ocsWCv/xbGymOxqAYxIjEnA6sciPlDR7/QZWIf8rc20Y7p+2qt6J9c3tA37iRkBlcFryAoDUJVCM1aEOo++6g9N+u3y/LQUFSZBsHhbanJzmsS6t24SW3YHMQkVScr98= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=suGpCmBb; arc=fail smtp.client-ip=40.107.101.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="suGpCmBb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Usw8b+MpzurEVB777+oOmJWI+qZOrEs6/LrSITge46RJBbxpK2PXaQGmrWn1OsX2B++cTn7B+xpBpXhzfk+gHf30Gr6a020aJfAYo0usJ4TBd1ecsXfQkqIqMt1oQE9Osu2WxGf4dgoRDUvME9IdKA3CZ75ILXd25edIZS3YTk4X9IffUAj5szw/Tl89prY+FYTwqURpseQnoyekg/4HnNNzJ8m9P+Nzxn6k+3z9OWjzH4TnIvY/1kYnAT+gzSOtF3eB5ipp4YN84AmJOJECDHQ8j+tYaC7cEQjOY9tBEn4bj9esMcJYNCzXs5HISNWaiyZDgvAGENC/cnqLJhbIag== 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=49ogM+1PCvscEbo1kjuXz4sYCHgwi0TBWnBxosHTgS8=; b=C98JL7wYfRFsDCU6caVn6zMgJNOjh0xTzNoHrL5MULDOwe1QeTp0tV5br24W4zoflVT2ECLo5JXcw+nXZZJpZXAh8hQfkQ+gJNkPbxmmezFDji8NQnFMaPyEI5a5OFtpDs6jMdudlxlwlTNtCt+rAuTSX0Ve+nJFcAMxcd0JXaQ1uJ3vqi0Z+kX/wnjtUWqhcZktI1B3zvIr8OvG6PT5zPgyx37jg+aE+qlVTJTIht+jOkxJ2loDtJj7nNHfTQ7DIEHCjS1XV7l3hpGnM5d7p3oAVNBHyJjsFO8yvlodnbf7wxy8ZPZCKNJqGFA5IsSwHH4XPifVV/aSCsV8bXUqYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=49ogM+1PCvscEbo1kjuXz4sYCHgwi0TBWnBxosHTgS8=; b=suGpCmBbwjTmnsnNNGxuc5PD4PWV43u+OKIFkZi2Gafz+HNBe5pmJTfRH7IUZx+1cPYqkKqXENmtwRllBz8w/Dr6058U3iIiaYjRzUGyBZJ3KGdhj1HAmo9T4lhX9uZ3uwpXaDwLxjS61Psx8USpk9sIzeVkvPMenK9kSWvjnIRhJD0eykDUNjnWTwmfaq3hD3FsqTydm3atCa9Ubj4F3BE8Ss1vt3qrR7MIlaA1KEVRGJtaRah8XxpQrQ+/cIL+MHt/Zg/DytJ27GN6bLW1q+gLJVGSbGDC9kG/TByvydeHWAsMDigSU/fPi1pf36DiprLCfKzondXVigd4xgOuUw== Received: from BL1PR13CA0270.namprd13.prod.outlook.com (2603:10b6:208:2ba::35) by DS0PR12MB9273.namprd12.prod.outlook.com (2603:10b6:8:193::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:00 +0000 Received: from BL6PEPF0001AB73.namprd02.prod.outlook.com (2603:10b6:208:2ba:cafe::27) by BL1PR13CA0270.outlook.office365.com (2603:10b6:208:2ba::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.22 via Frontend Transport; Mon, 8 Jul 2024 12:02:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL6PEPF0001AB73.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:01:59 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:39 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:39 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:35 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:34 +0300 Subject: [PATCH vhost v3 10/24] vdpa/mlx5: Add support for modifying the virtio_version VQ field Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-10-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB73:EE_|DS0PR12MB9273:EE_ X-MS-Office365-Filtering-Correlation-Id: b4a759f1-a5f5-4a46-00a7-08dc9f45c5e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WJ8YhcgneBVrATEbjrxT5k5ogiQAtgp?= =?utf-8?q?EJAO677QOGl8ewXI9SqjinpudsZJaK43cLJooSWqidvL9K2RmwjrIZZJkqs3iIh1b?= =?utf-8?q?DNKzeZwwmMjltX/8cWHxkNm072+C6t4UWx4GXotC+QIfZnXNoEqCR7772EeblhoKl?= =?utf-8?q?B1Qxekz/8TWQdmAXiuny2EsAxlBM6KtQ8yIa5eM+oXZbRoY4tJfs158t0yFS8oWg6?= =?utf-8?q?TPhr3IquyN0owvb4Hp8ukbTPPAlFY6naGm2zehxr5v2RuI1+SGm5smW5LXQe9yjrs?= =?utf-8?q?z4YK9QIiomG48mvJb4RyOZKben5pbTN7CBtnOqEQlzj+ReiSycE2pUCngeigDOc8A?= =?utf-8?q?JqAdDKfHO8tZ9Ej7mlzN88KLbAMTJHJdcuuEyN5nKoYUchJiDB83/JK3jR6ahN76p?= =?utf-8?q?y6up7xjXX3m02GA04NeIxlVbNIVUa6Vj9DUehZ0pmXafY87uZM6lGidIjPwBQJt21?= =?utf-8?q?4iQyrCuXW9VoEOmNFjcscZuK8HipwdRKVDqPJVR5/d0fIvaAVVVDWrG9tWzlxTdUZ?= =?utf-8?q?0quDjeCjnmG+/Lf79ewJBAHWZDtKEZaJ6PiYvNv4mbP5NphEPi+/mr13pFcxKMOkQ?= =?utf-8?q?ian0Rg3i0q02FA+P0NBduvW3KSKb/0uxcBT481tEh2c0DZoAzq/Kh2YpfcE++ZYM+?= =?utf-8?q?Kz44nZlmCzfmpSBSZFqDYLxPLOe7OdcaLSwEvhUrinTQcWezy+MYFp8u/M+SuNAUX?= =?utf-8?q?8DoweZnfS8HkHAAEay7COQMi9J2sda8rl07vUBORCXG1PC2o707syyoa0UpUyghne?= =?utf-8?q?tPwfk3QH7OK+knfitmBeqf9GHrprKOFCe8JxL55AmQTTJfY5L59Mm+CRUzg70tlHi?= =?utf-8?q?smEzOvIuKPiVNq0QXATwIdh1Pn2gVkCrNFDe9N+Z+u6iJ8P41MeTUJBDy0xWjKHd1?= =?utf-8?q?2m+AH1GmgK7nQ8/7QtaDg9Xve0pFeMZaFOPySqPXEVkAiN0rDO064GYVqnFCdcB8k?= =?utf-8?q?dXHj1spLL8NmLfYkGRYWDwU4CoLVAiZ6+B6ig/t9kRXkxHSTTFgivJwN6lOWtUmdk?= =?utf-8?q?8de56ZPhBnNZp6k0gcAH2s8lmv9n8jQRNfx4/nX5MuoIdN+w7nWw83MbReyBE10Bj?= =?utf-8?q?OhTesVV/buaZXKLaVl0TP+jTgGJit3HUD8GT/n3hsuIz7fHOCQLLS8tPL4h/q1mVW?= =?utf-8?q?xcgoi8D8GkI+cAibmX0KquN+fbPFDBvIMbyMjYRoyasEiaxLIYCO/2GVZHZPSYUHe?= =?utf-8?q?nz12ttRXlpS8uGn0zdQXe+/zJzliHKJV9OWmso84gTm26nFVStl5aO979DvTyoUxX?= =?utf-8?q?8KoY4ZrJDacxXDIWRe+YHMpEKprDA4m7Y6+t1rtsTAp2g5hYpwwZQA2DdY+gG7VEL?= =?utf-8?q?G5XdhYYYz/WBeB8BHP36QY2BIRW4sAqrIw74MFXuTk5SXeN/DooR8zzZH/EeyCFCS?= =?utf-8?q?vXI3n0G01tp?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(7416014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:01:59.9244 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4a759f1-a5f5-4a46-00a7-08dc9f45c5e0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB73.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9273 This is done in preparation for the pre-creation of hardware virtqueues at device add time. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 16 ++++++++++++++++ include/linux/mlx5/mlx5_ifc_vdpa.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 739c2886fc33..b104849f8477 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1283,6 +1283,10 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX) MLX5_SET(virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx); + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION) + MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, + !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY) { vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; @@ -2709,6 +2713,7 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + u64 old_features = mvdev->actual_features; int err; print_features(mvdev, features, true); @@ -2723,6 +2728,17 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) else ndev->rqt_size = 1; + /* Interested in changes of vq features only. */ + if (get_features(old_features) != get_features(mvdev->actual_features)) { + for (int i = 0; i < mvdev->max_vqs; ++i) { + struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i]; + + mvq->modified_fields |= ( + MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION + ); + } + } + update_cvq_info(mvdev); return err; } diff --git a/include/linux/mlx5/mlx5_ifc_vdpa.h b/include/linux/mlx5/mlx5_ifc_vdpa.h index 40371c916cf9..34f27c01cec9 100644 --- a/include/linux/mlx5/mlx5_ifc_vdpa.h +++ b/include/linux/mlx5/mlx5_ifc_vdpa.h @@ -148,6 +148,7 @@ enum { MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS = (u64)1 << 6, MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX = (u64)1 << 7, MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX = (u64)1 << 8, + MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION = (u64)1 << 10, MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY = (u64)1 << 11, MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14, }; From patchwork Mon Jul 8 12:00:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726488 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2049.outbound.protection.outlook.com [40.107.100.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64E4213B7BE; Mon, 8 Jul 2024 12:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440129; cv=fail; b=JCFci6EzmratMaDe6bqXHTNmrjhDQyFaM7rGXgSFGuXrbFVKt66OjL6yYalNLqVwbiTO5ZDvBX86v+wDGv/U43BZKC78lOnCsL2MpqAKKsafn45GJWZMOQXxZn5biilDKcuvSHUODFgKQS7EtHNr0yIEdGNZOeA8T+cOanpsixY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440129; c=relaxed/simple; bh=OjyUVB+4r/eFu1fEK8AH6Azs1GAI2v2fms+1IuH27sQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=C2OeJ1b/PZ6NqH3O1YNFIEzrbsc4hj517tJalZslGXJIrmpAXkhTcqyP8EsZLtM0/tWVZa8maVB9LB5uxr+geaJrQRNnJvEb1e38pMCJbwJjgTQSj0mpnu8uSnWR7Y8Hbt0S0WKyq/2RsnmkPt6fwfMKBCpjEjqG4VGPSGHbUYU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=E7uwB9AV; arc=fail smtp.client-ip=40.107.100.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="E7uwB9AV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XjFlF8N7zTdUaxk29Znfsrr3lXKY1EWIHf4ZOZE5ULe4JVZ1ZutRdz14DUlbWnDaRBArxNoHRhtXmsKRUrd8qVBXdoJL/ej3IobV16CrflCAo5RVVJzsPpvXR5QjXccFLoGS8q4Dk6t5EVFIDPUMim7cV1hMlsLeAW4+9FYetVS8cW5knHu2gmZtwZ52TDgrYO6oatGTWAKKpM49t2uYV91huZ91F9LfY/DoT/NiamJYUr5drzyrGS9S4OXvbwblWZdbYH3UfLFveSUdPJ2mLCqq5sCyE20LpH8vCZqunkomMWQJ36Zek7yObGzDD2o1bfIoT0Vq0CFP9byxeJYs5A== 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=a2+GDdoDDIsW2WxhTMKEG5z+UCDDh3rRjrNbH6PaeTY=; b=klS/qmdGIaZk3o21bBy+Kf83Mzv6af9rGm4juiEDAgM1IIge+vCwFOqGEMex0NYzDRI5hp0KgprgYYeQv6vPcQGzXGxUPNnvJGnUpZZJcWfJfpBlQZRiGDU5hjgydJhHT2nz2xDtBg0n+yiyh2BJ6N4hL75Hfx7KKFgYfTp2H/xC24ZJx1TP5M6bUXdX5sZuAWJlb1P4DELOrOdgVE6Lisqoemp+fPebM3hX3q+jlw59dUrGm6ibWn/qX5NNT3X8sHN8EXPxQSo+jSAsIr7pLijd42R8qY6ph0SKNmHs+WN0w8ez4qnoAu0hJ8RWMUpyILS45pScOctlnCRqIyiOVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=a2+GDdoDDIsW2WxhTMKEG5z+UCDDh3rRjrNbH6PaeTY=; b=E7uwB9AVK7pjtha5LQsmjnX3+ZGlA0Vhaa+Q+G22/kPUbgDtP8r7DRVBiVuXqvxeNpUDfnhClgLNpYoiUELPjBmDOPGeRhDaq+vThu0hACEynL9eBhiAHq+P4+hBNmzS5RKuIpigJyRIW01bBizpFEy8HfD6rRgM3S/9ben00p6Q6ud4E3ewGbMH+qtPMOsHVYnFXDYUxFtfzrYZLRB6JDBdSbriilc60i3MQ+wU1ahAeFrpq5Yj2ItAiJ7mH9OPTKpCLTFxRoPjQs0Dw3AF2gqrgfz508iaCuWUoA1W8Z7tTjaCbYHSn07Msl/RXbr/Jw1PJ5bL95MpSvz9MJG6rA== Received: from BL1PR13CA0258.namprd13.prod.outlook.com (2603:10b6:208:2ba::23) by BL3PR12MB6547.namprd12.prod.outlook.com (2603:10b6:208:38e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:03 +0000 Received: from BL6PEPF0001AB73.namprd02.prod.outlook.com (2603:10b6:208:2ba:cafe::1e) by BL1PR13CA0258.outlook.office365.com (2603:10b6:208:2ba::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.18 via Frontend Transport; Mon, 8 Jul 2024 12:02:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL6PEPF0001AB73.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:02 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:43 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:43 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:39 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:35 +0300 Subject: [PATCH vhost v3 11/24] vdpa/mlx5: Add support for modifying the VQ features field Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-11-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB73:EE_|BL3PR12MB6547:EE_ X-MS-Office365-Filtering-Correlation-Id: fd9e7f7b-2181-4ed9-b1c3-08dc9f45c7b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|7416014|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?rb0pc7A8D6vGaSFg+7obALytJWqQfHY?= =?utf-8?q?Oitq6NVtJMpt4MDOmnudpVSibNel77NFw1fQTuKzSA5Mc6MNaAdswmN5hKMNj+h58?= =?utf-8?q?kRLhrn/AnSweSYFDWd7KrL3DReEb5isNH74zQx6fZguiTAliKR7ozSmQYaGoG1TR7?= =?utf-8?q?B28o/Jzq67xkv4ybmfH2ljiZZlpxJ1nDPN3CvXqVEu8t96CI0bfELa0s2YOYyhJQx?= =?utf-8?q?H3OrRlz8JKt68Y2TO/t3M5o+awp07oOIOovWsPT27M4E83XSJPcokbEY4ylU0PeZR?= =?utf-8?q?Eh7Tu5bM9/ivHtZHd849CYTUxuesSVrqDS3gMVlL0dKxPbUd1tnI9r4TkTG9dOjG9?= =?utf-8?q?DWESUVS7DVZGLOVM+zrfOKYMAh802y1YygqMpmxIbtEbUFqWV6eRfFL+60c4wN2Pb?= =?utf-8?q?kp2Nh398e4y7Q4hi1cb9wvQYmdPSLuZILQn47APPZb2ry/RmtGfcdP1PRjTV7Ia5F?= =?utf-8?q?xPU0qlsqfNL21T7FXt+SL2jXK2RGebdyrtHqIFX6U+1Z9aVBuqs3KEeq50PL57bRv?= =?utf-8?q?INS/06UcN24b6xrFvMfAqeA5cdoWwEv/IByviNsjZBVF+j1Quxu1qqH7AD1sznVWb?= =?utf-8?q?5wwO6J3VWWu8J8+nu4u+kjDAmvhlNpEMicWp7eX9xhEgg7g5lAT0dtK92mlrBRtD7?= =?utf-8?q?U2Jr6shnzJzBXOsnmWrBwIkLqWgw4QHCwSUAMR/fjW5YpNKRlh9/P6STH8wJRobz2?= =?utf-8?q?DgLvXkufKNhiyMs7tV0xF0TU/7R1CrH6EvG3r+nKM2u49bFsMT6fjciJWIYaV81Ro?= =?utf-8?q?5d51us/tc+JIJWChZ6cx6kterIoUnJQPeHAAxJpWUJxfqRqto5wOLtMMjAJVRmQpN?= =?utf-8?q?ZktfCMPgo128BfAy4xIls7UAfLM+4+6VBt3I2Rd2LlAxVGHc7DPfrzC6u9DEuwjEF?= =?utf-8?q?OuQ9/7UIR568rsT3RW2oePT7AkeDGAiigX7DbpKsqUbqQB85ak5erTkeU2KPctqcJ?= =?utf-8?q?VJ8Fq0Npd9+VRTqTboZL4wLjEiW7m0OKGL03x1S68IISYNp7GRMiYALs84/M6ZteV?= =?utf-8?q?lpXRHaaV2z0dt5MTEE7jXb1AvyNLBRB3/Ui0nkLEA8+AHYS8fXBLHvVbLIMsbD4kU?= =?utf-8?q?gBZYttoA5+QS07WebZgopsPgbCfqmIY0iU1W5gghTrq3lNSHmat02QnYuAxUS4RTI?= =?utf-8?q?Jr5+1Bwh4lzC6InE2FMErTuv0m3RMyQaFt2LPy7ta9Ky3/al+PDWvcb5mPgxoiyqA?= =?utf-8?q?tnYGvsfyKUdWAhr66drGzZH2AYMAdLETA8mLmPPryueK3zzV2ISiBnhvjLU8ZSMix?= =?utf-8?q?FV2zLGYXEV3Zgmigq8QNmlmL6UmrQkpkve0f3pk1o8dGO92AVycgQcuhXiCqRdGii?= =?utf-8?q?N0yylcN5ubh2jSMqRYW9TZYRybmEXnHmZRrjdFacHWIShCUojsO0ftcqWPSMKfmJ3?= =?utf-8?q?aDL1dAH+YQQ?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(7416014)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:02.9869 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd9e7f7b-2181-4ed9-b1c3-08dc9f45c7b5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB73.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6547 This is done in preparation for the pre-creation of hardware virtqueues at device add time. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 +++++++++++- include/linux/mlx5/mlx5_ifc_vdpa.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index b104849f8477..db86e541b788 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1287,6 +1287,15 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES) { + u16 mlx_features = get_features(ndev->mvdev.actual_features); + + MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_12_3, + mlx_features >> 3); + MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_2_0, + mlx_features & 7); + } + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY) { vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; @@ -2734,7 +2743,8 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i]; mvq->modified_fields |= ( - MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION + MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION | + MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES ); } } diff --git a/include/linux/mlx5/mlx5_ifc_vdpa.h b/include/linux/mlx5/mlx5_ifc_vdpa.h index 34f27c01cec9..58dfa2ee7c83 100644 --- a/include/linux/mlx5/mlx5_ifc_vdpa.h +++ b/include/linux/mlx5/mlx5_ifc_vdpa.h @@ -150,6 +150,7 @@ enum { MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX = (u64)1 << 8, MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION = (u64)1 << 10, MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY = (u64)1 << 11, + MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES = (u64)1 << 12, MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14, }; From patchwork Mon Jul 8 12:00:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726493 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2072.outbound.protection.outlook.com [40.107.95.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD43E823DF; Mon, 8 Jul 2024 12:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440153; cv=fail; b=lA+aVaJl4O3Nk53ONohTpSWLOZ1AMn1lJSf9unpBAKJ15DKO9cASERGhx9sDZUKZdKKkbESLJwP+xdHEhdYsbrCOPBB5mnvrnedgHYLm7H5+L69gp2/T2enJQRAP72iSp9j1r5Uwugo83LfbBojBkf/Zwgbk1P4cYpgokdLxurk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440153; c=relaxed/simple; bh=LIkAqiXldR1JJu4c3worPdJiI6If5bbvP3LoaKyTXPY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=p7U5CoCtCr1x+Sw4Ug/vOp6oub+lWs3aWUAuxR/OBMpv/HP2IgTb2cpYJbkdRqWhp0xYxxRqLAsDVOBYILcMx/VXeJlKupjNT7/5hgOpA8LpgvaABXHkpoJS+13jvHPW02PT2tyg+xyIctRo8ChzaxvIdX3FAWuWFUgbw95US5w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=baZ2m+ki; arc=fail smtp.client-ip=40.107.95.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="baZ2m+ki" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BkArWJxivfIhfKhUclDYbtNIOD6UjLQvSfyeITZSR9rBkSLDlMw4jjKE4VoU159dGXm+6rIy/uax2W75TgoISxuqBLDGhmvPiptQVs5/wrcZ3oz3atwnbi2unKkaDMLATo/iKqwkvEw9aasPOWql6WxpZy4xHgd8ZYKmxQfTq5ivzJf9mz6cuDpi+1EB41PKUIWNu9n4CbCso6upunOehRZS24fmx3aTLbvtB/4FReKc84S5Ce5i77xKpPJa/aSuqWvt0Jkeb53V/ZHHOce9tpdKCnsphztmCCp9vA2GDD4Tnn05N18Th1gFDob9q3/7keFxv5rNxMQ2WjBtpLB8zQ== 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=AtyvVBYdcxD9Rj/nFWt7i6rnQILL/qRJ0iRZbPyhNEA=; b=EAhRZrWLUi+56yqlZqNUdnY2QGc7OXXZxxPAwLhGIOZO09NpkJEggJQuajxuZEmqG7ViHYPJYgI8rtRXpPJ1udTY2NJFM4cFMD3WKdObwP1LbvkimbufRJ5WI4RtN6EHljhm7IpIF6ht7JWGYRoRxEg2i5V8tMaAPOItCbylg9gvzxdFuOAXOZz7pz4THg1AkmWCcwebbBx9vOIe83AvdiTpxrQU2sPCZs6Xn5UNN3r/Bsx/KIez1AhfKYaJ7xyiQNpCz4BHVw9AffksJjKcFFwmzPo49Pe5gl5cnt0lwYIo1GMvzwcxe77NyqJROz8J2wVYBvwRuMLo+NHqoLWrzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=AtyvVBYdcxD9Rj/nFWt7i6rnQILL/qRJ0iRZbPyhNEA=; b=baZ2m+kiTpJ+ZC+A1LlrFKsJli7pYes3qSsoqmeuCw2SIhJzB5raWHPah9K8w4Xwk1Wl5s3Y0qYpUsgZzvIQLqsBJlpysdVOssLi2ArGNxWlEleiChQvx0p3ppQW/RBuLx9uSuz2HML7FCvtpij+U/ZjjkXHIYPk8Sm/OFXl4BKacD8kh+5bKRJ27En+huLhLUX5piVjJVFaTFAb7kFwWPBhhk+k0P+uXPnZBRXey3POTQKVzNHLrLM4uh6QM2Sa6xJRfXS2ZJFmlvRfmrm0ABKWoJFx5Kz+QPgmHoB4kaFmj9UaBxhIryl9o4MwFjXybRUSBnGSbljyCLgTMsKqgA== Received: from BLAPR03CA0024.namprd03.prod.outlook.com (2603:10b6:208:32b::29) by PH7PR12MB5595.namprd12.prod.outlook.com (2603:10b6:510:135::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:26 +0000 Received: from BL6PEPF00020E63.namprd04.prod.outlook.com (2603:10b6:208:32b:cafe::56) by BLAPR03CA0024.outlook.office365.com (2603:10b6:208:32b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 12:02:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E63.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:47 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:47 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:43 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:36 +0300 Subject: [PATCH vhost v3 12/24] vdpa/mlx5: Set an initial size on the VQ Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-12-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E63:EE_|PH7PR12MB5595:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cfe4bba-6b39-442e-ec5b-08dc9f45d529 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/zBaZOlu/ITr1lszvDDemqhEIRWoZV8?= =?utf-8?q?WS+Dt1EDGzRR7BTpmtqD1lXLdtiDYSXxRyz3Egiglxh0AfMT4ICEg6XYtRmAh+wvC?= =?utf-8?q?JOyG86PYDZALN7cGdNiKKAEJ5lE40uxBzDmnHddzrywrFAgi7ETDVzpOtzI5Tqqbv?= =?utf-8?q?00V4zfHw8xleUDRdMBtyFjZKSwk9JvapAIjp36+ZO5RO2eIFeJwLrjHz0Sq/x5oaq?= =?utf-8?q?eJ3P/ZzhPX6ghfRAZO8lQLQnkCttz7Pe7ZX1ut7Ah3fI6EUBE+BZ4M+Ib+/5WR+d9?= =?utf-8?q?h8g9sFK7T8/BuYnZ8H/wux52FMykj60UnnRfw3QPpN6XE4TMkOV1UMyjDzTBXuvWm?= =?utf-8?q?EY4Pvo49unK9pborf3nXsTnYhihs2tkI6YONIEZiWl2JKdBMKBu3UyYLPbRqw9V4d?= =?utf-8?q?9w+LepJ+n5g/X6VsKixzyGFDeKqE0WX0PKCSeh1iMo9vKuu3N31hn2RyQIlwy4Wer?= =?utf-8?q?q7iHo77z/6xdBabChUz0sn9U/+P7T5VNemgpIggiAKQAzQZFY2JXrcBLQ2VLyRnw3?= =?utf-8?q?STC2OTtfVqBkUZ+z/AZaBGpK+UgbPhrrpJxsC1esxdsQNgDHY8GRkji+eDtxz+xeS?= =?utf-8?q?wnlAMFR6nXYWKWrg55rH+c9NdCq5XhUhd9arBRkU80Zik0zbPzTAt5RDz3WoOj4ql?= =?utf-8?q?8W4JV5/Wh8Wj0q6pcBo6ML4u2C4cX2+0a4uX07TyV1wEknaxs9TE6tZoYGBVNZ2ze?= =?utf-8?q?4kSo6OfSErNiA4EhLs65SEvkb3o/Vkc3wrY8FkX28jfzpjRlmre/6eRCDOWqG5hpK?= =?utf-8?q?P5nyu+5buobYrTzV2Pb3iz1dFl6kGvgRxgsI+U15lGMIrlG0OEw0Dv0XoT8e4nosv?= =?utf-8?q?aQXnSmSzn9jtrYgikGh6Q74rF/lxcchFfHe78oz7++H07nbR80PJwNph8Z0heo9xp?= =?utf-8?q?IhIqKNjonfpdQCRKOEZj9tZ2+wiJwFwspn1wROZPVrBqPJogMaWEjb4PeGbWvH3tm?= =?utf-8?q?vwm1D7+r/cjxmp4Sprwm4rmj8JYGg6gIfXePhc6YDc55/L6UZXrZuZzns1pSl7mcn?= =?utf-8?q?4cfSInFnufeB0wNNgQyW2IdQJhenb+4dZ3z7R4JIsRyBWEYvhDbqzWFMg3Sic7EGj?= =?utf-8?q?dwz95j8b3MbjytZxu+19RoGh0Objc+3wxiYP4ekiXAlmYkFhqkx1TVyy1JROaPEcI?= =?utf-8?q?Xk9r4jNGZaOoCHO+PONTvdoTF9Z7P8bGweqjkP7aA0E3v2xwpQcYLcGXfJ2nx/heM?= =?utf-8?q?J4nwR+D0PiRh0MeEII8X4fEJPWRM25711net+Ai2fUcOtLtFDso8UFPF3nHbEzHsS?= =?utf-8?q?ISc/B86N14k4o+fR79k9Q2pMaAa9D+RCJ3VTqMmdWX/7cRoiV/Ba/xrjMbsxES/4s?= =?utf-8?q?aeewebK1ikcuMwsXHnPVlZjNXRTWNfsLbA2WhmtErKEo/rmAtxQGZVyNEHkNWRGFz?= =?utf-8?q?DXkfR1N876R?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:25.5747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9cfe4bba-6b39-442e-ec5b-08dc9f45d529 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5595 The virtqueue size is a pre-requisite for setting up any virtqueue resources. For the upcoming optimization of creating virtqueues at device add, the virtqueue size has to be configured. The queue size check in setup_vq() will always be false. So remove it. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index db86e541b788..406cc590fe42 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -58,6 +58,8 @@ MODULE_LICENSE("Dual BSD/GPL"); */ #define MLX5V_DEFAULT_VQ_COUNT 2 +#define MLX5V_DEFAULT_VQ_SIZE 256 + struct mlx5_vdpa_cq_buf { struct mlx5_frag_buf_ctrl fbc; struct mlx5_frag_buf frag_buf; @@ -1445,9 +1447,6 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) u16 idx = mvq->index; int err; - if (!mvq->num_ent) - return 0; - if (mvq->initialized) return 0; @@ -3523,6 +3522,7 @@ static void mvqs_set_defaults(struct mlx5_vdpa_net *ndev) mvq->ndev = ndev; mvq->fwqp.fw = true; mvq->fw_state = MLX5_VIRTIO_NET_Q_OBJECT_NONE; + mvq->num_ent = MLX5V_DEFAULT_VQ_SIZE; } } From patchwork Mon Jul 8 12:00:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726494 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2050.outbound.protection.outlook.com [40.107.223.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4A178249E; Mon, 8 Jul 2024 12:02:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440158; cv=fail; b=h1i+L95Ozd7f2g06jqKbBrk+qh5z5iqyFbGgXHnLPvVgvcwHBY7KHyGsKYbdVkaJCLefeVL0t+BXIa/rpQgp/KWVNqDRgVI8nMKQb8fjgLvtoiM6LVx055bY124FwWeChMSSRmaGjE520bFcz7Cu9bosGdcnsrYwXeWa2JPFB4M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440158; c=relaxed/simple; bh=uctDG5PQZrDUwp08ZBTd2qutlOZ9mskZpLh4FSJYwZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=VlKTTyIrmZFK1fS6e7jcxGB9QMQVplPlJMXT6AEH9l/g2Nb4WZcdVMM/CXEo2un0lfhv8iXnnhNn9WoiXRo5Y2SFYNGA3sVZlEaRPpnl0j/M/gjQ74YIXmShJRdla1Qz/3bVV1ItexYcF0YLXJj2+jfPtmK0p2xTNJ9J4fvhiiE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=svltZ2Sz; arc=fail smtp.client-ip=40.107.223.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="svltZ2Sz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fRfwXdE6TP9BA/9KOHPAUcyD/et7koelELdNp5hqmSd3GuOEyPk5IW5HXk/pIEBE0KNvVTn5a7cf6IkZmeB4JBTC6J709MWfR0uCtD8g+MxPDC9RauQejgQZYI4quz6FSL4ADJXYXciWw6GvyFjmLyf0vRLyrEJIltiWZ8zGvquK88w6BNYcE40+TANuGpMG0BfdsBMphYd8KyuzAZ3LlbDjlrW8qujxWw7pnO8mv1uyY7lLGXe6ugdYKMyCA9mkV9G6LI1s4rXVn4R4JUlxNPzOZpeIWKWkSEv10JDHwY6uAx2tgqnA2ntMyoXcQ+UNDBPynmBQNsE4PeuSrTCn7A== 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=tOzLcIPJYtRp1TBm3A15bBVrHGfH8AiO7M5YDX63Uqs=; b=BS+JPCCnhujIacJbieWCBYYDFb6Du2veqKODAcCrP07+mN1BT3Fs59Q9Cv3U2w38zpW6EMq+9mgf3KZTmQwp+VbubRQ6PaTsKVW4tqlQCDxwcwNBfmNr6ovgkhDXAaK3vbzGrV1nXeKraUSgI24wDtloyew7Y3Mo9eATJLrCa5PL+YInkTa/MZk7qTT/PIoJvxjiOPWYsIUBkzmVoU58yyuuECiKeDGodWhNLicwqlufSqquZpp3lkTsEi6gmch0EIKvlC8E/cWfqafFtueKuoAVJbvhf0MeGaXUXMdYTZpgx49XhhozIkXryfQxba4EHW9S8GE+ApokQEUxE4ZgNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=tOzLcIPJYtRp1TBm3A15bBVrHGfH8AiO7M5YDX63Uqs=; b=svltZ2SzWI0Z9LPo+1fRMri1cfe/KsucGOkkEDtxizIInCgN7fYu3iV5sc6jy+dRMKamlipMv/EpuDqGrxeksNCzYaGfZideWXD90YXF769wUfRJ0rp/j5D1QKdTiEwpY2rc1zrmsaTx4CuZm/Lm4tVqPGDhyt6/n2pv/nTYwtR/pjAqp+NpBnkrWyQuC6y4Uf3gPvbj1VR3Hh0yF9ul6fmL5F54Xqgzotj5XnRfCXRVWJ3RvibAeQm968YQQMfTWXVFZMrbfg8qKKzfxmVSIP86FR1dhfSsvxYOqCbpyvGR/XVWWLBjLO2MXAjAbAUDju5Mcy3Aa7VCTDWISPHG1w== Received: from BL0PR0102CA0014.prod.exchangelabs.com (2603:10b6:207:18::27) by MW4PR12MB6753.namprd12.prod.outlook.com (2603:10b6:303:1ec::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.30; Mon, 8 Jul 2024 12:02:29 +0000 Received: from BL6PEPF00020E5F.namprd04.prod.outlook.com (2603:10b6:207:18:cafe::cd) by BL0PR0102CA0014.outlook.office365.com (2603:10b6:207:18::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 12:02:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E5F.mail.protection.outlook.com (10.167.249.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:29 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:51 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:51 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:47 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:37 +0300 Subject: [PATCH vhost v3 13/24] vdpa/mlx5: Start off rqt_size with max VQPs Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-13-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E5F:EE_|MW4PR12MB6753:EE_ X-MS-Office365-Filtering-Correlation-Id: 8752057b-a185-4cdf-d55a-08dc9f45d739 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|7416014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?DnMdG7UnKVjfJvJkW7x3G0+9MWRGY2C?= =?utf-8?q?rlIRSQsIO1VRpq6mwTaGKxtvTmkV9lXbTNFBmSKa7SlqFmOab1FOPLG+ceACotTRC?= =?utf-8?q?EL4qaA5FWMPbnfKnOJAUbEkriQRMzA+NSmDZECzEt3wtTVFZbbPbSDNTpu9br4xCH?= =?utf-8?q?2HYjoqSj12UEsqhWLqdk/qz1IjEu7zp5U9CpNkzbtMDJV232sE71ptRb4EUvS8b25?= =?utf-8?q?EwbpjCtlWYquw1LmIzlpiqEd0Iyt/5liNmWf2To181HArwG15q/u3ZWH58MVGcwJa?= =?utf-8?q?Lw7ORw8NrKARArOEYnzJ1lVfhceShKTusdlzwtMrzW/VoH+YndI321/cZuWlwVfAe?= =?utf-8?q?zegB7YOHhgPxbpyYx0Du8EorU9p4FGBN7e4q/olqvbbQWJB6NvQBlK5H0t/8WxuwL?= =?utf-8?q?ICktZq78xl7yuxtkV+QJhXq88bb/g0lZxHqBVvLdflWHQv9y3uYUOwbBwJiAGJ7tE?= =?utf-8?q?GwfOidO0bDOjZ8jWht7glEB1IUyOXve/zyK+xLYcig/EPiTIz1qvXTP7UQCmEw/q+?= =?utf-8?q?X9O95ZGiVify8GlZYIxAJ7UJqcMkslOBCbFEvDFT+ZXHTjJG/IC4kfCoObRXXOXOZ?= =?utf-8?q?82MGuiGtmGM66m1SRQmOnF+yz5jNlPI1gl3VoPm3U8G9syLSxH+ntwE95jQ1Y1u3o?= =?utf-8?q?5McuAaUB37Fg4HwN/jXRbWleAtlqhMpFKyVtddrmtngBwSxLkVxbSr7W4c6q+X/0e?= =?utf-8?q?hw/maF6DCgldIlcBq55VeF9mmfQ/qyYS6OCa3t04yQUJss7j3gY7+pdOVkQp2mcVR?= =?utf-8?q?Yib44FTKzGUX2BTplu9CJPQbSiddbJsMeI8vGtGIcIdEKY/tjcB5YfjgiJK5IC/PY?= =?utf-8?q?eLh78fJBYqeGYv0WPAATodm3j/86dwxBwFkTjc2Pl0/K+k8EZNTV+qZQLXK1Sd0+r?= =?utf-8?q?JWW12XPFKW/+TB3RSmsn4mPFDu4ycUvrSUy+MM6AAQgmb7HjvW1/kEt8wQ43Zvg7H?= =?utf-8?q?DfdJIvkt3QK9rVJD12VO+9Fg8685PkcXbqXx5Iz949BxzQ6WfQeR+/sFYRiMRPBbF?= =?utf-8?q?kRsAnnts1/6XRuD89WoKifzVcBszRnGAwVEdt91XMj6YntV8SAhiq3LR5iwPLoq6o?= =?utf-8?q?t1M+YK0ylqkVxZoOhEwu0KVHxQ4HwuMmoxHQs84psVQ2RY05PEA7ZqGxXtGE8cB9E?= =?utf-8?q?JA7GIgGYW4gDGLsFnMTdEf0MIdUyXWYoNN5gF4ZVWa3R2AFzjTOKgO00wCH4QUMPb?= =?utf-8?q?BWyQu2qpqc6XDBkPp5+40+7f0+/Igk338KFSmQDbUfK1hsv81Bs0czCZaMWLe6pxR?= =?utf-8?q?23yNLJWz6PT9mdsi4xm0KYOQic8vkv9BHl2u8rbnZlYrT19I6a4m+Fk/SvEn1GPF+?= =?utf-8?q?BuFbKQGZrbh+l/1mZqLYH/ygn/bDEnBXv/tscRoxLoSHm9sR7d9GqboQyuSBjIlnZ?= =?utf-8?q?4arRw7sj3F3?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(82310400026)(7416014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:29.0187 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8752057b-a185-4cdf-d55a-08dc9f45d739 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E5F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6753 Currently rqt_size is initialized during device flag configuration. That's because it is the earliest moment when device knows if MQ (multi queue) is on or off. Shift this configuration earlier to device creation time. This implies that non-MQ devices will have a larger RQT size. But the configuration will still be correct. This is done in preparation for the pre-creation of hardware virtqueues at device add time. When that change will be added, RQT will be created at device creation time so it needs to be initialized to its max size. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 406cc590fe42..7f1551aa1f78 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2731,10 +2731,6 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) return err; ndev->mvdev.actual_features = features & ndev->mvdev.mlx_features; - if (ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_MQ)) - ndev->rqt_size = mlx5vdpa16_to_cpu(mvdev, ndev->config.max_virtqueue_pairs); - else - ndev->rqt_size = 1; /* Interested in changes of vq features only. */ if (get_features(old_features) != get_features(mvdev->actual_features)) { @@ -3718,8 +3714,12 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, goto err_alloc; } - if (device_features & BIT_ULL(VIRTIO_NET_F_MQ)) + if (device_features & BIT_ULL(VIRTIO_NET_F_MQ)) { config->max_virtqueue_pairs = cpu_to_mlx5vdpa16(mvdev, max_vqs / 2); + ndev->rqt_size = max_vqs / 2; + } else { + ndev->rqt_size = 1; + } ndev->mvdev.mlx_features = device_features; mvdev->vdev.dma_dev = &mdev->pdev->dev; From patchwork Mon Jul 8 12:00:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726495 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2065.outbound.protection.outlook.com [40.107.94.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D5CE145FED; Mon, 8 Jul 2024 12:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440160; cv=fail; b=MO78VBwsfaZjA87oT6EJdQslwZHk3vFhZbbgI9uLOOXxx5xe6X6lNdGe+qt5YthVeuvlLP93I5XCdMIrhVjnrilChGa90oVjPsQN7hceCM5A4W96hoJEFF/X0o2R1KwlBv2yyC5zIat7I/RuFixVWAfcifuMR2pufiCjO8qftww= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440160; c=relaxed/simple; bh=9yEPtm3/NyIuXmtWlfORIqO0rwjP1BCWekvMgMNYfD4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=nBkEX8ovFwdvRg2whwW16VPCszZHQLcWrMxRBYTD7ZaXoUDVbK2JqMGMoJi5gyCZ48vVcxegLymUDkQ10+n3XAEYiR+NZyviuhF7R2790YGQjxnZfsxVF75uiYzXax2ZwkWAg8ICBUcIMbmkfGk2iuaEH/Qnd5mRXM/KZW0S0Pk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=T29Q2Dku; arc=fail smtp.client-ip=40.107.94.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="T29Q2Dku" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IjF86ygD+iVoX2aiw5q+D1B1w3QqVRgU4uhStfxGCdQrkEp3PCwPve8ccB0JcuWa3ewedPBjh4g+cmh8GP1Kx2fx1oaEMwUSrO26C/etDK7zCT8sHSCSaBROczQAzM6v87F2zdxySCfXz+XeeEQFkg1AWz13mIqeHP7Nml+Io8VZrzPj00ONllwJbDxJuZlln728B6iNFWp8HRYe3aAC5Oqp8kJTmr5cdsIim18ukR3TuLuOJij3/jIy2YyjeroIbo1xorksgOtqSQgnnBokhDyQXCPcmcAO7UQDxr4OU/aq5LCkrjXrAmTHoQU0TSm0UOggm94se6Pwm8snihpfSg== 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=cHy6mp+NEGo2hOmzSrxx92RMBFLNBrleL5zl/MSu9Ng=; b=RFckwbYox2pA+LFQtsOIulfFed3MwxfIq51EBe1A/BJq7xICb7fWnn1dAI+5hpwuSG+/xlCGfTG36Z6BWCXvS9ize70VfPJnUnlngXKlDvAAjhLNxPrW8oJ4G6FhPx7thVSqMUsmbEVd2+CLQr5NBGYf/E3jqDHvcVdUMhB6scL+Okg3ckdcr2iodA0dRXgn46+cfYEhdwSf7lj5XGoSzQgHWkK5Znwele/Y/4GZqwcfYCDa47RjO0zCbJAdyihg+0d14cik9QLqV+gY1bUVkPfieBr0g6NKzd/4FDVrR5atUWeXvfQrD0qc+eCOLKh4GfuBVKl36uJt2S9wsN1XLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=cHy6mp+NEGo2hOmzSrxx92RMBFLNBrleL5zl/MSu9Ng=; b=T29Q2Dkuvrs+pPMByE/nNl0RnGqhzykCVQVaOuGxM0lryUzf9vwT4wfZ+VU57Zcg6HuVG8CSzNnokhf7ihMRyyxa6L827b9l2dmVv0j2bEZcDc/7cmH3YNdU4mBeP+nRuWXtlL8aDZk0FCF5N0pUJFpIweGb+xxgocDq28EL5n5KZKCmJAHKeLh1hDgucYvFKOUlhslLDlebp9V5Y8SSbM6HguBRCO0epuEXwCxSi7vxKWk5XKyx83rTaM4AiXIxgMu8rbDMp0Bk8mWJ2kHsdmbo0dUv3agbIUYimt8SxO4tqdxbB7tiVRUMeUZdi/QpLUf7PZ0pGR5rIWVKJRdQ8Q== Received: from MN2PR18CA0014.namprd18.prod.outlook.com (2603:10b6:208:23c::19) by PH7PR12MB6763.namprd12.prod.outlook.com (2603:10b6:510:1ad::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:34 +0000 Received: from BL6PEPF00020E65.namprd04.prod.outlook.com (2603:10b6:208:23c:cafe::53) by MN2PR18CA0014.outlook.office365.com (2603:10b6:208:23c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 12:02:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E65.mail.protection.outlook.com (10.167.249.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:32 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:55 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:55 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:51 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:38 +0300 Subject: [PATCH vhost v3 14/24] vdpa/mlx5: Set mkey modified flags on all VQs Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-14-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E65:EE_|PH7PR12MB6763:EE_ X-MS-Office365-Filtering-Correlation-Id: 12db4ed9-2573-4fa9-e467-08dc9f45d938 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?VASAaS2srA48HkZtZ8cP7rdHjqJN9Zp?= =?utf-8?q?8TytTikzV0P1YtnUowRHqV0tZ6aZX5yGyQkqO1kT7Df57gknzZP5ZDrC4GVXc4ojM?= =?utf-8?q?xWk4AnHoDr37+3N5oVM9Qp810e8qBUjsxMgFjVki932Origye1W+aHsqsDP+wrhmD?= =?utf-8?q?Zni7wH+w/EjevmSoElSkhZWd6zG02qLHbKo/vQJoscmsc9W3288uNGw8AnVbrZfDL?= =?utf-8?q?QVckb2R1gDGEFW5UPTKZuHdEf3TP9hbPl9q0zcyaS6V88zZra/FGI1Hj9FtmLzbf/?= =?utf-8?q?/vnRKOyXwLIOOADW9DPHZiPRwHjRDflUMqietOu/4MVRysvHyRDNwLh14Aj7E1hK1?= =?utf-8?q?cWmzSInG7eot6bnyLEX/4wSKBbj2yqyAp5Esrxn9Jhy/KzISJF5s+DxIKZP+0j9ET?= =?utf-8?q?o43Nm5Ddp4eyJVJVMunve/mwgpyaZE9em2mEck1RFAdWYUUK/uHwhX7WNP2lOKrqQ?= =?utf-8?q?syBp71xqAQJJUFSzBcVNNacA9NtP3yNs5N1m9viqMsVqAH29K7WnHbDFe49KXNdcd?= =?utf-8?q?ekAO26fHnb+g8fMCrZwST0596ew16Yt+7eYBT4ri8F1Tr5W44xDJ1MpFyOSXdDvjB?= =?utf-8?q?8iiDJmlhJxWlcbmnOZFAFPZ0J1LepYVCa7DmExqS8B1XDIa7fGcfF27Eo5H1IgRcG?= =?utf-8?q?FoaFMtuFNCLLtO7dq0vf8b3zGtMZgqpWCfsfVxCrY/xuYeZEnbAa50rTHzrpavQ9Y?= =?utf-8?q?Mo+CoePQ2ULShiMQjaHLezvX3y6aUU3W//TgUWYZclUpyRP5/QqzkGvfV9Aq+0lnL?= =?utf-8?q?WUByfZ7wsUJiIz3jJ/FhCRL0bkKEbi4NVv7BNAEouX3rWX5Ugqz2+0SbvhzBo9T9x?= =?utf-8?q?w9F/XxzO/We6FjJxfP2i81QRTnOqxdGY8rtWorAquDchO3bmGpyt/Qa52PLYO3f0u?= =?utf-8?q?KD2O66VDW9+fVwuP85/W0V11kdrDGAqvo9vm1K6/75zXTlg7ZJCSiUcXvBHNG/kLo?= =?utf-8?q?r7qvM+adbbOrmdaYFLzOW42zkQ8MlOnZKkde25vXtODnDUXEowzyIek/g4GpcenJH?= =?utf-8?q?YHKciecGs45VdmA60FmQJTkX/4V+lTLqQLpHzMER/feUScxxIvSDJC46WQsUhmoBA?= =?utf-8?q?keCi7hmSGryo0Jk35lgGNN0cTVOt8C97A6Wveds1WrilS/TsLn8C5bZDq2GBAd/ca?= =?utf-8?q?Uvsh7xOZLqJBEcnDkLgRExqlGBVxLQHo+7NXp3hLvLrCTI3M/DCaNKU6Lz5/NAG+V?= =?utf-8?q?WXoOmvifSUN/pyFvdk79J7l60dSDEPeUtpvn9WgWzGfIil40U2QtuNDwao1jpCkdO?= =?utf-8?q?/zPwdEj5zGQ/eDHyJaP68svqaJd9YztFQuxZn3+BjLgLr2i8NKFzT54LPyfnoI11V?= =?utf-8?q?WVObnlnDwtiPvJZRXT8urLJcOQElJ60RYk0cvvBcOiEolA8dBz19ak2HEBIXh4pAx?= =?utf-8?q?tgzRJn6EHm+?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(7416014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:32.3680 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12db4ed9-2573-4fa9-e467-08dc9f45d938 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E65.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6763 Otherwise, when virtqueues are moved from INIT to READY the latest mkey will not be set appropriately. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 7f1551aa1f78..a8ac542f30f7 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2868,7 +2868,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, mlx5_vdpa_update_mr(mvdev, new_mr, asid); - for (int i = 0; i < ndev->cur_num_vqs; i++) + for (int i = 0; i < mvdev->max_vqs; i++) ndev->vqs[i].modified_fields |= MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY | MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY; From patchwork Mon Jul 8 12:00:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726492 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2057.outbound.protection.outlook.com [40.107.237.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E23C81ACB; Mon, 8 Jul 2024 12:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440148; cv=fail; b=RiwZ0+9kVC4NfKXxLTF3oLH4q4TXocJI2vJigsmLsgfGtXxVzSHWdh4bMISHqC70/uBoDFEST0WxLKGeAkSUgr4+RIx5HEoCsLcFw8THNsfFlf5Jq+C8xFmnG4cgQ5/Nut24pGqj8xZ0EZR1zRchSDGFdlYZ9HC9SmRDIltrZho= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440148; c=relaxed/simple; bh=TwPw47efXO1B+Q3nzT6e//56UQUzyCnKn2YznnWBahM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=KcGUg7swFA9zG3Z+L8FUX38A9fgKqOPGSxjIqGWQnGLS2mAp6SC2fbTakz2r8u8sOc1OqVPwhU0Xs1F/9RhBmNzWBDg/STa2ebeW3wFcUAJgZup7qv4ZrHenY0qKxly5GHeUrxj25ZCLWjtIwSBEpM7e+Z//sRaUZxmbQUaR8dE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=U+aUWkrh; arc=fail smtp.client-ip=40.107.237.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="U+aUWkrh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V3PDOU8L32KUjmNbs3ObvUc7TLNntYYreUZsgQrlQqbLX2IP2Y3Y/dhB/tpaaYUGOdBU5V77iZTYfK5JM223Xkz3HjwHFOJlZzPrx5i6g2dneZjms6ZpxyprbTKRH7VuGouUT9MIM6Sgz+yKOPLOoaxqT+Nida9s7qndiuh17nNy/5J5V1Ujwv0vwowlDkBX1D5rsw2U7x2j7StGsVn4F8aWgnwwAl81QU8FTsos2s9hBViXSD5jyEJPFBAYGWGLB7F2boNStivIl7RUgTmyfWMWpy3b1RmdiwVT5aH6vWC0i8KNkz66h6e2ndetHLSAhix5nHPmVf7bUHJZ9XSbGw== 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=aWB+O0G5uLWJ1mMDlgSXHc++Kxn74xpH2LYJgVRT2xo=; b=ljIlKQMhmx15uHrD3Q5fytmqY5aXLgUA7F9xjuaqhobB+p2qCL/QR5jYmt4M8S5F4+5svGvebS3ozcWe825xAHScjK/94/Vhv60KVJu938wWH2DNAboH04I3v1StwMphrmXlLBLcBTc943xPDyNLThEHIv4w53AI6NRLO4VoaTRAbM9F/eCBrbvJXjc417Ktnsv/FihhRL3g+Oaap3g26W9MJlzL8j1iFzrw8F9wZSnNzThIjwVTvSs+eE6GlarQGITtJZJSHea2hGWwhF/YiVI5JvkOZ2uhcu6EE9QInA+qCbqeElmSBveuHO/7jxmFrRpnGJuVSTBTXe1zqK0Esw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=aWB+O0G5uLWJ1mMDlgSXHc++Kxn74xpH2LYJgVRT2xo=; b=U+aUWkrhf7WqzVjQ9HjOt3LcNAZBGygyKVue5sGEswwyajWBKoln0vxCjhJAeaub7uYaUw9seL3MDwpUisXXlSIoYf5aiupukUIAsfla3bPJ+znVT9MktsN2jmlwGObEjExscnflWW3TYYBZEMCSd/mMAAg0EDXSOAq4hvJf53Ba9SUBZSsDuEmLZqAqUovrvsniJ3oLmDwbC1DJM8JFwZ2X93awlqRcpoCFxKAO3dQdt9a1fh2SSBTQMYZ9kliaZEyQr58+2c0ANe6g56EPI7v+/exaR1Y1FEXbLuBKTEvKGekYoV6i6DRC3FnfHsKAxWVEB+PVyGg8psMre3djWw== Received: from BL1PR13CA0270.namprd13.prod.outlook.com (2603:10b6:208:2ba::35) by PH7PR12MB6586.namprd12.prod.outlook.com (2603:10b6:510:212::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:20 +0000 Received: from BL6PEPF0001AB73.namprd02.prod.outlook.com (2603:10b6:208:2ba:cafe::da) by BL1PR13CA0270.outlook.office365.com (2603:10b6:208:2ba::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.22 via Frontend Transport; Mon, 8 Jul 2024 12:02:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL6PEPF0001AB73.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:20 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:59 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:59 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:55 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:39 +0300 Subject: [PATCH vhost v3 15/24] vdpa/mlx5: Allow creation of blank VQs Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-15-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB73:EE_|PH7PR12MB6586:EE_ X-MS-Office365-Filtering-Correlation-Id: defc8862-54ac-4982-7bc4-08dc9f45d21a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?OOG9oE67zZb5Z678hqoiquMy5YiY5N9?= =?utf-8?q?cp1i0twG+r1ZDerPrQhyIhURMPXHcXnD4P0LO0TVFUWs8V4hO2PPoUwZ3+MdIvuOO?= =?utf-8?q?ZduKLmBfMyRuX7qeLeoJ0iuDk0VtpwyXTutcZB7t7MNXyNd7gDNzVbe7kGh9vqHNR?= =?utf-8?q?TlTNWr0DUsuC5HvtK1MtMt5eQsi/cBq+fNOMXUrA3FVGMx7IVHKPxny6mfWqXcKlb?= =?utf-8?q?RQjp6JbrzydVX75ISOOIHQbyqYZydnuFzLX89HC0f0S6slEYlCnK5Q2ma8+ENHHhI?= =?utf-8?q?a+c3Wms4E0e3da+GNKoNUFGoyBswulnfkWIo+hi97WLmHaOeUg0OpAz77jYHyDP4C?= =?utf-8?q?4WUbnhZ41XRZgvyxECj2X2dUN7fNnxB/njrlV4bEg+F4b+iKwv4r9+dy4In6iHBYM?= =?utf-8?q?os49ZOIacpDQOy0oWfrw8+FgVIJMsXq80SqJFrZhwIaH9A8eeydu5XFM5zBBm3/rQ?= =?utf-8?q?ZTzc5xtVRBZGnQ81eS1Nwa54zmTLUzyjeYm38c/5C8MDKx8aUW5dEpxsllAmYnMkc?= =?utf-8?q?NytFBaxmRPfow+H8vAdEOSBmQCq/tsdiz/NGd/ta5fSWYtziO75i4RE61pzDdtFC+?= =?utf-8?q?m2JotYcxWFIt28i9d6VPZywPuvsUaO2o7/aLkuECUGq5Nh6VXXHyjBWIMFkpE/P2C?= =?utf-8?q?k5/Lq/+P7FSzdrqOg5qrLVg2JEhj8GAchfw1GzE1fZtjmNF/Fqr3YX89JwW3VBqxj?= =?utf-8?q?JMZFMVeL2luG3sqGfHKQVZmjXjVBGBsBS2RKm3JUgthRG1LdejDbT++XQx0ZBGFdL?= =?utf-8?q?PUpnEFjZxdXHSZmOOd/U0xCkCbS/TT4XYqbJMrpoBEyyUWro+UKbiqw+6WmAWuaEe?= =?utf-8?q?VSaU/2B1mekJICWuxHXmBVzHKRGKGpGYlrx8Xtaz29PqnXOZPeQS99b0T9LbAXtDY?= =?utf-8?q?aGxjNTB2mbBiWnslPtjA2O/CG37+avV0zGZUSpraKDiYy/fJg4mvFVUTadQmnm5Dx?= =?utf-8?q?/S9aQzmWboguM/1FPGS87g8HdAjB8YpYGzdDfUiwPQz805Y8EQ+sBggpHe/d+iiOc?= =?utf-8?q?XVxWALiT9jwHdpX4b2gBd9cqzPbESLSaZBRv+bG9rT+qb/+9K3Y//2wWGZ0LPMW2O?= =?utf-8?q?taQEZN8XT5fOztp0RdDfIDiOTQvfNSv71+KqzZY3YzEP25dSKcMVwH7Q0GK8/5vic?= =?utf-8?q?J7mnKglyzTxIY05APyS/7Z7TJMwfx0hO13IUbzl105zKUxbhLGorEZZUuECTmbIXq?= =?utf-8?q?/g/ReD1erEyveL/SShwODBNwa3C/sVr59v99xBXbl6MF6SCUkgqS0ItfyzYZpmvrT?= =?utf-8?q?qspHIMKtxGz1WbxLYAhUAv67tPIVUDxyRsErJTrF9F1Xgw0ZPTrqa/bvL6QNexMad?= =?utf-8?q?pZHsh+d0k3dVyft/TknszKSWdRhhjMTFNkr1MyioicwlHnM2ipQeyRyYkc2O8j4wb?= =?utf-8?q?vF7sUdJEuHw?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(7416014)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:20.4247 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: defc8862-54ac-4982-7bc4-08dc9f45d21a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB73.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6586 Based on the filled flag, create VQs that are filled or blank. Blank VQs will be filled in later through VQ modify. Later patches will make use of this to pre-create blank VQs at vdpa device creation. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 85 +++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index a8ac542f30f7..0a62ce0b4af8 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -158,7 +158,7 @@ static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx) static void free_fixed_resources(struct mlx5_vdpa_net *ndev); static void mvqs_set_defaults(struct mlx5_vdpa_net *ndev); -static int setup_vq_resources(struct mlx5_vdpa_net *ndev); +static int setup_vq_resources(struct mlx5_vdpa_net *ndev, bool filled); static void teardown_vq_resources(struct mlx5_vdpa_net *ndev); static bool mlx5_vdpa_debug; @@ -874,13 +874,16 @@ static bool msix_mode_supported(struct mlx5_vdpa_dev *mvdev) pci_msix_can_alloc_dyn(mvdev->mdev->pdev); } -static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) +static int create_virtqueue(struct mlx5_vdpa_net *ndev, + struct mlx5_vdpa_virtqueue *mvq, + bool filled) { int inlen = MLX5_ST_SZ_BYTES(create_virtio_net_q_in); u32 out[MLX5_ST_SZ_DW(create_virtio_net_q_out)] = {}; struct mlx5_vdpa_dev *mvdev = &ndev->mvdev; struct mlx5_vdpa_mr *vq_mr; struct mlx5_vdpa_mr *vq_desc_mr; + u64 features = filled ? mvdev->actual_features : mvdev->mlx_features; void *obj_context; u16 mlx_features; void *cmd_hdr; @@ -898,7 +901,7 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque goto err_alloc; } - mlx_features = get_features(ndev->mvdev.actual_features); + mlx_features = get_features(features); cmd_hdr = MLX5_ADDR_OF(create_virtio_net_q_in, in, general_obj_in_cmd_hdr); MLX5_SET(general_obj_in_cmd_hdr, cmd_hdr, opcode, MLX5_CMD_OP_CREATE_GENERAL_OBJECT); @@ -906,8 +909,6 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque MLX5_SET(general_obj_in_cmd_hdr, cmd_hdr, uid, ndev->mvdev.res.uid); obj_context = MLX5_ADDR_OF(create_virtio_net_q_in, in, obj_context); - MLX5_SET(virtio_net_q_object, obj_context, hw_available_index, mvq->avail_idx); - MLX5_SET(virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx); MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_12_3, mlx_features >> 3); MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_2_0, @@ -929,17 +930,36 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque MLX5_SET(virtio_q, vq_ctx, queue_index, mvq->index); MLX5_SET(virtio_q, vq_ctx, queue_size, mvq->num_ent); MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, - !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); - MLX5_SET64(virtio_q, vq_ctx, desc_addr, mvq->desc_addr); - MLX5_SET64(virtio_q, vq_ctx, used_addr, mvq->device_addr); - MLX5_SET64(virtio_q, vq_ctx, available_addr, mvq->driver_addr); - vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; - if (vq_mr) - MLX5_SET(virtio_q, vq_ctx, virtio_q_mkey, vq_mr->mkey); - - vq_desc_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_DESC_GROUP]]; - if (vq_desc_mr && MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, desc_group_mkey_supported)) - MLX5_SET(virtio_q, vq_ctx, desc_group_mkey, vq_desc_mr->mkey); + !!(features & BIT_ULL(VIRTIO_F_VERSION_1))); + + if (filled) { + MLX5_SET(virtio_net_q_object, obj_context, hw_available_index, mvq->avail_idx); + MLX5_SET(virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx); + + MLX5_SET64(virtio_q, vq_ctx, desc_addr, mvq->desc_addr); + MLX5_SET64(virtio_q, vq_ctx, used_addr, mvq->device_addr); + MLX5_SET64(virtio_q, vq_ctx, available_addr, mvq->driver_addr); + + vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; + if (vq_mr) + MLX5_SET(virtio_q, vq_ctx, virtio_q_mkey, vq_mr->mkey); + + vq_desc_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_DESC_GROUP]]; + if (vq_desc_mr && + MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, desc_group_mkey_supported)) + MLX5_SET(virtio_q, vq_ctx, desc_group_mkey, vq_desc_mr->mkey); + } else { + /* If there is no mr update, make sure that the existing ones are set + * modify to ready. + */ + vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; + if (vq_mr) + mvq->modified_fields |= MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY; + + vq_desc_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_DESC_GROUP]]; + if (vq_desc_mr) + mvq->modified_fields |= MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY; + } MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id); MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size); @@ -959,12 +979,15 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque kfree(in); mvq->virtq_id = MLX5_GET(general_obj_out_cmd_hdr, out, obj_id); - mlx5_vdpa_get_mr(mvdev, vq_mr); - mvq->vq_mr = vq_mr; + if (filled) { + mlx5_vdpa_get_mr(mvdev, vq_mr); + mvq->vq_mr = vq_mr; - if (vq_desc_mr && MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, desc_group_mkey_supported)) { - mlx5_vdpa_get_mr(mvdev, vq_desc_mr); - mvq->desc_mr = vq_desc_mr; + if (vq_desc_mr && + MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, desc_group_mkey_supported)) { + mlx5_vdpa_get_mr(mvdev, vq_desc_mr); + mvq->desc_mr = vq_desc_mr; + } } return 0; @@ -1442,7 +1465,9 @@ static void dealloc_vector(struct mlx5_vdpa_net *ndev, } } -static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) +static int setup_vq(struct mlx5_vdpa_net *ndev, + struct mlx5_vdpa_virtqueue *mvq, + bool filled) { u16 idx = mvq->index; int err; @@ -1471,7 +1496,7 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) goto err_connect; alloc_vector(ndev, mvq); - err = create_virtqueue(ndev, mvq); + err = create_virtqueue(ndev, mvq, filled); if (err) goto err_vq; @@ -2062,7 +2087,7 @@ static int change_num_qps(struct mlx5_vdpa_dev *mvdev, int newqps) } else { ndev->cur_num_vqs = 2 * newqps; for (i = cur_qps * 2; i < 2 * newqps; i++) { - err = setup_vq(ndev, &ndev->vqs[i]); + err = setup_vq(ndev, &ndev->vqs[i], true); if (err) goto clean_added; } @@ -2558,14 +2583,14 @@ static int verify_driver_features(struct mlx5_vdpa_dev *mvdev, u64 features) return 0; } -static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev) +static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev, bool filled) { struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); int err; int i; for (i = 0; i < mvdev->max_vqs; i++) { - err = setup_vq(ndev, &ndev->vqs[i]); + err = setup_vq(ndev, &ndev->vqs[i], filled); if (err) goto err_vq; } @@ -2877,7 +2902,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, if (teardown) { restore_channels_info(ndev); - err = setup_vq_resources(ndev); + err = setup_vq_resources(ndev, true); if (err) return err; } @@ -2888,7 +2913,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, } /* reslock must be held for this function */ -static int setup_vq_resources(struct mlx5_vdpa_net *ndev) +static int setup_vq_resources(struct mlx5_vdpa_net *ndev, bool filled) { struct mlx5_vdpa_dev *mvdev = &ndev->mvdev; int err; @@ -2906,7 +2931,7 @@ static int setup_vq_resources(struct mlx5_vdpa_net *ndev) if (err) goto err_setup; - err = setup_virtqueues(mvdev); + err = setup_virtqueues(mvdev, filled); if (err) { mlx5_vdpa_warn(mvdev, "setup_virtqueues\n"); goto err_setup; @@ -3000,7 +3025,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); - err = setup_vq_resources(ndev); + err = setup_vq_resources(ndev, true); if (err) { mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); goto err_driver; From patchwork Mon Jul 8 12:00:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726496 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2078.outbound.protection.outlook.com [40.107.223.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 287C982890; Mon, 8 Jul 2024 12:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440168; cv=fail; b=CaHDELt0Fw31pGcDyjqLKLuWFPXF6IDFZIb7JNadysnnX+w4D60IABcxDXszmVknPxeu37JevXddsYurS3R/MKVF46EI8brs6tUB+4LuJ4OpoD6JjgY1r5Cwe4E2gLWHG5XE+qhSjKvfG0vYqEyIP1Sx0yur7NSAIPnqXvQyLAw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440168; c=relaxed/simple; bh=Jmg0lX9kI2mTutWfxJaAfBvKbIiZJH9S+WK9WdEv7ow=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=WmON0xJPmDE+uekmSlWWBTlu6eehbtMstmeJKc0RyZokVoHWNJvwiC9D1VRREUSfdzin6lSNH8TjcM8LOjzKyoqIMu1VYxsv/Ddg7YK98OzYvKUpnD7sU5aPDMu7aTOsoo5L1XCng69JFiDo7LckuDAW2Uw7drITgU4gq1PWSoI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=rXDpIksw; arc=fail smtp.client-ip=40.107.223.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="rXDpIksw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XxLdk45+UkAbwHqJ1y5m5lw69UCByxRjeDuN8VRCeVa5yLq8dLfr3f8BxfGWLfQDdgg/iK+fDi0kpGkxsSEgvpe/TQ2WZB6AduA2bKYUk7KLS/UI1Ak2SWFeNM1sou7peuXiK8LrQF2X6Q7wyh4ct2JoKVBUGrK5mMWiMM7tTOiTQaBS9jCoMQMbXsshXbeP5Uwq4CTe1YbhroJgTBxJbPY8FAgXKvgfjuZJHHKLET2nqTSsxAanmfmSTLzgB3h5rcVcsbcHi8teNr6JeLj+0qgW0XeR2jqhvjxrtJryrCMCexzh6IMmml0zEmE9rEWB11mA+PchUzaeo9fFQ8lAIg== 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=WZmrnDTDujrCA2ehSWNDSWbCBeJWkGYBl2e1QrP10lc=; b=hmbU+3IDBGVAH6xUEkk8m7ULvd8+Jcgwu4UIEfbzYw7MpcuR/KGY/2DKAmAjiuo/b8lEtcQmff0X2h5909YVdlVmyDJ6y291L08Ew1dSjXBE1bxoMckSDIVX6yQWL4nxll0vANlsIwWYUb55uLKvfWIcANzDJWQauLnxiEbEex+I/ias3eAm2Y/zbLrMW421k0P2FbXJYFeeDx7Jpsg02XqnvRRzcA+A5r4nzLgr25k2nmMMpaB3QMhQagiYEaDJZNX3q6LiY3xdLAepkJie574Bn5l1dfYqqfHdyNbzCCl/sqzq8uDAoEuAu1znnva9ZMgcsNqrGOGqdA2YNeVkvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=WZmrnDTDujrCA2ehSWNDSWbCBeJWkGYBl2e1QrP10lc=; b=rXDpIksway/CDPUQ9o+kZOqlzSZYdoOggvXgJ++T3Nr28F25dAqf/xPlXlVEl8ZHHXEcM2MhBkoi1qRvAQ4/heKHGqsiORzm7U3va5vAyiYYIbjzdBsUvZxHiEgHUguE6n3XWO43aCLS5sOFFeGDoGGaXhLZDBGnQzCKj3bqbPJde8bwzJbQHylx7LUIWUBXzMALBr9/EOFxpztBxJZ8rE6oNwfMImym8dY9NuKah+9sowkyiWPA5cWwTHjDyW2icmi6+6FzQ11copCz+Mg3m65vEPi2JA0i1LKAGhcHR+qigefR0f0+YraB6e97wclk+TeXXKYVrhtI4o1F8nQcKQ== Received: from BLAPR03CA0013.namprd03.prod.outlook.com (2603:10b6:208:32b::18) by IA0PR12MB7506.namprd12.prod.outlook.com (2603:10b6:208:442::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:40 +0000 Received: from BL6PEPF00020E63.namprd04.prod.outlook.com (2603:10b6:208:32b:cafe::13) by BLAPR03CA0013.outlook.office365.com (2603:10b6:208:32b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 12:02:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E63.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:40 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:03 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:03 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:59 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:40 +0300 Subject: [PATCH vhost v3 16/24] vdpa/mlx5: Accept Init -> Ready VQ transition in resume_vq() Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-16-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E63:EE_|IA0PR12MB7506:EE_ X-MS-Office365-Filtering-Correlation-Id: 946b0729-f28c-44fb-59e1-08dc9f45ddf9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|7416014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ZN5SFE7Qb9nWnt8Jj0eQWZ7WWJ/cXIe?= =?utf-8?q?rR1sWbhJBJTzmpPGi4ZlT5wKN0lAL4CqnT4yNjDcV8gnGunFj5GiGJJZaMgqAkJMX?= =?utf-8?q?GDF3MP8AytZusg3SFdUssb8lkBoX4IP/XWqfglG4Zq7Hb3TARW1prQ+vD4gzz73Fg?= =?utf-8?q?Zvu9cu6bimmUlF0TG+rxh3xq7WHZ83aGi/herHvXHvWa86RKtVLwSGK3jtTJP+zSq?= =?utf-8?q?5ZM2H/A49Qx0j/fqFmjqFkNjpwOfKFkw5hTbQKbe1YF7RidvdLtOOJzX9udnXRjeA?= =?utf-8?q?HxPOjL4QmsaEwqmHjLqTLFO347qaHjWW3whXOGsVhTxVcNH9cep5YklTJ7iaSX9uU?= =?utf-8?q?Im/KrQOJ8dGpDqHeAzK3o6ItsG0c8XMwvyED7DS7jtlx3tIU8fz3wzmiMG1DNvOly?= =?utf-8?q?Ibz1wWHZGvNStidwQzE8pqmsM0rgTfq1wiyyqHZlCCtZckFjmVb69bFpebPF8t0Sk?= =?utf-8?q?ttV/dTYgxt0u58fFKndC2QHRic9zv5ear12w4Xckq3Uj5SnIdrhKYMdMxK2NebQsV?= =?utf-8?q?AfxaJJ6wP7Xa44sZVjPBicyZXz82zXRjrYHpxAdehPI7+xyCb9rMkaKLx/64POLgA?= =?utf-8?q?t5iUUMgnOSM2zsrGfAR2Ifsh/2KkkYLWA4jViQpNBf0t1XkzVm33KMR3ydhHEC0EM?= =?utf-8?q?UVlghCTfQAzr6rLHYr30DbvFuStc1RfjVRw6PiyFLqfBfSNPAd2ystMkmNZiQItup?= =?utf-8?q?hvx0busLDIMgGPziNYC4nKMpgQArAnsu5xZs+koDnPPXykAfJaioAC58d8O4kjJf1?= =?utf-8?q?TjfY2NZyxUPbAU7iyBziUrlePocycn5eBe4oQoGpGmGPchap4yE5K/OxBEMb62lIh?= =?utf-8?q?MawVp2VM9vIMkYyWs6lTFzEJWkQqvYMlR0/VsWDSR2ZdPSBCfZaJMC74HJ8wv87as?= =?utf-8?q?AifYdsYe5yI4SNrkQGzuRcpY/xdw0o0cS2syuB8ExyFkAtpUxnvGgt8Irk4UBxFGV?= =?utf-8?q?ixmSvf4/xXpmGFXe5Ook4ZvFtEFkFVhxQFCmOfxONXic6gEULe8beehLpO5DMzcEI?= =?utf-8?q?kT6WYCSMydH6Ble5dG+XiWIY2UFoI3LbOqcksNpidoBdS5x7U21ec11TlBfOzRRbz?= =?utf-8?q?fqBQQrp7EoprF+8nzmgCbYOvH4hL0RG9cwZWz+MP2KRAaMny+lYhlOASy9L3r8ir0?= =?utf-8?q?exLN0JyIkHRsmLZOnKKObIbc2b8a11TJLDQ2K6BsMGcUbSuSIpNzjSCHg8cU53CTf?= =?utf-8?q?0dCULlt2eYN5zNPdYWAuTxWzX3XsyN1ZQw0KbpeeywkGQGgLAtcQCKsQfmj5AXbBQ?= =?utf-8?q?Ej60fxYBsTRuWO/rqIFOFxvPk7PexPOAS+Z8oR5bKX/LLPQxjzcnShFS522FKEGjK?= =?utf-8?q?9zS8ccyZ4fYq7JIy/NMivMFzoVmRXPa/FRAk0QduLu0+IMWiVYAEOmU3xC+bBENv6?= =?utf-8?q?GiI9o8s1E3G?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(376014)(7416014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:40.3871 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 946b0729-f28c-44fb-59e1-08dc9f45ddf9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7506 Until now resume_vq() was used only for the suspend/resume scenario. This change also allows calling resume_vq() to bring it from Init to Ready state (VQ initialization). Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 0a62ce0b4af8..adcc4d63cf83 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1557,11 +1557,31 @@ static void suspend_vqs(struct mlx5_vdpa_net *ndev) static void resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) { - if (!mvq->initialized || !is_resumable(ndev)) + if (!mvq->initialized) return; - if (mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND) + switch (mvq->fw_state) { + case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT: + /* Due to a FW quirk we need to modify the VQ fields first then change state. + * This should be fixed soon. After that, a single command can be used. + */ + if (modify_virtqueue(ndev, mvq, 0)) + mlx5_vdpa_warn(&ndev->mvdev, + "modify vq properties failed for vq %u\n", mvq->index); + break; + case MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND: + if (!is_resumable(ndev)) { + mlx5_vdpa_warn(&ndev->mvdev, "vq %d is not resumable\n", mvq->index); + return; + } + break; + case MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY: return; + default: + mlx5_vdpa_warn(&ndev->mvdev, "resume vq %u called from bad state %d\n", + mvq->index, mvq->fw_state); + return; + } if (modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY)) mlx5_vdpa_warn(&ndev->mvdev, "modify to resume failed for vq %u\n", mvq->index); From patchwork Mon Jul 8 12:00:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726497 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2053.outbound.protection.outlook.com [40.107.93.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53B67145FED; Mon, 8 Jul 2024 12:02:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440168; cv=fail; b=c9dSp1QToNMod6i7BUtm3Rm8XU08V4nPOmKIb2BUwfhXkJD1JR+1r4jay9HuV0GGirFjQgcBN4yLT1mmJOck9Dz1jeUV7Fpn3B5/mfmIt0MRnw/WmSoSjkfp6TpQb2NjhKv/n/fz1F/NFyOZ/jbTV/WEick+VbGwuZueDm4jTwM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440168; c=relaxed/simple; bh=j56Q1R9+qKj3zimocNs/jwoXu30uxe1SwY3lWelE70w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=GNeEiNycPdKG1dlniudYwAE5LKYBuCYrjmjY1c3x8qp7hpN/9PdvlOz1B1OXMTIddUR7v/ZeuemL0IpqoUWpkTMXZ69Io39h4IH5fD3j83TGmFtm3YN0+dlt8agRJQKDHiIfQ6gkqZVkuuRwEQjZykO4b/8jTvhRKKCuPuRoHd4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=R9a7kq8i; arc=fail smtp.client-ip=40.107.93.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="R9a7kq8i" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DaW0tk7mnJBb2UirGCmKtFXGxky5b5MS8V61fZqm7Mlv6Bn/W6KJGisrBX8akfgUAbmAa5Ox1kfZhTvlK7/2v2DxTrXDJ/yL7mEgX9qYY0C+b0OwsfRczcW44q2RmeaZ3YMkCLLOFcVN5xIXfk4LXbHthLFonTPrmRozMsTXO0cShJeLCDPXdqFRkGTngZpcG16tnnUejO71ANK4kHDLgF6upfbo30tQDpl2hn9FjtEsDI1inI+5b8OV4br0dzr9HtJlw9OZfC6RCiJjEsgHBJm9eBA4aOpNg8mOs3LCnUQdI5YLdJt2Rd4yzYUmR1xx0IEmckdUSrkMP5T4JKgc3Q== 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=ISitgdDRM/H1DcjihRHvzDRZcL8cihdnZd5QMX1uOCA=; b=RcrwTW6WprmozhM69o4h+pKjdMe6uGkVpWTZ1nFDXqDtQZ2DfxlXeFcGMxDdYNF9W7XNA8E66ZzUxyXu5iVyvUZRwxyr8tLiSxcTfvEaraW0eAKUqfaPZUGqzUkbgdIdvIIax31ieGJdgC53YHnCnBjvE/0LMo2etoAenpZxAe39t6XTQzoeESHQU//F0bV5Fna5Av1xTGq/F8E/TbesbHU3n39vFsXx68mhrCAm0c7tMPmrl6Nbpa5zjYfpEr2deqzQEYO8VMpWYT1XYUKfNCA9m+ntOMLNf7x1shZjFKnOeu/oxyXRlPfdZg9qJ6JkDW6sH/TqvFn8XhncTAOovQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=ISitgdDRM/H1DcjihRHvzDRZcL8cihdnZd5QMX1uOCA=; b=R9a7kq8iqfi08w7Odyw7ambGsRZ2NqTWjIx+7WzOjgZR2K59hUvF44JPLLS773eSW0RNuW26gW/cKz5Msypb0kUqXtBN10j+y047SGZDo1bbisnM/z4pzEcvoJJEwwjzoRIYUkIic7vXVg18Qwgb26eoGTIaeCaeDMEOe6OaevPg4g5le9W7+50g8qlTlfUpfGWvRXkZzy4vFX29jNrvMT7/7ync+yQ6euqeOTQmz8V1Li83sQaDARMtgPRHM4NIFQGtT5oqer8HBPYRLevFJXdTG6f4Y/srIblsEhG3dbfxdVk7vmKN+yFJNbivTrDjL6C2EY3VA3BZh8UtGpD9qQ== Received: from BLAPR03CA0021.namprd03.prod.outlook.com (2603:10b6:208:32b::26) by MW3PR12MB4490.namprd12.prod.outlook.com (2603:10b6:303:2f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:42 +0000 Received: from BL6PEPF00020E63.namprd04.prod.outlook.com (2603:10b6:208:32b:cafe::df) by BLAPR03CA0021.outlook.office365.com (2603:10b6:208:32b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 12:02:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E63.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:42 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:07 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:07 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:02:03 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:41 +0300 Subject: [PATCH vhost v3 17/24] vdpa/mlx5: Add error code for suspend/resume VQ Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-17-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E63:EE_|MW3PR12MB4490:EE_ X-MS-Office365-Filtering-Correlation-Id: bd851a43-db8b-4e5c-fb95-08dc9f45df3f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?iGSLk8v7OdGfEu6leT0mN0HBU1p8xss?= =?utf-8?q?GPHrgO6uJrgAdbKpTBShm8TofyxR4K9zNI/EirV3GZ13hZEwHjltzFhWYRLNVS1p8?= =?utf-8?q?1qEV9ZmaQW16qlCEqk4oYlb62KsLoQ2osyE5R2TvxLnq+OnRqPLHKkA7QAKM3PDu3?= =?utf-8?q?x+3qgPl0MD6M0gB5PYfriL6NioQWAkxO+0tHGN+GyU1SPeSIyxqU/l38P2fnGjtIC?= =?utf-8?q?pvLFT8gMBIhwoUpTLqWHPUkOwuXajdBW2h6+9vDYlJ19Tf7DP3enm0/5/9G9vGZZr?= =?utf-8?q?ap2lnEFIFqPWpYJbs4W1D28oTfAsLJLRwG1+x8rd17XFXaiWd21DwqA6/LykQkK9p?= =?utf-8?q?imMaGGHlriLIVPViyEPMvF1sorA1yW2XzOyEmIr+kKECEWv/T+NOpkqEz8HOPZN3Z?= =?utf-8?q?BhD74Mzb/4iGDNNOpgGlDq2n3s2E8D27xDlY1J+AKW2a9lUPLogDo+jK2KxO8Bb1W?= =?utf-8?q?UxMh6754KPUpBBG5eRba4PhX+yFOLYR1Tho77gbFKRD6ooWke7kkUm2VnJv7cvH+I?= =?utf-8?q?eaHLScgG+R6c9ryGbq4A/3TYn3cKt+iWPwNkMEMJvyIXUbJyhqG0Odf2EGc/CxBXT?= =?utf-8?q?rpOPSfDh7HF+zArEvIXjRt3iYtn8A+Z7ld5BWXKreEl8AmlPK08+wkZVP/NCpL3Am?= =?utf-8?q?yf4b6wstub8p9R8tphAFljkHbWRK9WiFHLtrgDQiS1RJkYF+8uZ+0DJxKhsv2ndyq?= =?utf-8?q?YGRVVtaOqC8GiaB1suFsDGGtUt+tQ8KfKl9i5irr88mk2NNU01yW0IKOKwi1UxPvx?= =?utf-8?q?s7H9QogIx16MHwhMpAWZHO3CWpAnOzJcoOFl90o4iqgm/0w/mtRsiMJaAZipB/hfT?= =?utf-8?q?lJzL8uhPdAjb4KDM1SKNrcBMAGBGKGmAcIbc7iBWOZSpYL30AMYduFWi6D9mFpOmG?= =?utf-8?q?Mmoimi//nd0jq2CQ6RcOQb7oYfhapRJLs6KMbDnMOR1CSYz+pJq7ow7QxNr7udegY?= =?utf-8?q?UBoX9vdXksNBIk5mTIuFjVW9u43mxinWuKXhcLRWQ+5s6jHsx5fEwQsy0dYJrjUAQ?= =?utf-8?q?2htp4TgzTQAGLRJ+TTSaZs7QbfAzl3GKZp8xabfb28PLWVuXSTR16EDfqj8Appb+G?= =?utf-8?q?vGgojV56MdMG/oRx2fymx5zflr1gTjfNVGarzZ+pXJfPOQFpPDoAoGvClGJQnFp/X?= =?utf-8?q?gRuPZat8ekuxor6mHA7E40+Q6j7b4AG6nuaU+NiE83CceGpUEEvqwHandW5Hiq16w?= =?utf-8?q?qiczTY85e00HMpAQC9SRLCn04ooPCz9p9ueqwOC8Y6ED2h9M3QV6IYM2zv9OOr1cO?= =?utf-8?q?qO+c3461AlSGUM2+U/LzkNfQy3g8MiMKHQdZ7EhCHwxrrPHPlOaFcYljBwiobMhdH?= =?utf-8?q?5RxnY9Q4axK4kBqCufuHDaB4ivH7RRQRwHqkZFk0KgOybOnfl90S7aoicogBnuRQ+?= =?utf-8?q?ATuKbYz0zGM?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:42.4652 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd851a43-db8b-4e5c-fb95-08dc9f45df3f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4490 Instead of blindly calling suspend/resume_vqs(), make then return error codes. To keep compatibility, keep suspending or resuming VQs on error and return the last error code. The assumption here is that the error code would be the same. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 77 +++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 23 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index adcc4d63cf83..8ab5cf1bbc43 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1526,71 +1526,102 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, return err; } -static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) +static int suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) { struct mlx5_virtq_attr attr; + int err; if (!mvq->initialized) - return; + return 0; if (mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY) - return; + return 0; - if (modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND)) - mlx5_vdpa_warn(&ndev->mvdev, "modify to suspend failed\n"); + err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND); + if (err) { + mlx5_vdpa_warn(&ndev->mvdev, "modify to suspend failed, err: %d\n", err); + return err; + } - if (query_virtqueue(ndev, mvq, &attr)) { - mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue\n"); - return; + err = query_virtqueue(ndev, mvq, &attr); + if (err) { + mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue, err: %d\n", err); + return err; } + mvq->avail_idx = attr.available_index; mvq->used_idx = attr.used_index; + + return 0; } -static void suspend_vqs(struct mlx5_vdpa_net *ndev) +static int suspend_vqs(struct mlx5_vdpa_net *ndev) { + int err = 0; int i; - for (i = 0; i < ndev->cur_num_vqs; i++) - suspend_vq(ndev, &ndev->vqs[i]); + for (i = 0; i < ndev->cur_num_vqs; i++) { + int local_err = suspend_vq(ndev, &ndev->vqs[i]); + + err = local_err ? local_err : err; + } + + return err; } -static void resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) +static int resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) { + int err; + if (!mvq->initialized) - return; + return 0; switch (mvq->fw_state) { case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT: /* Due to a FW quirk we need to modify the VQ fields first then change state. * This should be fixed soon. After that, a single command can be used. */ - if (modify_virtqueue(ndev, mvq, 0)) + err = modify_virtqueue(ndev, mvq, 0); + if (err) { mlx5_vdpa_warn(&ndev->mvdev, - "modify vq properties failed for vq %u\n", mvq->index); + "modify vq properties failed for vq %u, err: %d\n", + mvq->index, err); + return err; + } break; case MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND: if (!is_resumable(ndev)) { mlx5_vdpa_warn(&ndev->mvdev, "vq %d is not resumable\n", mvq->index); - return; + return -EINVAL; } break; case MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY: - return; + return 0; default: mlx5_vdpa_warn(&ndev->mvdev, "resume vq %u called from bad state %d\n", mvq->index, mvq->fw_state); - return; + return -EINVAL; } - if (modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY)) - mlx5_vdpa_warn(&ndev->mvdev, "modify to resume failed for vq %u\n", mvq->index); + err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY); + if (err) + mlx5_vdpa_warn(&ndev->mvdev, "modify to resume failed for vq %u, err: %d\n", + mvq->index, err); + + return err; } -static void resume_vqs(struct mlx5_vdpa_net *ndev) +static int resume_vqs(struct mlx5_vdpa_net *ndev) { - for (int i = 0; i < ndev->cur_num_vqs; i++) - resume_vq(ndev, &ndev->vqs[i]); + int err = 0; + + for (int i = 0; i < ndev->cur_num_vqs; i++) { + int local_err = resume_vq(ndev, &ndev->vqs[i]); + + err = local_err ? local_err : err; + } + + return err; } static void teardown_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) From patchwork Mon Jul 8 12:00:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726499 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2056.outbound.protection.outlook.com [40.107.243.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14ED0149C77; Mon, 8 Jul 2024 12:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440174; cv=fail; b=eX6fFLR570sasTpRa54Yw3jLV7BW/74T8dzykFvfyB8RewCBldCfTN/ldekvb/D52fF9U3DwO7OOfgcZ0u6VxE54lpDtW3ffM/i7CQL5Ns7Iogq+chupIAVpKk9qAiCHTJip7APReB8/KaTXx6m2XMIy7TUoqu4EtH5iQPXaEqA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440174; c=relaxed/simple; bh=fO2LxXbQwK3zIdaoXW8DXBIgHadEd6bZLr2gSb4MzZw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=kWOT4czHRFkgoBV94XCTTUjUy9O6OihUHMyOrQoeAQUulGjOxws5WGeLhaTKQogP7VIXt/Tc/ZQYv3unPU9Zi9qHgX8A2rhqaORoyxHVU5QHMtYHL9eIJE5h5bgoL3SgIl/Rdk0xi/1VVd8L+jYBYn7MG9LJWkThsHmZw1B8RN4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=bMipdns2; arc=fail smtp.client-ip=40.107.243.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="bMipdns2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LrRLhN91V+a7edTOkCZ/psxVVJBOA3wk0c5xH2Mu6/zS6fgKVTHMjblTp7BAWsO4P1q8MVMc6tUePtSEXlWF3QY7ZQdo3NPXI6des006rKVOPn5HEwMwvOTJwTAKy9daeHXIYXZm1xmGcD2Xz12kRXkepKpLM3QKuzhK4U5H7oboNWI81+QgJNyAZblGHOiQkcnsdbFjmR2UU96Cr83C/sm/TA4FAzyGhDQJ19RFjGwMjhYLsNEWZoFms43Eay57M7Wg2HVTGSTCx2fZHNDN98J55/6SwFvkSv2Ds8felTuIGUN6ELIC++qfDtWaTHA7G/rNp1Fl6fznwc2cGfZHcw== 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=5IiD7p91QtFX2qpSYAmR2W15j/7v+yh/UZLfdd9xRPg=; b=hf8QyU+WBBTFf7vNyZIjtnPENWgmdIQmky3aqNvGLv5C2daEFEKhqX2fZH24sHtfDISp6acPyfqXD5t4ZI4HDYMtcA0gg8l5sebryTUB/dy/bFHYnFI9oP12LrSE76nInyDLFB8/O+RvSXYD97+42d9QH2NhP7WO2vIf+ATnE11rccjBh3B8mD1J82iE7oB1DjvvNxx2VcGp5vLKocr9qFO6quLo8piqyOgmpU33UFIz85M/sqkrvpK+np9kopRHjawfLd3ROvJmWTk+lrzY7CgMt131MYIZ6hO9yHNY9XTaiMYLx3iyyZN3FEJAXM9QVrkR859U8sUJZY8+oGIRDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=5IiD7p91QtFX2qpSYAmR2W15j/7v+yh/UZLfdd9xRPg=; b=bMipdns2/MMiT7idi6+aed+Vwu7iEkBZTafw+uQt9Fe3GhRDg3KJZGZLOOVVUNN88AGbde73oBrvid1+/dByYjbR5jqwWczMnBP073bgb5CeYq2FKo1hy7V9D3a8p72ci6Y3lBe3D+NlVdpkjzRno+YHC5lT1spFumg+xxS9d/4qdhKUdp0jih1rngELnUJ+brZD6OToY4s50G2Hp5mlC+l0wOoi4fkCVbGjg8XxGYc/Vdj91IBZTJu0h2PDfCcDlXnNQpBvN1daenn6IrHyn79AxmMbnJMyxAFa60ZONyQ9LRvwor40ZnznoCYBs2Tf/cr4vnVqnpTk40L450S9ng== Received: from BL1PR13CA0067.namprd13.prod.outlook.com (2603:10b6:208:2b8::12) by DM6PR12MB4235.namprd12.prod.outlook.com (2603:10b6:5:220::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:50 +0000 Received: from BL6PEPF00020E60.namprd04.prod.outlook.com (2603:10b6:208:2b8:cafe::56) by BL1PR13CA0067.outlook.office365.com (2603:10b6:208:2b8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.19 via Frontend Transport; Mon, 8 Jul 2024 12:02:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E60.mail.protection.outlook.com (10.167.249.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:49 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:11 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:11 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:02:07 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:42 +0300 Subject: [PATCH vhost v3 18/24] vdpa/mlx5: Consolidate all VQ modify to Ready to use resume_vq() Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-18-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E60:EE_|DM6PR12MB4235:EE_ X-MS-Office365-Filtering-Correlation-Id: ce7359ec-1993-4b50-6b52-08dc9f45e386 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?s56OonUp2iwuhEIiwYSBR4U5ae8NaVC?= =?utf-8?q?/ARoTc9yv7yGDA8RWY+dL2kGbOB/dnAjnZstsvLVljFeUxf8LG5SNpmSlgkYzBL4J?= =?utf-8?q?XuKf91OJeR3qTKgJFBZlBOAeAZ7OL2Vl1EHlM4f7NNnhcaFvcwOn/pdDwg3WNiI+B?= =?utf-8?q?SgDSga3NhB0eTXFj4UQRnwOK5kTYRCBJ+5ChlrokDQbXdLkEQiCnczhkwWuIM0ZoF?= =?utf-8?q?fOB5hqg4YpWkH3YxlJwF4QtJ1ti5rgaZxoXmGyXTKxVIH3gFvJ71HgcKTIdI7zCQS?= =?utf-8?q?EAmULlWPWGzALEosQogKPsy5stTTE/gWwrX5kfx316iNnHCkqHHcxRTSBvvoGXc1S?= =?utf-8?q?tzDwCC0ILTv4cod/D9uTlUt6+91eEKvwGP6aDpaTKdHNICv2/Y2LCBtocOXFcigre?= =?utf-8?q?CE4xNKB9Og7Jtz2ruBXm2T+NQzOxuTjEZLdchgUOjtUdjEgHlGvFVKw0FSSXeZb6w?= =?utf-8?q?ZbfJC09HcPusdghJtxqc/ReFiiojhV/ehhL12AfyGWP5BpJXueQsa7AH5oLQUjgcd?= =?utf-8?q?oLtDn1WOo410z3xmsC85b/60FHD/iYGd13Oib39+E9cPpsyXF5HZtue2xTmdm4zE3?= =?utf-8?q?Oeh41EgsM0+wVdcswqwvCmk/EjhekRHOwnY4yRc1NqgkeUtaapS7kw2fTouErmrHd?= =?utf-8?q?V3HgxCbO9fh/Niz+T7THeS+SF/scM0caEzn7YwyWIGbXFrP1l7cbrIqrMmCjgQLfx?= =?utf-8?q?YBUxhGgpunlaGPNUo71dED6ZnwsoqQsINst8P/Y+9dk2aQxmv+qFhrsy0FJwv95Qi?= =?utf-8?q?G4KFZ+mo0SZBG+LnKB7Ol2lt07et/a33q9ls4WSedQy14SRZZeL4QQTCG3kZjjef2?= =?utf-8?q?z1dv1vZpqX7BOBnb8q5LpDvFF7eZaZPA6iRbZmcBbR9RapsL0L3h8URgeC1fKiyX9?= =?utf-8?q?+XFseVuI80T3tOlEx1OtWpik+C7G93ylrC9IRqkFSPI2L51OMdBhNmOulGfWIYW6e?= =?utf-8?q?3jrLEvofUkN1CEpxLoNfVlRyX9QdhMhD50DB/L3EghanZ7miFUrQC4KuMDgPaDQTA?= =?utf-8?q?tHdz8/msS4QHNSbAxSOsLLXU88Ml070cyBYTT2fw1iCgG2ZEm5HM3fdN78mm9Zwx2?= =?utf-8?q?AXjKbHlwKLFF26sS67j1rj0mY6LYdz6k2VUUFvhXjDrHaeCgU5p9OEQtaQfpEVMVK?= =?utf-8?q?3X3YF+A4pMZ97yh05rjUaVusd0eOzWG6I+0uCqGT3DNxmsOqZuK+n6xgr2X7dsjCU?= =?utf-8?q?JKV/7BhmeR/am3tsXjTO9yaIg1Q9v8nN01q0rxHbjJF60U09D25B9ovRXoNGPI/5+?= =?utf-8?q?kZkZOYWHhbD0w5MxViMjbotRyIWXDl+CskI+WPbSVrFl30M2Q/5nMm2nRzkP4XX+y?= =?utf-8?q?vy3IY4cJ9L2/OpXNNtNjFj2EuewvIbFD+ROHcAeNJV6mGNrvy+Z/zTojyCcZ9vKY2?= =?utf-8?q?vqVF8FPIJGn?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:49.6689 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce7359ec-1993-4b50-6b52-08dc9f45e386 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E60.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4235 There are a few more places modifying the VQ to Ready directly. Let's consolidate them into resume_vq(). The redundant warnings for resume_vq() errors can also be dropped. There is one special case that needs to be handled for virtio-vdpa: the initialized flag must be set to true earlier in setup_vq() so that resume_vq() doesn't return early. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 8ab5cf1bbc43..e65d488f7a08 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -160,6 +160,7 @@ static void free_fixed_resources(struct mlx5_vdpa_net *ndev); static void mvqs_set_defaults(struct mlx5_vdpa_net *ndev); static int setup_vq_resources(struct mlx5_vdpa_net *ndev, bool filled); static void teardown_vq_resources(struct mlx5_vdpa_net *ndev); +static int resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq); static bool mlx5_vdpa_debug; @@ -1500,16 +1501,14 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, if (err) goto err_vq; + mvq->initialized = true; + if (mvq->ready) { - err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY); - if (err) { - mlx5_vdpa_warn(&ndev->mvdev, "failed to modify to ready vq idx %d(%d)\n", - idx, err); + err = resume_vq(ndev, mvq); + if (err) goto err_modify; - } } - mvq->initialized = true; return 0; err_modify: @@ -2422,7 +2421,6 @@ static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool ready struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); struct mlx5_vdpa_virtqueue *mvq; - int err; if (!mvdev->actual_features) return; @@ -2439,14 +2437,10 @@ static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool ready if (!ready) { suspend_vq(ndev, mvq); } else { - err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY); - if (err) { - mlx5_vdpa_warn(mvdev, "modify VQ %d to ready failed (%d)\n", idx, err); + if (resume_vq(ndev, mvq)) ready = false; - } } - mvq->ready = ready; } From patchwork Mon Jul 8 12:00:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726501 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2053.outbound.protection.outlook.com [40.107.236.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E50474429; Mon, 8 Jul 2024 12:02:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440180; cv=fail; b=GpzpCtOSiBllKbvQuaVMWbjDazMGPt9vvm4bDjn8UwR/cOry6UKwSy7IdkZhB85/TZGgrjpTP97WKRB+sWrvMPh7VZXs3tAZh1cI9U+ajHmqbyr6nIVGgIlxUqta3R9UxiGc52VF92ZhFve1x7i77M9rJ8aV9cCmvG+U+NDirbc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440180; c=relaxed/simple; bh=BHmnNoIXC1Qy96RQ9ZZX2ifiZIPZGAazrmIbRO1aaLo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=RoQzSbvTPhexRd2zIHJ1lqXPMCYXCaxP7E/UnkohncFzhofjUJUS3UvBqyLksqTZ5cZK9i3pZY5Vq8Km7nvHto1A2+MBrwn/jsFXjx8XV2N6HQtroY1Cyolx7eMecf0AuoYzZxmuvSLjpevyuDTVwD/705jcOo0aglJk9lJZPE0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=hj6cEIMJ; arc=fail smtp.client-ip=40.107.236.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="hj6cEIMJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T7FG0XB4h5ooYijGjGs6gIoX5t2l7DanMcWTK4AByV50P9jSk+tGrEnJ/4OmDNETJosKkkD8EYQMKK6AslDWY4RHslfgY5Utm1jxbVOn4bdJYQnzsxByt5E0TIYxLtuE7MOPjy1dJGYCch/aReTFRJUjv2fvr9j4H6sFQfukGcHqlUmh8iHJWiUkppRx+SdcuHuE6JspkVX/P5DCPC86GUM/szlmqFGxWTMrN8gvR41RKnrdK/p/b2JLlbRTeQxzdGY0Bts5H9nIhxzQol9XZmK6d8TE3nMaif3ZSL+8cSHv87UHTUJ9zz8ZLHU2DFW1Lvrk2UDc5VkRa+xsNNlOIw== 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=WIURNVv3dR2eq9wrfd7hzmvuWSQTDsVM8Uz/wDQoWmw=; b=XB7EgKaHOsK9L32s84zfLHDFrSPNj9PyuFdNWeCXe92XFnNrsBF0g4d+lTj7Qcv9Qqg5wi6Z2Iril4fPWnEk+lElHn4AqvuRB6V0ttSGr/2E4Nlejh3qo7JFKFjugZdo8EkeFDibdnD4zlE3OJH5X25mmBxbXK0PqftP3oOZE6ZqonD5xnZ6N9U7zqQMO1GSOZCskAqOKscU9AzdCJGnr7lGMQdTmgO8EsXG74VuSyFqnF0Kv5/Jl+wTPTQrz4pB7TlYDNQ4+/YxolKNWzNcfjjP+QEjnD56Og/aKalYfByGRAd+2XX8eKVEtrYGJDOusjfVhgySCYwbURi8Ngl8fw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=WIURNVv3dR2eq9wrfd7hzmvuWSQTDsVM8Uz/wDQoWmw=; b=hj6cEIMJi9VCGm1dEFY8f0gC0Yi/gsCrDD4P1ob/laSCTwjMW87zEiEAYYwPVBv4Wx5BF25B4sQasH1Q6oePAkJ6fU3fK8YvaSC0pTH+J3DMyAvC8UzEdBl6yvRr60QAgyqRwy1jZ/7iKmyJ2xqp+BkHckmGw+Re+4zqp2JNS++XClBC+kkZj++2KdvYJ4jpt2jRnLXshh371yrkCIhKnF1K/DI1+ftE+tj1Jb3rj5x/zpt4GRpyOqE7QiY9cxA+zRVCboOPeJK2IPlAGTF3/chKAozO4KAQSjrfS4GABCEmCifANNzqGnGsXPs7PLlt9FPF4R/n698WC9vK13Fcmg== Received: from BL6PEPF00016418.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:7) by CH2PR12MB4310.namprd12.prod.outlook.com (2603:10b6:610:a9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Mon, 8 Jul 2024 12:02:55 +0000 Received: from BL6PEPF00020E62.namprd04.prod.outlook.com (2a01:111:f403:c901::1) by BL6PEPF00016418.outlook.office365.com (2603:1036:903:4::a) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 12:02:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E62.mail.protection.outlook.com (10.167.249.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:54 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:16 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:15 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:02:11 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:43 +0300 Subject: [PATCH vhost v3 19/24] vdpa/mlx5: Forward error in suspend/resume device Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-19-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Zhu Yanjun , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E62:EE_|CH2PR12MB4310:EE_ X-MS-Office365-Filtering-Correlation-Id: 638172a4-1fee-44a3-20af-08dc9f45e699 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GmHS67HGsfdnou2hwnNIqMBRFBCua61?= =?utf-8?q?7NUkvFWSvtGxjORgi48uDixWYnbbkVMHkwhaCNg6AUuKPwCGTyTMU8q2QTlQHyaD6?= =?utf-8?q?+00pgLFtRcTx/0D3uIpQfAZ1yG2+CWsQC8ItCBzVgpv6J++AliCaqpPf4PdWRSobU?= =?utf-8?q?eBU8r/5A8tPADzJaFl80TOWSG5B4FtHxzdyAw1Vf8atGkUK2zfDSTgHIZXTquF6Av?= =?utf-8?q?p+iHJ11ebEd6RwgF7jKN/arvPElgZoezDj9AtIDocikG2Km+fSFjZwkSclg2F1URH?= =?utf-8?q?YV1RrdeTJwZwoxC2DBnR+Fm95ZgVpuEU5u2BpE/oyz/chwQcbd+8erpbN3OBikt79?= =?utf-8?q?0MP21u+WjFd8iljLU2NwLzEjJblbdapgQaUMBYkA2BdltqBt03oJ4VCjin5rzSjaD?= =?utf-8?q?okotlyj/AaQuJAa+yr1WThTcHm/ZKk6T1j1l/NmoE8FR01lcoBNmlA+RkoY65rIZT?= =?utf-8?q?1eDKD4/xsD0AyGMWOb7+T9dshukXzxY9SlMMydJxqb4x0ZKfmsBKSSWJMky77sJ08?= =?utf-8?q?HzMW4XEY38HqoKClV/PhP7DSCU9UTD4gBIiXofeVLJ0XMpI8QO899Pzm0SaJITcFa?= =?utf-8?q?hngqPFFvUv30T6H1UebxqcaOppZV3bSJtcR/3SJ8LcvvvLdI/c0gtfJ3cjEp5IThk?= =?utf-8?q?R2Cb3bjUtVcdRW2igD8fqRnORjpx8fPLfReXFaAUFDHZzSOBaU1LiK7jrKS3n9xoY?= =?utf-8?q?bOnrCg3cKR90Mmf1BsT5KQb1IdigKOz2fuh9stnYoS+eeTBNR68gPzV8yOifMQXjH?= =?utf-8?q?HPwSiDLsMTCQtE0Qt8Sod/0nxeThPZsVp+qu4WHWQ1oOSu7f9ckekw5SMLTD74LTQ?= =?utf-8?q?lKyYJqFJV6w1MKw/VQEKgjKectIBfxWyyTe4E7nj3eAuuK8hnG0jo0zg1KoVOZK13?= =?utf-8?q?voNvSA+bqAqPiYC4ddH2Y7K70H7UF85U8UHtgFCLymLjOp8wH1AeXNa3wOYUAidX2?= =?utf-8?q?pc/0OKpsSYERwSu5Xow6pKbVupqfc8SloHGzBkuRAHHLkoOnDooicB6+tmiiEnMVN?= =?utf-8?q?xh5pDaE/2sa4uVhtWgfSqpDMH8qQhW53wwumQ5Qx6fzcoeOJjcyq8It0sjF4hD0Mx?= =?utf-8?q?JqEMY96fXBNUSB471lbR1uEjyKB4i9EOPI6Fs2yjrn32Gj82xuQBv85r6+UYXugj6?= =?utf-8?q?CwhIcQAJgueRsZ5cNOkWhOENlNFBzuBW8lHhahWaAIYB5B8PZX0xKrayQgoGwIO1x?= =?utf-8?q?KTdr1ptXF13a9DKgTeQ8NpwTQ8lA4+0HzRx58R5EX5tcRbPaqy7tXdSfQBDLYnz6o?= =?utf-8?q?WTEd/y3GAyStEslTqTUb0aAwt6K+Z+h/dAYWJtdJLE7W3S8zmlBBCIMJ3+IXMamr1?= =?utf-8?q?JzrhOWmo6eSms2F8NAOm3ipqgNJC0oiw8+ATFA2chb3+tlvxsY+d/njGS0aVneehA?= =?utf-8?q?HK4GBO2FzfY?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:54.8560 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 638172a4-1fee-44a3-20af-08dc9f45e699 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E62.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4310 Start using the suspend/resume_vq() error return codes previously added. Reviewed-by: Cosmin Ratiu Reviewed-by: Zhu Yanjun Reviewed-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index e65d488f7a08..ce1f6a1f36cd 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -3436,22 +3436,25 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + int err; mlx5_vdpa_info(mvdev, "suspending device\n"); down_write(&ndev->reslock); unregister_link_notifier(ndev); - suspend_vqs(ndev); + err = suspend_vqs(ndev); mlx5_vdpa_cvq_suspend(mvdev); mvdev->suspended = true; up_write(&ndev->reslock); - return 0; + + return err; } static int mlx5_vdpa_resume(struct vdpa_device *vdev) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev; + int err; ndev = to_mlx5_vdpa_ndev(mvdev); @@ -3459,10 +3462,11 @@ static int mlx5_vdpa_resume(struct vdpa_device *vdev) down_write(&ndev->reslock); mvdev->suspended = false; - resume_vqs(ndev); + err = resume_vqs(ndev); register_link_notifier(ndev); up_write(&ndev->reslock); - return 0; + + return err; } static int mlx5_set_group_asid(struct vdpa_device *vdev, u32 group, From patchwork Mon Jul 8 12:00:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726503 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2043.outbound.protection.outlook.com [40.107.92.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E058614E2E3; Mon, 8 Jul 2024 12:03:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440183; cv=fail; b=SxqoHgfIq1emg6L5TeysR5+G7/ta1KOka5vb/xTtSoMQ6pcOWVidu9nyHeBlOqqk/cUJ9NQd2k1aJWjety5DAG91HZ1FUjxcJottdZrD+htdsa/h6nLZycBeTXm7d7H+re6WSludg45Jw/Wc5/TNz+Ewu2A9AZ1ygM+YbK4fYwI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440183; c=relaxed/simple; bh=alpx4DHW++4vPyW2+DZYTz5s+xhITTe/eBUA+Ib9QPs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=t9QtNYOZLgnwefwff7tF9TsEd3xjb76a8m1p5P5KdFYg85WGYs7D1/a8bM2MiOU198GKhn+QokWCcbEsWSRWWL0bY28arwRh29uAK9bN6t3cs8B2djwCSR6fWqCqtV2Xm7nHD9vKn4IeemuAi9VcgNcgsu8omQGvLwSWAmtcsZk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Xpog2HKR; arc=fail smtp.client-ip=40.107.92.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Xpog2HKR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZeG13vFw/fHcO39/KZ71Tbkala6TffSxG+IAe6vvBEpWsLlAc5YYvPnim35EDhLhoR9KL8fXDvMmPHdQ0VSzpqd5nTQgSjF1Ge70DG/FpLINx0bbBmX67AS+qASzsyT2fHHAEiAh/r7zwL8QvNqoJGOYQ0kA0CQXzpYHGeipcga3QdBJsgs0trmHLGmWo/ARhCGQxyXxkJ1RYu0odYylk3T3IvlbCOqfJg9yLDT5NVLyx7FsszoEmk/vMvAJtIzXrSjCnUBN3GUjcojcm/dHzaMLAlVuIqbhav8R/C/XGq7YoSRKXBGmTlXmBBeM9r5SM3EHi1DkFxNy4TQeXhKZyQ== 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=KU05PAbc7XWmqajIj841Tg7fnNV9AYqRZIy+qRdkNds=; b=XAQ6dwu1wMWw8ZCy6c8IOxuln1NOwgEBjZ3zLFi37/Y8ZvGATS6IK9bAItbOLrCxYGs77hEftjT7cSHN8nbRoCN14i5Awc18PhHHnBjZB4VWbHoEOAkU7g/ojbCXf0IzyZYdZya7z9LX3KLYwgzm4gllIKdjxqQ524BT3LuYMQoCuTKBrCi480sTa1A/5KLOF0ZHHGPMvRgH8HBhGHOIQ4ax0tTWRE1V7p0YE6pSy+8tSYxwjo9Ja5bEjX8f12AWju58uycWeGr9gZnUw1gVtCESkCOFs55CcloSovT71vdtBPJxILo7p7DJ+qJO7KX6BKFCeNOerQ6MJv/n7i1rEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=KU05PAbc7XWmqajIj841Tg7fnNV9AYqRZIy+qRdkNds=; b=Xpog2HKR9zNllqL3zSNl+okSrBGxEt2XQYrt2F+c1xkOQ9SXkjfGbdmWg8Bjmyy1UB+w43NJoge5JH686q/B25Ffcwzv9gJal7+7lWd+NnFX8THBXPEwboEpY4INCeV18+8fs4Zu4nFYPndavcfuK9A3RmTtKbKlZe08Q72W6vmb4VOpSXcGaEJKRsIaicrM/I1ZuusId8rpuDtRHFpCBtA9pwXP1eBsKDFTsnphE9CVkKFU+XSmiiaOJdWanm+qeDEsDOa2C8DHVPf/f19ON/rSAZE88n0o+7GV2kY2RiSRqgI/GrG9PtiVuumWtPBJ/PSZy/2uMDaIVveKCQWGdQ== Received: from BL6PEPF0001640C.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:13) by CYYPR12MB8871.namprd12.prod.outlook.com (2603:10b6:930:c2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Mon, 8 Jul 2024 12:02:57 +0000 Received: from BL6PEPF00020E62.namprd04.prod.outlook.com (2a01:111:f403:c901::1) by BL6PEPF0001640C.outlook.office365.com (2603:1036:903:4::a) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 12:02:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E62.mail.protection.outlook.com (10.167.249.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:57 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:20 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:19 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:02:16 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:44 +0300 Subject: [PATCH vhost v3 20/24] vdpa/mlx5: Use suspend/resume during VQP change Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-20-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E62:EE_|CYYPR12MB8871:EE_ X-MS-Office365-Filtering-Correlation-Id: e5c55a67-27d8-45e9-ab67-08dc9f45e829 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|7416014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Z8MyA1KwceVPa/5pck2gxSt60pIJQkm?= =?utf-8?q?7QAFjQU7x/ITNp4h9YDf6gahdCKatqhMa7SFSPphUpcVp1tuPw73mFnY+oF4jIygv?= =?utf-8?q?dsGartjVONZPd4sRurUiQj66RXxIXNywkRmrL/MnxlDhfo5thNyN8eWnfHbr+XxuH?= =?utf-8?q?7zAQyJAxcPHv5E0UybeCHSF9U+5JM/mhUcUCwZrx3Y11bkoXARg4wyhPTdeAm8JU6?= =?utf-8?q?0diRv67rg4puq6KPyY6+ZJ8wRtBXjGdnq0mDqs5/imKIYVHeWNwpZIELdANSgKIzK?= =?utf-8?q?9uKPP1ZTHG/7lhd7ceD0G6PFblNUU/5nJzxvqwU1NTO0PjVoYd9SK3QFBCYvpMsyn?= =?utf-8?q?U+ASTlbYsGxwzzV/zzBaCYkQ3AjYMy5fECrT3jXz0Pm9wMxqVX3oFy9NzRU9AJTvj?= =?utf-8?q?0qJmzT7AHRm1nHHhqekcUHRAj3X9OxlwESdvNBCWhrr934RuSFgWx/9kv0owFSIxM?= =?utf-8?q?t+Mv4MsxdSfRemvBtwi+Lg7nOjNf5X9a3XL7GdUsoFL8kHeQrRd78Llhe/CLXemO8?= =?utf-8?q?wtDnoprlVEYdM+61g4x1eSQzVH72ASiRWwzS24kwnk+CwFU1hv1Uk9ZaLsEyxzZpY?= =?utf-8?q?sgNtF6FTZPTTZ7NlgDZ6GaroOSzIB0ESWZX6+agOox7V65Zi1lkXRCXTLMrxsY9AO?= =?utf-8?q?H0vqw5xBkZCz0xupZquaZgg3PBy1wZe5WdcGrfKt834p6JHthb4VMIT5MDpwNHJtN?= =?utf-8?q?AeeCoLGPLjYaVgel//hzuiGdOc8IDfFsQIrnxpZFfkqCif+iqkoTO0P3oMWXAHVrO?= =?utf-8?q?67CFu29FeR6r/ztHA/CPlf0V+fQF26JHoNnIOvnAnbaLRNxFgkyvQASChwGmaUQS/?= =?utf-8?q?I3Lx/QjGV+tjHLOvDT3BxXTcEs9SXYqj4uwYunAi6x3Sp5Qg9pXAjRX9aM0vrM65f?= =?utf-8?q?4NPBgn193ked2CmQAwk5Bd7smLMlaTKgeuzw5ppjsroZoquQrXr3+tj/qKolVi6ZE?= =?utf-8?q?s9EmvqS0jOQKzopwes/9Zn3LG+qga02/4J+xvICP+ueQzRLqdy5/c1K1m7zpSDcaE?= =?utf-8?q?D8vPNKqqu3Xb8PhFcnlzad7FmkzMGNPzfzbXFyCV2Kv0WHyUqp5AwjaKqNrGGnpCx?= =?utf-8?q?64YmkO8LekktcFach7Q7j8jWS2ObZFgTc5OGl5L32ZRgmcxlQeuaHJheR33ZsQGFu?= =?utf-8?q?uPCgHcvGx/xEdoBN5imJmUWKo6yjZGIkdIbKuAIT26Kgy47QZ7Dvc4ypHbfvwxwEw?= =?utf-8?q?h/RWShcv2YGQG4iETf5waPoc1/TnyLuY61L0P4xK3+txeb1qclh1ZMTLiwSAHeV6i?= =?utf-8?q?liEbCyEM9B2UzHuvu8BEuxkv0JBBOaMuRdSAoySilyame8KPXbkaS3QngPXc7EW38?= =?utf-8?q?Ecbi5CpS3HUx+uKqBiIeWTb1lnvgGnPbku4IaD/c4m4pZHIKDcuw5TJzCI3CTaTaf?= =?utf-8?q?QTisp7fBFi8?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(376014)(7416014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:57.4497 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5c55a67-27d8-45e9-ab67-08dc9f45e829 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E62.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8871 Resume a VQ if it is already created when the number of VQ pairs increases. This is done in preparation for VQ pre-creation which is coming in a later patch. It is necessary because calling setup_vq() on an already created VQ will return early and will not enable the queue. For symmetry, suspend a VQ instead of tearing it down when the number of VQ pairs decreases. But only if the resume operation is supported. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index ce1f6a1f36cd..324604b16b91 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2130,14 +2130,22 @@ static int change_num_qps(struct mlx5_vdpa_dev *mvdev, int newqps) if (err) return err; - for (i = ndev->cur_num_vqs - 1; i >= 2 * newqps; i--) - teardown_vq(ndev, &ndev->vqs[i]); + for (i = ndev->cur_num_vqs - 1; i >= 2 * newqps; i--) { + struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i]; + + if (is_resumable(ndev)) + suspend_vq(ndev, mvq); + else + teardown_vq(ndev, mvq); + } ndev->cur_num_vqs = 2 * newqps; } else { ndev->cur_num_vqs = 2 * newqps; for (i = cur_qps * 2; i < 2 * newqps; i++) { - err = setup_vq(ndev, &ndev->vqs[i], true); + struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i]; + + err = mvq->initialized ? resume_vq(ndev, mvq) : setup_vq(ndev, mvq, true); if (err) goto clean_added; } From patchwork Mon Jul 8 12:00:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726498 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2074.outbound.protection.outlook.com [40.107.100.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB24D84A4E; Mon, 8 Jul 2024 12:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440172; cv=fail; b=pXCjlpD2bcWfGxz+mNmcaQZqbQwXIrZAY54Aqhzbe0w1N5kQUgtWxt4ebfMRk74GOotPPTCIUlGD55LBpMNldyVMddf+hkgC9whzrN3Bw1YjP5F3be/Bp9ZRptpVtr4VOHCBpXFac3p31kGkBZh11CwaolRhKWjEpkSvaiav40g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440172; c=relaxed/simple; bh=hfGfT4tBrhoKQWnYYnEccOu3DrB2SgW2E7Hjm19C2mk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=KyGj1+NRjkbx/oQCEgVh5OK0tvRwsBLJ2oJ/ZsW8iPvYwRePb2LY9v568JAjGO/4XObCrKGrPzIr0M2rHDA1zfggYB0wEnSX+TA5yVzb09qawO9jeCpL1ba8+WwLMLMlDY3OlVDt2166hOguuniB9hdAjx6gumZsVYJ6ktzRRJc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=lzdSRBel; arc=fail smtp.client-ip=40.107.100.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="lzdSRBel" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AryL+6PfQyjHMWczPc9BqkfmPS6ZvKlAO2Tk292QVIp/PcDrq7AUxAbCWq3k6ufjdhfZ93p1SOPksYOD6APX2lr7ITehmy6YEWKAxttEx7LoEjlcKGBVeJrrmbM9+euht/SkskB/jQlybJQsq5jcJDnuk0EQNV8OYuDRn4OTc4FZNcuCkHQQFZb5Ks6behTYigwdjQEwYsrz/e63bcYnDQyYDOaredh5hSmtxqsN8nZinczsS7AuqeCO63s/M286s5CO2k6S7rkRjRd188hXOXTflUwjSN54oA6ElO4O5q7YmV2sCSuslFp6VZyv6/dYdB76pE5QUX68g9iEB2mXkA== 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=EsHszw7V8zUzUADo6swexPMkyWLFXRkDDgfMbOPnoFA=; b=DUh2/L4gmXtmamltkmIRYzXixiSwfdnHEqnUuEK1yxugH/H6gNf61GUxupXy9qCM+rBAPuLXwZJLAmxvjPMoM1cXeUQvy+gHUpz6GNVOVmd//5z3Fa1HGDSoWFeDth3dPxLBG6FC53xZtkW5bES8Ny0+YEBtkfaLgLG15oPsgXQ+1IIln2C4pUvMvR0Nlt0s2rhF+p4T/WX3nb/q61c2uYl/gXSfLbdFy8QicTZpS84Tb8mq2LkmuioprhYPU2OVGrok1kdruVtQ4VDcQaoRzeT9sJUEuwhBJz+CxVRanub17me6wSvDDQHuehYrbyzWzdC1voDP365jNkovQYOiJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=EsHszw7V8zUzUADo6swexPMkyWLFXRkDDgfMbOPnoFA=; b=lzdSRBelq1tPP7YW2Am7NjJanll3k4p1c/ulp4ochfVdWSc3cU7RVYFr9FCSbjxJ8tpWxEY2W01cYsTTxzABROszrBlOWEN/87wSZsIDAMLMSu17RZIOpu4L70fn7tk4mHMH24CIwmltghEdHoUCq+STwGiMfo27MagYc32iR70sVMCVohjRn1O9tkXp9Rqgrcfjz4GmTJp1AYV2xHqDFthm5hFzKO1kE7ScvXK803BY+CnXFstC92aEaZVEdn0RcLZkyAfhOu8if3z6gY0elTfteiEQiVuUdDRIkpHWz6rdlzfcaBa9ryf9UQc6y0jG9/skH2YO32BrG96VQepA0A== Received: from MN2PR05CA0055.namprd05.prod.outlook.com (2603:10b6:208:236::24) by IA1PR12MB6139.namprd12.prod.outlook.com (2603:10b6:208:3e9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:46 +0000 Received: from BL6PEPF0001AB74.namprd02.prod.outlook.com (2603:10b6:208:236:cafe::cc) by MN2PR05CA0055.outlook.office365.com (2603:10b6:208:236::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.19 via Frontend Transport; Mon, 8 Jul 2024 12:02:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL6PEPF0001AB74.mail.protection.outlook.com (10.167.242.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:24 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:23 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:02:20 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:45 +0300 Subject: [PATCH vhost v3 21/24] vdpa/mlx5: Pre-create hardware VQs at vdpa .dev_add time Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-21-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB74:EE_|IA1PR12MB6139:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a2de525-6f1c-498b-4e4f-08dc9f45e031 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?HV4yyelBGQ57TPtt1vQne2KSQk4Rjnz?= =?utf-8?q?L5RMdte31xOmhTPiWEpCAnZ7aaW5NqSMy9avZeRd3uCWv+YbiBYBHepQFweHopoZQ?= =?utf-8?q?XSjja6JTTLkYs3pLEpu3qcEMffFnhUpIkgfVCkuV/3JusiBgn6TEb8FH1en41J1j1?= =?utf-8?q?GrnRys+AZgx9A6oHrjHo2wFXEP3ISfH7WctlyFUC2qX5Fq3bwkVmul6IDV5SK+xgi?= =?utf-8?q?pPrL1wbvz1rQjknDS2Yh22lkdwEfuMWguks+p4uO/D+hijQrW63g+meddl9Z/7ECF?= =?utf-8?q?5IBSbUzEtpdtSa+cr628MhmEQfo6U/6ZlyeZidMPJgJ9vdvj2pV60Ziu6OU4mmiV9?= =?utf-8?q?/JMQSiRgpfiffYObbsROKEN6p+OrgWyyRvUC+lmrZ963Gkd4SOfgjPL1aifq/LJUS?= =?utf-8?q?eXjgZPwbKML9fatgnpPTySZp83ZKmYXY6QJ6sCx2xZ7sOw8v2l1o+Fs/FXgz3lnaB?= =?utf-8?q?FhOOjyen73rLnBDwUNEKagNpQP+ojuIkRB8IOCPvR0XuZ7w7I4srQC1D5y28ClUgN?= =?utf-8?q?v01aM0L7YDqNFV+qUzZRGg5jwNP5UtjeH4nyAuyJgNprtWJxonbR0/V4fAZrc17J4?= =?utf-8?q?sVsn9aeOHbMWkUNxy2oZEanTigoQgUNMPTY9EL8tIJlk6s17OaLmDRlCb32Bbi1/v?= =?utf-8?q?Q2sHFTjKWWxRSsCOnz2Z2XcwvdtpJ1gxftVL+MPflY8ca3/lw1LsCDBkACDG2cHzH?= =?utf-8?q?uE0UC4pg1J9ynj6TaFbcL5PQQPMM6kMlRB1uZUyjXwtjWCN9aj5637UT5RQL8pqpL?= =?utf-8?q?DIu4cX/773tQlDXRYkVHuRfMCLNlIFhQaOEVu8E3ltGjQ726E7DniJ7si9zi0dhJb?= =?utf-8?q?5OYLyEuxIHj/EpZUXKnk9Oko+FpN5Yq6noNRr2Rzeb/Vr1cBkCTj7qU8FBUAFfPqa?= =?utf-8?q?QTHnGyoB7kjcAfKJbhn/E3Ak/Vvp5xOhBu7U45zf3rwgfm2mkVRtDJZgee3E+74I9?= =?utf-8?q?9WIDm45KQi1N7nQxGWo9sipu0RXsIHQocZGPlQk3g0QF9XANvQy09tzNRo/MX8Qv7?= =?utf-8?q?BcneK5XqMgsNk3RR8bHg/PoQPuYH9H3MvFAQfHGy/gO1h4R2QNVbdg7BBEvyP1Tg2?= =?utf-8?q?6YFAZtwHmZ7Zhk65q9hUnCTYpkoi0/DdU2uaupZwWEDan7R32HW7ZAeiRF/8R3k9d?= =?utf-8?q?3wlomO/vwZYTYBx2HP+Cr9oZeLrdDv2dx5irzPNh9fl98Xr6mAWAJeG2JV3J1vWW2?= =?utf-8?q?XwE2JAbmPUgKQxYjopSQy4EaT6GTzNI/CsIsc3Lz8cW/S2CkEhsVstvRNzogSYYvc?= =?utf-8?q?5xsVAU/NjyFHDEl00J60buRCJTuK1q3GeQC+xf6WOVA2AobDS0KDLmQGsPw883HBR?= =?utf-8?q?GVEFr+Osno+QfQjlibPjvkLYVWuEYv/pb9vL9LvTGb92/N14gINaYi/TLQloSnAuM?= =?utf-8?q?O678L1LKevs?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:44.1249 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a2de525-6f1c-498b-4e4f-08dc9f45e031 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB74.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6139 Currently, hardware VQs are created right when the vdpa device gets into DRIVER_OK state. That is easier because most of the VQ state is known by then. This patch switches to creating all VQs and their associated resources at device creation time. The motivation is to reduce the vdpa device live migration downtime by moving the expensive operation of creating all the hardware VQs and their associated resources out of downtime on the destination VM. The VQs are now created in a blank state. The VQ configuration will happen later, on DRIVER_OK. Then the configuration will be applied when the VQs are moved to the Ready state. When .set_vq_ready() is called on a VQ before DRIVER_OK, special care is needed: now that the VQ is already created a resume_vq() will be triggered too early when no mr has been configured yet. Skip calling resume_vq() in this case, let it be handled during DRIVER_OK. On a 64 CPU, 256 GB VM with 1 vDPA device of 16 VQps, the full VQ resource creation + resume time was ~370ms. Now it's down to 60 ms (only VQ config and resume). The measurements were done on a ConnectX6DX based vDPA device. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 324604b16b91..1747f5607838 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2444,7 +2444,7 @@ static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool ready mvq = &ndev->vqs[idx]; if (!ready) { suspend_vq(ndev, mvq); - } else { + } else if (mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK) { if (resume_vq(ndev, mvq)) ready = false; } @@ -3078,10 +3078,18 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); - err = setup_vq_resources(ndev, true); - if (err) { - mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); - goto err_driver; + if (ndev->setup) { + err = resume_vqs(ndev); + if (err) { + mlx5_vdpa_warn(mvdev, "failed to resume VQs\n"); + goto err_driver; + } + } else { + err = setup_vq_resources(ndev, true); + if (err) { + mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); + goto err_driver; + } } } else { mlx5_vdpa_warn(mvdev, "did not expect DRIVER_OK to be cleared\n"); @@ -3142,6 +3150,7 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) if (mlx5_vdpa_create_dma_mr(mvdev)) mlx5_vdpa_warn(mvdev, "create MR failed\n"); } + setup_vq_resources(ndev, false); up_write(&ndev->reslock); return 0; @@ -3835,8 +3844,23 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, goto err_reg; mgtdev->ndev = ndev; + + /* The VQs might have been pre-created during device register. + * This happens when virtio_vdpa is loaded before the vdpa device is added. + */ + if (!ndev->setup) + return 0; + + down_write(&ndev->reslock); + err = setup_vq_resources(ndev, false); + up_write(&ndev->reslock); + if (err) + goto err_setup_vq_res; + return 0; +err_setup_vq_res: + _vdpa_unregister_device(&mvdev->vdev); err_reg: destroy_workqueue(mvdev->wq); err_res2: @@ -3862,6 +3886,11 @@ static void mlx5_vdpa_dev_del(struct vdpa_mgmt_dev *v_mdev, struct vdpa_device * unregister_link_notifier(ndev); _vdpa_unregister_device(dev); + + down_write(&ndev->reslock); + teardown_vq_resources(ndev); + up_write(&ndev->reslock); + wq = mvdev->wq; mvdev->wq = NULL; destroy_workqueue(wq); From patchwork Mon Jul 8 12:00:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2045.outbound.protection.outlook.com [40.107.101.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3123A149DE1; Mon, 8 Jul 2024 12:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440174; cv=fail; b=NJZPgxphCIZcPmpIFDMPonxs/imcb4rQmm13+LU7nGLtZTKdAxZFkeG8qN2o/rY0Pic3Lwor/IGK+iE4uLIe8Cgno8vpNZqB89qqao3Cm1p/wGatNcRB9WWViL4xDrJXTVAJ/wzzCvD9YMiczeCnApo7z04IGPqfWFHzb4U81qU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440174; c=relaxed/simple; bh=VVba3WJNyqIgjvXf60/c2if3Q5Lp4uClbknO9ar1Qo0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=rIOr7y1djOhobteK/qhjgeZA188y9nO8/V4/7DrnSNXT2nygqqzDSlR6imxYa7G25j+tXa5jGv5ntfJF2XBO5z9dUapxjziVG2j5ELc4sf468qkiuiR0wNolxj6MtfpfwSiTDIbdWSa5xDZ3y4zxX8Rq2UeVY3uLtPC3AdsQuUY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=I8R879Ln; arc=fail smtp.client-ip=40.107.101.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="I8R879Ln" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PZrMBOHLtShs3+IwjY6rVRaFXZle59lhQwG7MIx0pS4Wk7XUbL0R2PpZRMABY5rqQTheE3+FT71MKiOdfxrYyboQdfNaB1y0BBKOqxoVW90ABxeCqC0lxlYzc6VoYcLXb4/4fHqSQRARmX3ak/sxfckbCTiHzR06ZcNCU4CjqX+EWRhBFKP6uSt5g+epzqV1Eo0SOwLdYZzo/I0skQ1jUPwi14DKOAZCufBQQoPX2qbJy5GkAf/Da1la3yi2U/A5l9wb7ZW8R7RjeEWcUVLAopG97z1tbcLGI91B4Fo1upWao758Dt26G2Bah4FnTE7Ciq/MQiu/k4Uy9VDwime7TQ== 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=d744AQIa8qD4HFaUiluJz+0c5xz0K4Odi0KHT3LCh3k=; b=d3Zyoe0J87T15Ze3bVtOh6W2GJQ47k5ZgF980/gO3wbTGzJPQHrpwh0bAgtUasH6D2JbxQzj6PqcoAWSGzKrYydy1+U5l4+6onXycSkAfvDmGI8Xi8ZHFfkH7aqn/noNqJ6PrgrpfbucGI68HQeAZLuB68PPfLK+xKfP8J7Q74VSXRAIMoPqoGkg2eFvVKbXT6yQgsmIYL7WNpwRn1rD6rNXZ8BG2Cc1oUrTCp4nWZBchegE9ez0c+s+pSOh1skeaNOiMKpwpYSW7Zb8ig3L7M+3NLBQ1ITvLehWdu81HpjiKKiMP/CIBsPf2y/WRd2z5XLmJMnvisC3oy4p5/k65A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=d744AQIa8qD4HFaUiluJz+0c5xz0K4Odi0KHT3LCh3k=; b=I8R879LnisQ5jL6b3K5WoQjAYCqt7r6cAqMcqiJnZ7XIEoAo7pQeOzXQEa7KsnlDGFwM3W5zu3isNuc3V0UWQsjYteksf4jyYSvkEFhWn/ve3SmuRgvenxumanIMCvHxdyDwznOJ61WHfPoKtkAnOxB1WFn8EvItPdjxvH8DG9iY1EGsJoCRGixNtr0PVmho1iTV4/jsCx/85c4dpkpOFm6j21LEu2KjvGVbBqtOAk8AdZLHJE5EPCq/qNJTpx0AkCgeWdhGwdnDilz86b3QXWTs04rnRW4Z7X1dNtgMpvjzpPVLQRgGZ5U4si5027fIKc3zQFDIcIh6rqTBIVV9mQ== Received: from MN2PR01CA0008.prod.exchangelabs.com (2603:10b6:208:10c::21) by SJ2PR12MB9006.namprd12.prod.outlook.com (2603:10b6:a03:540::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:49 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:10c:cafe::f4) by MN2PR01CA0008.outlook.office365.com (2603:10b6:208:10c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 12:02:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:49 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:28 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:27 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:02:24 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:46 +0300 Subject: [PATCH vhost v3 22/24] vdpa/mlx5: Re-create HW VQs under certain conditions Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-22-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|SJ2PR12MB9006:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bea8bc6-f8d8-4869-55f9-08dc9f45e351 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|7416014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+x3YciupFy3pIle9EBulSGqZxDEaIJ9?= =?utf-8?q?HSi/BCoFjPVtmHGwmKvUhzWlYrygiV/ygRkN4VxHm7rx7fLFhJe9fcF6J29WPN4FT?= =?utf-8?q?BDlzmAXXenpWE/VaQcgP8HmEQme13sjZV3JzeMlgjbLlIzWsqIrX0OnZ/+IboknKF?= =?utf-8?q?jKZ2/NpMurdEzOiSsrQCzJq6qtB+vmllbf4TPSL8rzsoMD4c8fpSGB/aReq4Ati/s?= =?utf-8?q?x64B1sTOfFLcrblKMThgPXuyQfSUiVNQ4XI4tsg1jt8wHqTBp5/LJTWYe0SXYTNgf?= =?utf-8?q?K8yBHqnLA3rB2tVVGOXM1Bk8NOJGsEOoEp2vadCZxt0CWmyAefVVJhRkgiqUlbgKD?= =?utf-8?q?V3/vdfuHCEa25Gel7E09ZaYYSoAvJnWNjgbt5HLAcb5lQPhMZDQCcOcPUYRnoIUl3?= =?utf-8?q?rKmixpsjZXGzRkGfC7Zlzt+zpYFP4Ki49sTniEcaQ5XIZtaL/fP3NxKSZ+Vo4aOls?= =?utf-8?q?CZBLcEIowS7IxcATitup5bQdt/1lJNrSYgwWY8bPIvEkvQ1SRgl9u1wfb9Id1LnwC?= =?utf-8?q?L1MamT+fJerAizB+H68pBG0btukeXYSI2U9LfMl4HhT4H+iFd53+GxZSAciHb1Q7X?= =?utf-8?q?lodxDqtf+O6Yvc2iSVj45c1ieSXozfCg20rrf5jkFs4zhlF0O4XFuZ4m56/xJ8a+P?= =?utf-8?q?L2YI55A1hz+JFApqL8CxNCYQC9cRzeCfGhT2mT7FG3iAsbhu8B7fBzM2iv4KN/4/u?= =?utf-8?q?8r+fGABOc0MDYqbkr9mBqg2PNN10ZERqnjrPb5Fuvlg07ba0bh1g45RR8cIJQfY9u?= =?utf-8?q?1z4uLgzbl9R3Wufq0cnv+nn4SvONqyRdPQaMeKr1GCCcc/z2rgHgWGPDzBMGbFKlp?= =?utf-8?q?iLkoMYGvPyl5Ah5p4pVMSZBryXhnCucXCffpSoCDCNgvXEmVeiI2wq5M+dn7lpH97?= =?utf-8?q?qNf05uvURqPt3MPN4noYpvxa5LoYxQlPaM+jODIFCMF57tgVuoaXVesvllIPABgi2?= =?utf-8?q?WTHTbAgJplHmOM9aax2DTTA11JcfwCHcUwW7hqlrItP1Cxc4OR8LlDiBXy7VZ1TvX?= =?utf-8?q?hjllbrb95+B/niJXlEFo/mTDwCGemLbXSvfzv/CqSf0nKgXO+O7JPe+NuptclCWYc?= =?utf-8?q?4NRvzOLQN9tSOLlD9SIm6ic4ZBeUuQNQC4lRxAm+XZHZ63LgYQAMq7KASWWantPbh?= =?utf-8?q?HjP+eqE6AJ28Gg1PCebVuLOC7jAhLdEhmT9vWoF5lBEwAyxFlvQs3pICTFb5m1Nbl?= =?utf-8?q?2n4H7OiDuxpyMeujSn6iZVowJjtFwEEM3KC0k3PjJUwXudsrL8L7kwlrKRk1eGsGg?= =?utf-8?q?Q1qXYubkUEArBCn7zRQjQDozxBjVD4a0wMsqsYMYNcx+We4ZQVgTKqnTYnOe2uNGV?= =?utf-8?q?wcD7941D8cnpWAkflvTdq8Hj5i6zBLyVtsmGxREwSdc7tu62xNRKaXxQFjC3UvTHc?= =?utf-8?q?vlqxnYp6jea?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(376014)(7416014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:49.3211 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bea8bc6-f8d8-4869-55f9-08dc9f45e351 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9006 There are a few conditions under which the hardware VQs need a full teardown and setup: - VQ size changed to something else than default value. Hardware VQ size modification is not supported. - User turns off certain device features: mergeable buffers, checksum virtio 1.0 compliance. In these cases, the TIR and RQT need to be re-created. Add a needs_teardown configuration variable and set it when detecting the above scenarios. On next DRIVER_OK, the resources will be torn down first. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 15 +++++++++++++++ drivers/vdpa/mlx5/net/mlx5_vnet.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 1747f5607838..f2af0ba82dd2 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2390,6 +2390,7 @@ static void mlx5_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num) } mvq = &ndev->vqs[idx]; + ndev->needs_teardown = num != mvq->num_ent; mvq->num_ent = num; } @@ -2800,6 +2801,7 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); u64 old_features = mvdev->actual_features; + u64 diff_features; int err; print_features(mvdev, features, true); @@ -2822,6 +2824,14 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) } } + /* When below features diverge from initial device features, VQs need a full teardown. */ +#define NEEDS_TEARDOWN_MASK (BIT_ULL(VIRTIO_NET_F_MRG_RXBUF) | \ + BIT_ULL(VIRTIO_NET_F_CSUM) | \ + BIT_ULL(VIRTIO_F_VERSION_1)) + + diff_features = mvdev->mlx_features ^ mvdev->actual_features; + ndev->needs_teardown = !!(diff_features & NEEDS_TEARDOWN_MASK); + update_cvq_info(mvdev); return err; } @@ -3038,6 +3048,7 @@ static void teardown_vq_resources(struct mlx5_vdpa_net *ndev) destroy_rqt(ndev); teardown_virtqueues(ndev); ndev->setup = false; + ndev->needs_teardown = false; } static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev) @@ -3078,6 +3089,10 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); + + if (ndev->needs_teardown) + teardown_vq_resources(ndev); + if (ndev->setup) { err = resume_vqs(ndev); if (err) { diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.h b/drivers/vdpa/mlx5/net/mlx5_vnet.h index 90b556a57971..00e79a7d0be8 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.h +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.h @@ -56,6 +56,7 @@ struct mlx5_vdpa_net { struct dentry *rx_dent; struct dentry *rx_table_dent; bool setup; + bool needs_teardown; u32 cur_num_vqs; u32 rqt_size; bool nb_registered; From patchwork Mon Jul 8 12:00:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726504 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2040.outbound.protection.outlook.com [40.107.223.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C97B80C13; Mon, 8 Jul 2024 12:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440194; cv=fail; b=c8L/nr2l5cUTqlNrkrgfLCp61BNvESX3ZM7sEoFw87mnk+73VWfvxWY9kH/y4aNEOnu5szW/mjrkPRwCheRac8Pvjtx/p9sEnUdbFbP0WU700VJ8+RouGBxs09MchRZ8n7MurB8LmI4zjCWfi8CqLvlRC1J7enIXj+NTjL4cPjo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440194; c=relaxed/simple; bh=WKsy69cp/tQAYU40famgaBl8AYbnVZi2GWGzRX/gcYY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=MuACevtMnXzKFK86Jo7z4rHXhOWiugYH4vR6KBgYFj9UhrqkWg/Ju1C/vC2qFTAl1HmLWX1a0/y9wAj06546q3ZC9fDrC2/EorkTcMqLe483BdJf8GiOyZ5E3PVQ3ATNOjx48hvNU69n9Rzazt+K7tFrXjMmvRDJSDvYUMfvALY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=anRLZWzu; arc=fail smtp.client-ip=40.107.223.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="anRLZWzu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lc37Oxu3Q2EescVXwJ2jzxj//Z23H7aHBL9deEvvAQa5LYsfe5f7PWLCuu000DdBwO4+80KYGob7Af1VWGZuIK3kl2T89tL5HZUESjGtT+WRztEo0AdpE9dDL76jD0aIIITQ12ZNywK6oZ0dSQNvfKceu9+mvWhcsqsdpKFD20BtHpbzHk2QJXpUGoIyHdYYEc1Kwvip0JwM635Z+tG8ABYwgM5CJIxQP/R5kNoJzuKgizCRt3mKbSeGcDGFPt3oNq5lXTJWhZTjVHEUvEdRGhcmW4eGWyoUyjRZVXBAbU+sA+g85PY/HItoFZmt8SWK6+bF95mcIulsn2WAvycRsg== 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=2NHhb2gHTPrQWmX8OpgjYueGZ9a3Y81tCMO6jIeAeqg=; b=XfQX+EezGT7ADDWMxR2uYe6ASDEYXmEEz5oFW6O3ScAdWL4laaUlUUW4WdtKUjatlobSj/ETc/2nmyZsGgap7IgwvBgjBdIqpI8OdwA/UCc4cwyBRhACV750uz9zDLcYdkEFJi3Nn+xI5GlvLHXC0CrkOLqfG9LRqCHS0SKvxRPg+gxBDtlz/ApCjrNRdHhRCNDTiPWIk+ZlJu1ZnZKb/EW/6xQij2LNwQfBCJTxAXX/vcTd7/T01oTvRYKv+2tCVOTPWajmtRkHZ2nzlwVKsb2RP8/WIgygt2Q2F7Ih1Al3bFDGnro28FvpKYWOZ9h6vFNqqXElKXaUE7Q44qEv4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=2NHhb2gHTPrQWmX8OpgjYueGZ9a3Y81tCMO6jIeAeqg=; b=anRLZWzuF9MJ+MidReERHWkQAJ2jI8rGJyte5yGG5hmoNLG9kfbEGGhL/Df+jEsm2tmvNJYGDD9eUPV1rfICbi+RnYvd24/CzTUnrSGcsGZUEx4QApU4TSzomeoIa/YGj082Re7M6ZfLEsJRnPvcA4fd5n8Bxpo/mcptD3iW8jV0iyrdXq+GfDValpPkL+4tnauit8gRDb9CgPPubnPvfZcSehSd/VE2R3nPLelhnPNS0VHYRcz8eUg6tSTAWiNxyDUGk85c44+mO861YS3AmJc6ZNU+GQBEZLudY6ZS10OsBGHz1me/duix/50n/2evwaaLMK8VdkupMkMa4BQGXw== Received: from PH8PR22CA0012.namprd22.prod.outlook.com (2603:10b6:510:2d1::8) by PH0PR12MB7095.namprd12.prod.outlook.com (2603:10b6:510:21d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:03:09 +0000 Received: from SA2PEPF000015CB.namprd03.prod.outlook.com (2603:10b6:510:2d1:cafe::9f) by PH8PR22CA0012.outlook.office365.com (2603:10b6:510:2d1::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 12:03:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SA2PEPF000015CB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:03:09 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:32 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:31 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:02:28 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:47 +0300 Subject: [PATCH vhost v3 23/24] vdpa/mlx5: Don't reset VQs more than necessary Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-23-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015CB:EE_|PH0PR12MB7095:EE_ X-MS-Office365-Filtering-Correlation-Id: b3372913-68b5-4557-81b8-08dc9f45ef6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|7416014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?bVcbSwnagUOIoZZqKDyOU2rrPGpKUKu?= =?utf-8?q?2u58uPuW81eeXTxtbL/J9QB/UzapVoQegPuu9ilmQQ6XkLMbkrDEbuvvDfYiwzSXO?= =?utf-8?q?DhBrRt9911Jc2CVEc/4bTlhgWjIiPz/1W5vUoL5V+h5E/la8VI53iMzYRClRVlQYM?= =?utf-8?q?c+xuxISI4LEEzNjhgvvAa1K/KEmVDDCVFtvwaqZAV84Di82CfYm9cmekNkwMAUMMv?= =?utf-8?q?Ixn7p5zotU66XM0SFuCtXKqjbiOSIdOkXbXKOK19pA2Eazt4CNin9quwPeX10eM9j?= =?utf-8?q?TTN7SrRKUUkSQ5xmcRAuxMAuveXUuNmerjSPFR0w0lrvVCDHQ7oiix/oiTJCIL4Sk?= =?utf-8?q?I59893CtRgCgrrrcjA/G4IEgR9aX5Fj2PEKeBoXawcIiqOrF1kH1jK3OLkgoFt8lx?= =?utf-8?q?z00MMjGto8uiau4tyhkFW+1fHu7q0wmXJS2JW/B88gAqSc01YWokGpBCxqL4ap+ze?= =?utf-8?q?WfEa6z7wh9L4WbrDyou7SnJktaznF91Vc5m6eq6znUa2RgCDgfWWvMrDcaQRBs/oo?= =?utf-8?q?m6X+d46UVe5/3C3G/njdmHY3NGckJMGwfczRvmTES0swa7B4jliKZhNhmEkez+8Xm?= =?utf-8?q?gULd9/2w9YPJeviwbTNYWhWJ2FsDfIsJy8WCDLbmfVcfduoxnLgavLhckulyEOYJ2?= =?utf-8?q?Sy392dB7sSEV6GruGmocOAVdczosPsEZp7mcJaUd9A/dNJo42yqKypx2XcbpI0m5F?= =?utf-8?q?tDBc6LAoqIMPxXujqHqRFjaMBiPArPjGLTK5Y4fzkS5tWIwzOze5GnIqShVQTWkpu?= =?utf-8?q?5PubMdfw4QpbDYmXjd3RIx+mbrt/aHkcUnbOnAOdz172JiRWmPUcpQBmxFvx5TpY4?= =?utf-8?q?GAiyqZYOR5bzZPW5Qj7r9n+D4SWdgxBj6As31nLsH3Z3JZfvIb4xuAEQgo+ZhEae+?= =?utf-8?q?jg02CKPuY2SWEjqm2vecj6DbrCciSX2JZf8g7L11uk3F/ce+71wrv5VrQ8tTxNdoQ?= =?utf-8?q?Azr3fdAHWwlSBXvLLXysy0XW3+FZQshpK3m+T+G74lPyvpGOXFNJnHn20fKGCDkVN?= =?utf-8?q?PNjpSTe4x3Ob0qUZ+/uYT1T6B0/TwD7nXOqvkg6KshEgEkdXGeLwMRkiokuLNkavt?= =?utf-8?q?5f6AhgGXbVTz6qXuMUK53s/PffqeLFhuEMfXf9qjfp/TxWrE0t+OjKtuqKgdSxhjP?= =?utf-8?q?ZpOYl//e0dhApc9mgwV38kmFzzFxk4a7zyO5evJOvL1psOf7GXC7iopIq/S+SK+hO?= =?utf-8?q?61T18ko1B8NUZ+lIJythK3tICgXKH4eXRXbJ4HyQFCZlFHMrOMBTkb0PRlddJMXSq?= =?utf-8?q?4XjQ8KIpfuE7oM3qP9D49bDki8xqkrLfNd0zyxoeUAIVBO5bIzYlR4z9haPyr7ed0?= =?utf-8?q?gk68tc9Ay4A9npH3589/4C1ICtjQFfd1EkM017LwVzxa4zolrV9GsFpu5wLwZguNf?= =?utf-8?q?k5F2d37/+rT?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(376014)(7416014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:03:09.6852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3372913-68b5-4557-81b8-08dc9f45ef6d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015CB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7095 The vdpa device can be reset many times in sequence without any significant state changes in between. Previously this was not a problem: VQs were torn down only on first reset. But after VQ pre-creation was introduced, each reset will delete and re-create the hardware VQs and their associated resources. To solve this problem, avoid resetting hardware VQs if the VQs are still in a blank state. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index f2af0ba82dd2..4e464a22381b 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -3134,18 +3134,41 @@ static void init_group_to_asid_map(struct mlx5_vdpa_dev *mvdev) mvdev->group2asid[i] = 0; } +static bool needs_vqs_reset(const struct mlx5_vdpa_dev *mvdev) +{ + struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[0]; + + if (mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK) + return true; + + if (mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT) + return true; + + return mvq->modified_fields & ( + MLX5_VIRTQ_MODIFY_MASK_STATE | + MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS | + MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX | + MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX + ); +} + static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + bool vq_reset; print_status(mvdev, 0, true); mlx5_vdpa_info(mvdev, "performing device reset\n"); down_write(&ndev->reslock); unregister_link_notifier(ndev); - teardown_vq_resources(ndev); - mvqs_set_defaults(ndev); + vq_reset = needs_vqs_reset(mvdev); + if (vq_reset) { + teardown_vq_resources(ndev); + mvqs_set_defaults(ndev); + } if (flags & VDPA_RESET_F_CLEAN_MAP) mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); @@ -3165,7 +3188,8 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) if (mlx5_vdpa_create_dma_mr(mvdev)) mlx5_vdpa_warn(mvdev, "create MR failed\n"); } - setup_vq_resources(ndev, false); + if (vq_reset) + setup_vq_resources(ndev, false); up_write(&ndev->reslock); return 0; From patchwork Mon Jul 8 12:00:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726502 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2080.outbound.protection.outlook.com [40.107.223.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B53D514D2A3; Mon, 8 Jul 2024 12:02:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440181; cv=fail; b=o/ZWxikE/Sus8vNZ5yEtEyJlizxHrbBcuN3c1D5I01SvpTqCHrKDc/MnRRdvOti3IFw+C21NVLMgdjtwHs+0YerXGIsYH6cluPvb0GC1b2iuF1s8FwJ0zl/3Yry/9YW+KDhhij/Fs799pw9qjL4bWHCDCtfSffdcKIBV3TgR+NA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440181; c=relaxed/simple; bh=A5VrFzTMxPT0EgZnn+WGlbgID/a3a77z+U7WttivrBw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ewtbQ9BR04Jlv2Mg1/zny1bguLSfYSulAmXGxww1QKQhZEdusrpLniuBi1jnMxa3zHKDElW2dAIaf+w4OSQ3ou48PavSnJB2Nh8Si1Oi1v5zgrYnHDtzASZDpaSl7LPxNrJ6cCBwlxpq7fwy9KkgPS3F3l+BZoYvF6262Hi36ng= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=fd2xfHsO; arc=fail smtp.client-ip=40.107.223.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="fd2xfHsO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZZFvIAdoYcsZaq4CtIfrgvC/UKS5MzlV4tj4ltWdc/YPf00hQJoHJRi16eqxeuhJC9RM9c81ID44dabHEPWxlkL3yJy/4EoWTZRu8+YwoPEbrUfWZZKSDhIDba6YHYlz9mEacTo1XyIbzj5iFmxbHxYz/Q1UzpNg/MbMFgJ1kstwTXSfNstswjOWVQI7i2/RteqOAAIaTws1GC4dtgzv3llSV2FidEFqptUL3kISAfTVnySKCXm3shgCwUNheiR0NABFd3kwurLHqWPftYM2MvNxcBpSFwgxZT4RY7Ey/zgJkiMSnp9xTXVZk6Vp2rFNq7fOI9fX5nLsM2DJugfZoA== 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=9Q6lmaZBID6zQ2E9GNyKHsYArsrVBmSblcaZV7VcHDo=; b=BpImp1B0POFI/+nyBWkw5ewncqEmrhZGZf24uXobayjVMm+9jKjBeHUm/jPFgXgccMIg0kQk636PyH2onXUjXv+jdaBrX6VPZuZFpt4KKdLdYuX2oEqaAs7ArMroZzEBS6dPDmE2KO72ea7zZLggBp3aatXT2cLeqoibnyQGMM2/XqcF9NpIpUuiQpnXxF5ZjMPZHYTbbrEiSBEeKR9WBMhzBOvvHTOh0WF+Mr7pZDWJquqB7WMoqyMrald+8B2Emj6i3vAQ9P8eaYsFllkKuMdrCbRrhQgFTkzuwNMauKaC81LA6y8gZoZo5SivxEd/A7bUP0wH2xn8Zw4+ebCenw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=oracle.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=9Q6lmaZBID6zQ2E9GNyKHsYArsrVBmSblcaZV7VcHDo=; b=fd2xfHsOOiEDtYDNSptOz80Ihl8ToTSSC4+Lp2sARiCCYZ/DAPHyWm+/09o2C7410yQtqFKRtF9/OjnaPpITgUrv7Y3lPMcvMXJJZDF0yRTvEYsM1RQfeVZEtYgjVhRMAc01tx2rtZ6Kpln4SITZ6q7HTRPNjUkVu4MQnEVUaBNm6XSE4psWJGUrv5t5Q9NKRRaBeUlNevMA+kV3dQy5/14SOhi8r2e3NVzl51MMoAVFtV09OUROnhwDF8mfe0HpkTja9jcZ3DBoXf8sT89CQUJv/1Db31WjQs7VjbzTm5e7+qot5C09l+adkM3cHS1Vshn44ZrJvIWEPBW9ZugYig== Received: from MN2PR01CA0016.prod.exchangelabs.com (2603:10b6:208:10c::29) by DS7PR12MB5767.namprd12.prod.outlook.com (2603:10b6:8:76::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.42; Mon, 8 Jul 2024 12:02:55 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:10c:cafe::8e) by MN2PR01CA0016.outlook.office365.com (2603:10b6:208:10c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.34 via Frontend Transport; Mon, 8 Jul 2024 12:02:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:55 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:35 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:02:35 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:02:32 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:48 +0300 Subject: [PATCH vhost v3 24/24] vdpa/mlx5: Don't enable non-active VQs in .set_vq_ready() Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-24-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|DS7PR12MB5767:EE_ X-MS-Office365-Filtering-Correlation-Id: a759b9cf-1057-4fc8-7a05-08dc9f45e6e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?u4WKsDuqS1g/phedxM05H1NlN7Fqg2p?= =?utf-8?q?TX04FtmGqdY/oZEPCcZuuSA2e86YnaLsuWZmFAKdsmX/8/aiEiaUs2VLtIz0l2NAN?= =?utf-8?q?H4PeYWG9HN4t8F6wd/5mAQW9AO6tlwFKjNs6qf3pEqmCUVM7NEt/KbK8csoL8grEJ?= =?utf-8?q?E7JSQyTDPOie/oKkmCZTUmig600N2l9m6UbcF8o0HevfoBhtcWTrmKPV7+tmTGhBs?= =?utf-8?q?DX42/f/L2vZwjY4d46noaRuuEFZMA7xSWemmu6vvAVQyZyjwVU9PepzdEPWtNCtlz?= =?utf-8?q?a+3hAFL+Yaovft7LUx5GNHhIY710N7KNF7FvgyEwvxZHOsUVDqUoUSHfKtoPbSFnc?= =?utf-8?q?3nE8sv9CHrsCBzI+iMriC4EpFvPubFZOcsP5AgV9ehAQFdpYsqCtSns9ZBDevQh3U?= =?utf-8?q?4k5bfpXXpKiLY8A4c8o7LP996duUEevqrpyzNMB2/qGs4qE2OmAmbfHZRv8ZMQlQq?= =?utf-8?q?qG/yYE3Ua+hk128zUzdlCHHZ0Br2SF2oKqB3pljtoZ6zk8E6aVmzU8ATezzmJVfnC?= =?utf-8?q?6OSSCCXykTOwjgmFn5/5BBC4Zr14WO95nTAArJfEFogiYdeWrvWUfeUcHmau4vuim?= =?utf-8?q?MfJlnpAmjk4jAhg8Ln60F6IwnL+u6X5WOu+du7vJY2VALxCw4l6KSEhb+Ihew6RVO?= =?utf-8?q?f+vgGBp+OWe4jnpYhzVuGWvo4d7/U4m3sRQMUCUbeQutIV9O4pxBPXQuPOxdW+VjF?= =?utf-8?q?Mrhsi1SlZAHfLBvPkAx7LojG3pe9IuClDTD9J+JGGY8FuhqlSuIcRjqtvFFYeExoJ?= =?utf-8?q?chANA0boyRDm0Dn1vxwSv6lr7VA29O0LSAnpaAxx79XdkPlMck0ayXmWYHFzsChR7?= =?utf-8?q?XbF6nIyqLV20otKw+AcSlVhIEZqyKWMzqvi1yQ9vQ2bLRUtbNfMO/RI5wY7KODSeC?= =?utf-8?q?fLpppzjKjpVOUaL7uxeMg2TQbMo58Sbod/LeHI0HUaHqvgU3kvtcE7iFXclrzSAnP?= =?utf-8?q?wrOvHN3kJA3LKun/dY3LfNeqTlS/vm6Uk8R7MRte64CCFp1onn1v8au6/WLu4xc7S?= =?utf-8?q?t6aI/PbqoXlAPem4o2pwNDAQnpWMlnYmfIDwF2rGjhg9rL5JVvTrlNSOJbKYB/YU3?= =?utf-8?q?C57Q2egeHxLhm2K3cEPWI4jiezjhSfk7y/OOhDPkb4Vpmf5ovOPsRjYEwRvWMBjwQ?= =?utf-8?q?lcxgfiX7KhV6EtXt8B03AeqRIFOGsD4kU9c0Q61GNC+3xVhwnth4xtTwW1fmbcKJa?= =?utf-8?q?wLd40E6LFoLYoMrjgJstHkLZbK+VSaOkWSGkHUMwcHcnGeyFr5Tfb7ztol85jfgo2?= =?utf-8?q?k3fpu+zEmMy5X4Zpz29UGYRYiU8dIH1rD9UkTcwS30OARhK2trhR68RyFZ9UA5Fh8?= =?utf-8?q?gYEuyYJJi9b441si5hzuBFuJVvtnA14eb+Cs2XDngRmrzVpb1eufPMh465YcaHHFl?= =?utf-8?q?FFEhRvzkqfH?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:55.2898 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a759b9cf-1057-4fc8-7a05-08dc9f45e6e2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5767 VQ indices in the range [cur_num_qps, max_vqs) represent queues that have not yet been activated. .set_vq_ready should not activate these VQs. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 4e464a22381b..4557b2d29c02 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1575,6 +1575,9 @@ static int resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq if (!mvq->initialized) return 0; + if (mvq->index >= ndev->cur_num_vqs) + return 0; + switch (mvq->fw_state) { case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT: /* Due to a FW quirk we need to modify the VQ fields first then change state.