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 2F3BCA0351 for ; Thu, 24 Feb 2022 14:29:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 281D6426F5; Thu, 24 Feb 2022 14:29:13 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2068.outbound.protection.outlook.com [40.107.92.68]) by mails.dpdk.org (Postfix) with ESMTP id 0A6144114D; Thu, 24 Feb 2022 14:29:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aze681QVZ4+KmNOG1lTkA2L9Bge0m2MMbOljudPHuT6zoDbWp0q3h21GHnoUXmAghDzTMSfCq3aoDL48WyQVxRIQAfzkA6gd6CBGydTN+TVlJXlch5cwuEysI7erMLS5D0rDfwHsNj5aN816H4HVAl+swbsJt53cq3brimSlIRxYe4ndGbeW+NNMg7kM8VEoieUJNFxs7l60fbq23etiLyLXdBapFE/mhh9JsYUPxfUoP1F/xC+hnF9HLcb28p5jpFL/7sZ7jQNCmb46bl8iQMr6kbp/sz0iMp/uuv4v2PUy09tPx7dy0ENgqgBY3m8/1kiVBMYqTG2MKqWqzUbqsA== 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=lrQRc6PY08XzlLHhONbwBNbqLbu6NNZ4dF8VZE269Ko=; b=AWOuIa9PIBm1LCoin0dKkjpVH25VL5KhT9ruLmyUBRZPq7X4CRYgJRPj3R2oq7rYxAqvuJk+KXRd4PQdacQVnaHSpGuDp/JbhdxcQi5dFQL792s53WDap4NNZnUQaDD4CxfCELrBZar5dOW/LYaLe2piSjXG99r2z5n+UAfi20+3WzaIufVB6Az2b/Gxz8G+t8FMWBTOGDkQoTt7oJ7qyH70RCHTp/62oHbEUnpDe/g2RRWa3Bs+3e7I0IqiI4jszKhGcDZYkwem70VPlruyl3QRLqZAnJzrB3AtF7n4IH9PSb73E+gy2tdJ82MDdLElq+X8c0HIdF4l43fEhRqzmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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=lrQRc6PY08XzlLHhONbwBNbqLbu6NNZ4dF8VZE269Ko=; b=uJpEz4LTIpGAMkxwbRO3dOJOMNRdqflirkqAPFAJQm620l5LNHGQ65SNC1kDvSGzuknYGXcwVkNm6/GchyZtsfSRmh9k0tSq9YsdFJqfczdX8J03zUggrtW5TNQmtX57BSUN+iMVa6IyaUoFP3eJz9yaNj0SJqdAHy1uQK+Qvo/e1ye2w2H5+mzST47fGMYSY7oWNwht5tD8lCSxtiHkDGtB9nfHiiYBFdza+YikehhouqTxr79lW7jjazkGP2QuAImL9pXBZqS6a5hsPAesy2uLZDKE/jPlAkpFTkT54UuSXYzQm79UJjTdb8MwbcGYX1DVUJwl16ExTZwHLKghBA== Received: from DM6PR06CA0018.namprd06.prod.outlook.com (2603:10b6:5:120::31) by BYAPR12MB2888.namprd12.prod.outlook.com (2603:10b6:a03:137::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.24; Thu, 24 Feb 2022 13:29:07 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::bc) by DM6PR06CA0018.outlook.office365.com (2603:10b6:5:120::31) 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:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) 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:06 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 13:29:05 +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:29:01 -0800 From: Xueming Li To: CC: , , Matan Azrad , Viacheslav Ovsiienko , Maxime Coquelin Subject: [PATCH 2/7] vdpa/mlx5: fix dead loop when process interrupted Date: Thu, 24 Feb 2022 21:28:15 +0800 Message-ID: <20220224132820.1939650-3-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: c29ab306-cc67-483d-cdda-08d9f799a1bd X-MS-TrafficTypeDiagnostic: BYAPR12MB2888: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: PdsbESwzL817xc4Dyt8bgg4qFy0XWb1+4KyeXkSLfJpJfptHV2f6T7Jt1cMehh98ShCaZT5d9gTZqVJdGrvs1dLqWxNQFaSHFrbQckprENMqadVTDN8eiaNkEwfGtrcTU7zzVeYjspLebxC99cd/7MZ8ct7XT2OW1Ino4to9PHbMMNJzJO6Wxaiht31yfD6FGrpNxn1f2vamXXNrDTC07+KHUtWbW0dmbe182czAUDn0c5EZJAQ/6TbzE8JkQrssAeDVGNv+5J8sVYSnSUMelW9RuvYkkhtJ6JjXKOthu00PJK+gI8Qn8mfPHX2Qr/psxnA1QcRPzSAkCMZLj80NqkBu8VEZLfFylm7xqhWWYsEDfaxr8FLq/oGKRA4dDyhrGKhIjrxoaxZDldHoMDsvfqrXkW8VkPBJNLxSHZQN9iWHBPGN3Ajt6J0fpQuWdNFzQdh42gpykRBI6TiCTPHzJ3/h0WNcb5C6aU/8V3Rk6TcO8csWrSuoJWQzyYsro0335eJPSGLJP2EFBGvWr44fryTs/qqRnHB0H47gDjGdh7vFcREAEiklDxhZSt3CzOLY5+txmX2yfuQc27y4qoS5oxCuT6AOP7NkGWnmpUwT5prQl/oXHYKAMoFpzTYwIGoQrH2htc4q2ngh+vdmdhOIf8ke+wyH8oXJuw0PZNnsUr4KiyTadSqUXiO83EmPLCL9FLoDzE6C9FoGDzr02Y3Ncg== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(2906002)(2616005)(4326008)(8936002)(70586007)(70206006)(81166007)(1076003)(54906003)(6916009)(26005)(356005)(8676002)(186003)(36756003)(5660300002)(316002)(40460700003)(36860700001)(55016003)(7696005)(83380400001)(336012)(6666004)(16526019)(86362001)(47076005)(6286002)(508600001)(426003)(82310400004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 13:29:06.4013 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c29ab306-cc67-483d-cdda-08d9f799a1bd 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.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2888 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 In Ctrl+C handling, sometimes kick handling thread gets endless EGAIN error and fall into dead lock. Kick happens frequently in real system due to busy traffic or retry mechanism. This patch simplifies kick firmware anyway and skip setting hardware notifier due to potential device error, notifier could be set in next successful kick request. Fixes: 62c813706e41 ("vdpa/mlx5: map doorbell") Cc: stable@dpdk.org Signed-off-by: Xueming Li --- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index de324506cb9..e1e05924a40 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -23,11 +23,11 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg) struct mlx5_vdpa_priv *priv = virtq->priv; uint64_t buf; int nbytes; + int retry; if (rte_intr_fd_get(virtq->intr_handle) < 0) return; - - do { + for (retry = 0; retry < 3; ++retry) { nbytes = read(rte_intr_fd_get(virtq->intr_handle), &buf, 8); if (nbytes < 0) { @@ -39,7 +39,9 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg) virtq->index, strerror(errno)); } break; - } while (1); + } + if (nbytes < 0) + return; rte_write32(virtq->index, priv->virtq_db_addr); if (virtq->notifier_state == MLX5_VDPA_NOTIFIER_STATE_DISABLED) { if (rte_vhost_host_notifier_ctrl(priv->vid, virtq->index, true)) -- 2.35.1