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 3DB78A034C; Thu, 24 Feb 2022 16:51:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EBC4842725; Thu, 24 Feb 2022 16:51:22 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id B21A9426FF; Thu, 24 Feb 2022 16:51:21 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZOYuTZL3qU1AAysZkbdV2ksbdNvx2mFRTk2G2pLrRRkmUTcEFfjTVhhQ8FBdQvsJQyN3qqYf5+xEqjQ7EcekwUPlTekHkcJLCpmzpEFadtZ271c6zW1aoYxkHn1Ddy83zLnM+mxkKN1VxWjEsKM4T1mp3nah9dYM4oLOBPeZK//LZrHxM7ZbtLgQ6XhbOMHOai1LbaZLNP+hXIzuEurvhiXdoYnu1CrCxvd8s2SHdpD7eAVwMl48DX29OwExa1EVjwd9g6rDfGVMaBW+09nThHrTDCXixoNha6J8hZ4v4GepvJIE/l2H5t+L8VuG8yeK22HV6MdHQFQTjOsIStHKNA== 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=gMdayAdoGaSfDfcBucSFUmJcxL92ahxtSl3KWS16B0aHslVd0Obf4SrhiSnyzaLRKOqypXKKlm32ITVlAWOambRgojqY/w/NUQqQ+1yqMSeqLSwIAtXZQJzXtqzY1ODs23puaGPGRZ5M9MH3ZnFemQ+sAKOhs9snV0VVvTjB5OBEus+a6Tg8J71aYL6LnlgQxj1fGw2aEGWELwxPhlv10tDBsFWkxoF9IEMMY3xZzZDCd0TXHLdV14F/4KrHYj14x9hwsv6TPoqbNdJ8LEPz/17CUbv4rU57cLtFflagMu66hGBP+U+QvYzzPCkaxfXY22mUB7lnpFUGpoaOql0nUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) 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=dRtRHjesAHgK+P19THwpRFVUjQcxLLdqHDJg1nvNVve62kUODsnixQDNDfBcvdO9qhIC1enthS9F9sF/aQg9wCnf7PbZCiIDDp6c9+r+uPGl0mcqqtOkywb0Snv8Tr5n52EFBGuUEqJrxXiAXca66By8f814gYJXH8E0M7BN9uRSpDfMIA1MAF8Omg9oR/E5PbOFIYprCTLz7YAWf5dNKy9TJrW9ztCjLCbZoYTW4k8NVhBLT0IxvL7U/4QjECB8PajRd0FSDBo6pYPBlJ2yG5FqpVAmRO3DpakIucEv1b3UK+iXrrJ6yXl5X9m6tiAJQz/PWqfJMJqzSTp44J3lPg== Received: from DM6PR13CA0010.namprd13.prod.outlook.com (2603:10b6:5:bc::23) by MWHPR12MB1582.namprd12.prod.outlook.com (2603:10b6:301:10::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Thu, 24 Feb 2022 15:51:19 +0000 Received: from DM6NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:5:bc:cafe::94) by DM6PR13CA0010.outlook.office365.com (2603:10b6:5:bc::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.9 via Frontend Transport; Thu, 24 Feb 2022 15:51:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by DM6NAM11FT067.mail.protection.outlook.com (10.13.172.76) 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 15:51:19 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 15:51:17 +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 07:51:15 -0800 From: Xueming Li To: CC: , , , "Matan Azrad" , Viacheslav Ovsiienko , Maxime Coquelin Subject: [PATCH v2 1/7] vdpa/mlx5: fix interrupt trash that leads to segment fault Date: Thu, 24 Feb 2022 23:50:55 +0800 Message-ID: <20220224155101.1991626-2-xuemingl@nvidia.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224155101.1991626-1-xuemingl@nvidia.com> References: <20220224132820.1939650-1-xuemingl@nvidia.com> <20220224155101.1991626-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: b5978597-4ae5-4575-af7c-08d9f7ad7fb3 X-MS-TrafficTypeDiagnostic: MWHPR12MB1582: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: qfNyXpP3+fJS/6fs6zMK444mP/3nvKOXKaaVpbIXLTKiVQYOjL09ciCtBd3LZ120H6JerbnTWVMTj06bKsNkpF+fwr28xO9DkU0YlpbJQ0EHl7AA6iZYchYdbYB8pTQYf/F4Zm7eyLRkzmE1yd99K6pMG4SVo2b6VeVqlwVXcUvLojFHENMSl241k/m2p7XEfD1BcelGNVSwv4sdR1GWAxykBXrIePPnS0MosgHNIyN/sBxF4sZh6kjXaVGOumtYcAh5GmT/G/gUIaJX8lLXQYjzPcp1jcUuTQKnb8ztVhXxIuIMlBSO3bPZZOVfuJ8dCJsh+1Y4RRkpObaRRO6qA/AGf5p36wRzbG8eVTeSvXke/k/wPzRzcuc8V8tEvTxclHpqFxqKj/wZM56L2wfePXGmSDBnn9PFuWDc2u9/2H64xAdBoS0FyFjSRKF7nvV1CH2XZEonlLzrhPmd6/XA5srlf+WxU5nFQiCZ4fdaEAzrHBZclHqoLLX/gImrNxqHjJu4FyXKH0oWS7uyA3plCIqhH0yzN8RJ0zgIgi5PvXCdvxe0TVojPHzPDbDsHdyQkZONAT3b3o3xD9cAYBSXX3O/9UG6nSWQ9lEHXI12PRtxWR/BICipkLXu/4+11dzQoZcVnMi1urr2JjjnULa4DI21jsym4xD5DFJMRVF6vHPVx/YHbD3PFdG9e3UAmpZVoOj53h198Eiz6So8Rp4Igg== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(2616005)(6286002)(1076003)(16526019)(5660300002)(26005)(426003)(82310400004)(186003)(336012)(8936002)(508600001)(40460700003)(86362001)(6666004)(7696005)(2906002)(6916009)(36756003)(356005)(4326008)(36860700001)(8676002)(316002)(70206006)(55016003)(70586007)(81166007)(83380400001)(54906003)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 15:51:19.2271 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5978597-4ae5-4575-af7c-08d9f7ad7fb3 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.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1582 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 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