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 237F4A0351 for ; Thu, 24 Feb 2022 14:29:09 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EB8F426ED; Thu, 24 Feb 2022 14:29:09 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2081.outbound.protection.outlook.com [40.107.94.81]) by mails.dpdk.org (Postfix) with ESMTP id 601A44114D; Thu, 24 Feb 2022 14:29:06 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=njdUnDap4IatNziuabncsaUIS8jRLzl7mZs7mwC+IQXfFE53eaKO2kMIxaWp8j4ae8ECvnBhxkzY/S5J4dm8dECxOBleUN9GNZ6sZYc+M8qgwFouTGLhdJyNNO+VO/4ZkE/wSAEpY1U/iv82XYQLLh/T7YTpC13/d/uV0JehvWL3PMeQYjPddagBtur/jOusKs5VTsrtq2Buli6wLsF2KZvgFhdcYWuKJoVr4xsdjocdOQbN/MSkQgcpdZJcM0kSxT9vftqvpAGwaTIwbfWaFQqK7I5jKgTGL2pPWU+56MQxoSJvRTf0aTMyWc/nbXyBX9KVBrUoHV1Orbj/A4sTtA== 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=vlplyzhIxuG/Atpfl8B1f0BsyMqOLPadfvHXLb+bfP4=; b=Ej+c7cUlS6NagtvF54uuCxKm/wA/Y2O4DP5aIiaFuspSBrkDPZAnvESbGereHQucBeKiLLfAOZ4tVBj1zcHo3hTya0m+8juTWjGGkEmfRYzA8VEYHBXUnYOtlbeUuhmBKdZKAk/SH/56D/yOaCM3Shg6SaxJHdQaHkM0e84clmYMzculxYNy5mOtig9kX54DjWra9mFy6b+zWtTDzA48GYbd09xLZx1mjREThj7SxwSBZ7huJtoftvfDMZv44pouXltOjLub4GPczDdDYOK8zFFvvOfjG2XnFFuL/8NGoRODdd3fbvq7lHP/KAPNgFmhdIHA7ICKAm4K//OGasTr0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=redhat.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 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=vlplyzhIxuG/Atpfl8B1f0BsyMqOLPadfvHXLb+bfP4=; b=HXDv+lwh4W+S/rTznVr2p5qdRnOb5499/TPCQX7OqOqrUuROz4/5PrhRRpk0TbVhc16ZHl0lz2vj9MbauX2kDNVMRj37L2fYyGsdEI/ZxoAh9Gw6yEqmOHpq0oHHdB/S1AgksaQUAE4LWRd/294mgzi4gPbImagZr9piZ9OWl2nTzBri4mi3LCyY6pE0BaxL5coRL7hX8aGoEhxiDuWroZxWv5drE/8zqoY/EPCUSP6+Xe7CVGZ2RunMW3MQlDPDEaQ40HXTp4JwzLYsLFkfP/hXEmeM1qaQBK/gI+NO208VZue+MgrUmBKIcelAh813n5cSQ1KZxrFWca9u3c+PTQ== Received: from DM6PR02CA0073.namprd02.prod.outlook.com (2603:10b6:5:1f4::14) by CY4PR12MB1461.namprd12.prod.outlook.com (2603:10b6:910:f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.24; Thu, 24 Feb 2022 13:29:04 +0000 Received: from DM6NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::a7) by DM6PR02CA0073.outlook.office365.com (2603:10b6:5:1f4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21 via Frontend Transport; Thu, 24 Feb 2022 13:29:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by DM6NAM11FT012.mail.protection.outlook.com (10.13.173.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Thu, 24 Feb 2022 13:29:04 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 13:29:02 +0000 Received: from nvidia.com (10.126.231.35) 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.986.9; Thu, 24 Feb 2022 05:28:58 -0800 From: Xueming Li To: CC: , , , "Matan Azrad" , Viacheslav Ovsiienko , Maxime Coquelin Subject: [PATCH 1/7] vdpa/mlx5: fix interrupt trash that leads to segment fault Date: Thu, 24 Feb 2022 21:28:14 +0800 Message-ID: <20220224132820.1939650-2-xuemingl@nvidia.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224132820.1939650-1-xuemingl@nvidia.com> References: <20220224132820.1939650-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d89bc01b-f45e-40be-7f59-08d9f799a060 X-MS-TrafficTypeDiagnostic: CY4PR12MB1461:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +AJ3auKwDNXjTxiYd3LxWRoXoRjA9bj2P94BHZ3iVtHFy9UupXyUvidvpRCfBUKGljCT2uMwZLC4dW38um03Fd2xmhy/EM8ejtYNmynZoAAsSLawybSohjSaU4TqmjesWgLvviIMqxGBtJBxXId6m1EXqx9PaKzKFuR3CpWJrFca4kcbEuezvmnMLDC9idM4H5FFg0hRO0oGuowIjNU4logI9IUt0LSwGodIhd8UgIB32MQgCWBsrCT/9DM0ZxDziu0hkm00Upex0aQckluw4tltjvNPKGxp9znui0trjQ1WjU9+klEcCSnQ8NHJirC0KMXRqk2ODTyzKD9nWZN8BkNZJaQE4ZPNujvvF0jnYuOmRaBgXP1boh9Ft2mDol2Gd0ogIFIgyiHju9rHNhnpeZ98BJ6IQp4h3Wels6i4r7gGWEGj1AFsPHyAt6hbo7RGwNUZb+QRPe3uDhAR1d846+QJZwoqhbcndJ7txuSvSrMuizaT80Z5WTkGQEJnqsB+yTauODKNiyY42Q6voZ4nmYIgdG9UHzRsYACoH4mjXF2L+LjxjQ70XjmoGCzK2gSe3kuidGhfWukieCA1aopDI7ErhHn99JM/Q+f4fnVOgUrmg8yd9Za0vaXf4q5oDXql9m2yrtrMuqZj/6scsezHXf2YN3P/L+jF7RKVnSspO2rCV2cEiGZrkAt8kMFPnk5awI6UaDIHJY2UoE+1nKVATA== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(6916009)(6286002)(8936002)(186003)(356005)(81166007)(16526019)(82310400004)(26005)(54906003)(4326008)(8676002)(70206006)(70586007)(1076003)(508600001)(316002)(5660300002)(2906002)(2616005)(83380400001)(36756003)(47076005)(86362001)(55016003)(36860700001)(6666004)(426003)(336012)(7696005)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 13:29:04.0184 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d89bc01b-f45e-40be-7f59-08d9f799a060 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1461 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Disable interrupt unregister timeout to avoid invalid FD caused interrupt thread segment fault. Fixes: 62c813706e41 ("vdpa/mlx5: map doorbell") Cc: matan@mellanox.com Cc: stable@dpdk.org Signed-off-by: Xueming Li --- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index 3416797d289..de324506cb9 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -17,7 +17,7 @@ static void -mlx5_vdpa_virtq_handler(void *cb_arg) +mlx5_vdpa_virtq_kick_handler(void *cb_arg) { struct mlx5_vdpa_virtq *virtq = cb_arg; struct mlx5_vdpa_priv *priv = virtq->priv; @@ -59,20 +59,16 @@ static int mlx5_vdpa_virtq_unset(struct mlx5_vdpa_virtq *virtq) { unsigned int i; - int retries = MLX5_VDPA_INTR_RETRIES; int ret = -EAGAIN; - if (rte_intr_fd_get(virtq->intr_handle) != -1) { - while (retries-- && ret == -EAGAIN) { + if (rte_intr_fd_get(virtq->intr_handle) >= 0) { + while (ret == -EAGAIN) { ret = rte_intr_callback_unregister(virtq->intr_handle, - mlx5_vdpa_virtq_handler, - virtq); + mlx5_vdpa_virtq_kick_handler, virtq); if (ret == -EAGAIN) { - DRV_LOG(DEBUG, "Try again to unregister fd %d " - "of virtq %d interrupt, retries = %d.", - rte_intr_fd_get(virtq->intr_handle), - (int)virtq->index, retries); - + DRV_LOG(DEBUG, "Try again to unregister fd %d of virtq %hu interrupt", + rte_intr_fd_get(virtq->intr_handle), + (int)virtq->index); usleep(MLX5_VDPA_INTR_RETRIES_USEC); } } @@ -359,7 +355,7 @@ mlx5_vdpa_virtq_setup(struct mlx5_vdpa_priv *priv, int index) goto error; if (rte_intr_callback_register(virtq->intr_handle, - mlx5_vdpa_virtq_handler, + mlx5_vdpa_virtq_kick_handler, virtq)) { rte_intr_fd_set(virtq->intr_handle, -1); DRV_LOG(ERR, "Failed to register virtq %d interrupt.", -- 2.35.1