From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48E5DA0C41; Wed, 17 Nov 2021 16:48:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44F8040687; Wed, 17 Nov 2021 16:48:24 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2056.outbound.protection.outlook.com [40.107.92.56]) by mails.dpdk.org (Postfix) with ESMTP id 6CBF340040 for ; Wed, 17 Nov 2021 16:48:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AUuP8JcoX2b1Dw2HFSzD8D78PuMsf71/lSA2UbAOgFcj1n0pNX39UBXDRCD8jcgK6496tYYLWpEehbbkHow43B5LmLL5n9meJ6+gJvz3b4uCReBlPoNzJ8fwFKQRbvwxxVLRK94Kg+bU/OVlu9SU13AfrudfoyhoIsmzPKcN1sBwxzSD8FTaKXiKmp8D07UcLOTQWtqOXhfCFXbfJT70k/I3caVSoFsalPn2r0s60FDhVlJEXFoKapi0ZGx2J/uBGRCeRfCI8ePU6xjAAHgBg2UH5TJukQo+RSnshI11mbsDsFmosmxAjFhyTDcw3DuJtL9syonwbLc9GgAGR9H0eg== 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=vKBN2oiyf9+jon4jf+4M+USTxuVQVFdElCHp4d2t3AU=; b=gCKpIVuFmsi1414ng4yvMI/yrrzicGgZpYcRRrmGtGwLHOJXmMRob0dQjAIEteTdQyzuhfvGrTjUoEF8Ifpfq0FeudWAML4N+mnlv+EXcmhSzF6uCYlC1F5x5VbdwgIpD87GZHD1YtW1lHaW/RWyhFRf6M2/jNT/JWxRPZJxZlwNabCY6OFOKWBZP6VtVr2dtGU2+xX2HUgDK5yb+DIOVYWj5YD8Zf2GOYdVy4USG887Vmhxwrm7q7SwBjxduc5GKOPdfvxergLwbT8l03II1b105GqeZtMZMTBCFaobzpZYjgbhY1C+sQej3drMv32p7g/Jlhz5FEl7eOtQo3jfKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vKBN2oiyf9+jon4jf+4M+USTxuVQVFdElCHp4d2t3AU=; b=OmIV0D4bMCfYigT1nXcR84PnvgLFM+9pI9HCOT3Ujz14TkB0shnxPfpR1ziMtFO7p4Ia4zZARfMv4PZkM+fIafyr8YLxZA24RylAVhIGTXMqrY8NoNi7y2pQOUaYRpX/ZaopWlVDYiEqvQ9W6eGi/rTQ9/DB1XNO7Fmny11REpK/51s1qRV0x8vq506bZX9L2K5VevoD18n6E4VjYTOov1KC/LtKAWvhXOp33dNbVlvnftRgQXh9VBX+AzS9fWHHsRClzbg58VGI+f6bcdfXj9SlzxJ9l2JVnAKVQlsDkpLx9huDJbHtt5rvedRGVMGgs20O2mXkcArvtOP4NmxR0A== Received: from BN9PR03CA0343.namprd03.prod.outlook.com (2603:10b6:408:f6::18) by DM6PR12MB3289.namprd12.prod.outlook.com (2603:10b6:5:15d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 15:48:20 +0000 Received: from BN8NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f6:cafe::b6) by BN9PR03CA0343.outlook.office365.com (2603:10b6:408:f6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27 via Frontend Transport; Wed, 17 Nov 2021 15:48:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT031.mail.protection.outlook.com (10.13.177.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 17 Nov 2021 15:48:19 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 17 Nov 2021 15:48:14 +0000 From: Dariusz Sosnowski To: Matan Azrad , Viacheslav Ovsiienko , Dmitry Kozlyuk CC: Subject: [PATCH] net/mlx5: fix refcount on detached indirect action Date: Wed, 17 Nov 2021 17:46:05 +0200 Message-ID: <20211117154605.112390-1-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8d86d98-b1d7-4f06-371b-08d9a9e1ada8 X-MS-TrafficTypeDiagnostic: DM6PR12MB3289: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G/8Ufnw1oD+dVtxP05w7I7a5NgbfkvdyjupChyEp07fre/LGwVTZUEtgkDRsc9fAnmVDdpyDn3HfrLprwtm3DKUl/Ti+Ddnb6Rd/7c0Vy9sCy+uOTgjRgEuCfODNn13/+wkPnaIlYBtbzyiSv9ALYDRKc/vaYpYmY+spnelDgIN4JX1kOrKxHHgp5k63zRXiwNgoUwUX0e3gc43C+LY0tbSNRBhwZvcYruHeP8LqikPYGJa4o8rQFddWWOiP4lB42Zm4KNIF4Qt99yR/iWJxH8JAC8LgJgU8EoBt1k1g4yEjdSFgmgpxwFyb1WVsbpca2wr9QI2m3f3U4caTpr5JIRV6k0tJnyUfTjqCJuJqaS9NIW6OG1fCEibcEICH3BkcaaUBzDXVFLcHrTHEtEROnRty/7Jfgpl9MboftMtDQDXaIWHyT2gFU6NPS2sZLltnUAxlJvaWb4Nj7WDYXC90GL1q5PVGYOIJKpAbohh9Nmkn2Dz+5vQPjvv3FUiOaRYdm+HRbRY0yWDVIevs9/E2ktaFXishaai7HrLCOfhoiQ1IRltG8105onNuhQ7mzm32dV72b2+zlne+Kl54uRDtJz3WjNDgfA8MHPphZKVvS9FWQ4b3uuGuREfXBys6btV8ww2yzDVX6LB9ASYmRNS5tmls9dqHcw8FJZXnJr927lZfdZmNKCvfjuNUj6E9iquCDbiRAjC5JaMPGvks1gq4NQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(186003)(16526019)(70586007)(36860700001)(426003)(7696005)(1076003)(2906002)(82310400003)(26005)(110136005)(7636003)(508600001)(6286002)(55016002)(83380400001)(47076005)(356005)(86362001)(5660300002)(336012)(8676002)(8936002)(6636002)(70206006)(316002)(2616005)(36756003)(6666004)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 15:48:19.4175 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8d86d98-b1d7-4f06-371b-08d9a9e1ada8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3289 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch fixes segfault which was triggered when port, with indirect actions created, was closed. Segfault was occurring only when RTE_LIBRTE_MLX5_DEBUG was defined. It was caused by redundant decrement of RX queues refcount: - refcount was decremented when port was stopped and indirect actions were detached from RX queues (port stop), - refcount was decremented when indirect actions objects were destroyed (port close or destroying of indirect action). With this patch RX queues refcounts are decremented if and only if indirect actions object is detached or indirect actions object is destroyed. Fixes: ec4e11d41d12 ("net/mlx5: preserve indirect actions on restart") Cc: dkozlyuk@nvidia.com Signed-off-by: Dariusz Sosnowski Acked-by: Dmitry Kozlyuk --- drivers/net/mlx5/mlx5_rxq.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 52b95d7070..b7af60df38 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2214,8 +2214,15 @@ mlx5_ind_table_obj_release(struct rte_eth_dev *dev, if (ret) return 1; priv->obj_ops.ind_table_destroy(ind_tbl); - for (i = 0; i != ind_tbl->queues_n; ++i) - claim_nonzero(mlx5_rxq_deref(dev, ind_tbl->queues[i])); + /* + * Refcounts on RX queues are decremented if and only if indirection + * table was attached to RX queues. It will not be the case after + * calling mlx5_dev_stop. + */ + if (priv->dev_data->dev_started) { + for (i = 0; i != ind_tbl->queues_n; ++i) + claim_nonzero(mlx5_rxq_deref(dev, ind_tbl->queues[i])); + } mlx5_free(ind_tbl); return 0; } -- 2.25.1