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 997E2A034E for ; Thu, 24 Feb 2022 15:38:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9140F4270D; Thu, 24 Feb 2022 15:38:30 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2085.outbound.protection.outlook.com [40.107.212.85]) by mails.dpdk.org (Postfix) with ESMTP id 84CE1426F3; Thu, 24 Feb 2022 15:38:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eVWGdBsdXqX4cgmXYVETVMbxHHtqF0qdW+l/KtD9plJAiMbupLMO7nSJwzRA9Q5RQ1p0K/VjWSC8r8+Uil5umx4ysP3pz1ISEjBkZb8L1xkynrcgGwM2zr+lVYgN9pY8hJBckEHbS0UW20uiF+WZW7mHns9F4lwVEjMAj9P4IznQO245d9noIctJPFl8S5/lnKW42kmsmIjvvJOtQt94hYE7oKMkx1DSanT6rq+Ag2Pk0jSLVv9ZCtU79TDyacE8mJ21hEGHwKvtP7mz+6KFiic0bbpTGv8gpAecLUZRLcQg59i2qCqiJLXIl+vv02cCowoRe1XOqLYG15uhV7Qphw== 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=b7chru1ryrh4iL/qO8LJnDvHvhF2LPY1wAGIAzkc5Hbi4SgvOwn7IZ6MIA/MuXYKbA1c2ZuejqUXB3jIle9TqL9Abb9VFuaC+W4ovjIfkUJ8N5dzTXPD9wOdCOBF21jMiQ0YIVdL76rPE9PI3cpWBKc1aZ4QLEdPfCEgv06K4gKXn1TocTdPd20/DIaK2XZ3ySGt46GhmwOpfq4yQK+Wujesi0vSPLyqWkDPOfY4Nwdj4D6XSeKRK7xkaG7hr+0vqxGLXXBpujb5+O5VSYoBD70Aor5jIqXEakeT28HvbmJvcdzzQySiwj3EL93kO+NdFg1FJyPI4rPct5ZIRX7ttQ== 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=HU2RjQ44jkRUditS/eSNu6GgVvvdvv98GKDRss58w9qETwWlffWxA9ijDshYc6haXcjqjvTpX70esbc6/pFFnHM0UWNp9yIbebTeMu5Emhu2XCAVAJnW+nIYLYXcSKEC+pzFU2GzRAZGnRefx2MGsYup/+zpa6/a2JGq+U1M1qgfhUwv2GpzyQ6oABmxNcpFh5yXOf2/5CU8oLA9pqEIzfq8qTQMqoPNbTaqkH8a6oXlTI+tmkuXnN2JQwAiNNRqxFTJPvStTE/N67E75lYqCv94MfKhQN7rOMA+parX0orGWfrQHfIfaiaRqNW7T2aHH7itAJyMCIDBS1tq6hLy+w== Received: from MWHPR04CA0036.namprd04.prod.outlook.com (2603:10b6:300:ee::22) by MWHPR1201MB0239.namprd12.prod.outlook.com (2603:10b6:301:50::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.23; Thu, 24 Feb 2022 14:38:26 +0000 Received: from CO1NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:300:ee:cafe::6f) by MWHPR04CA0036.outlook.office365.com (2603:10b6:300:ee::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.23 via Frontend Transport; Thu, 24 Feb 2022 14:38:26 +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 CO1NAM11FT063.mail.protection.outlook.com (10.13.175.37) 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 14:38:26 +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 14:38:25 +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 06:38:22 -0800 From: Xueming Li To: CC: , , Matan Azrad , Viacheslav Ovsiienko , Maxime Coquelin Subject: [PATCH v1 2/7] vdpa/mlx5: fix dead loop when process interrupted Date: Thu, 24 Feb 2022 22:38:04 +0800 Message-ID: <20220224143809.1977642-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224143809.1977642-1-xuemingl@nvidia.com> References: <20220224132820.1939650-1-xuemingl@nvidia.com> <20220224143809.1977642-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: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d3de28c7-9478-4ec9-4c6b-08d9f7a35171 X-MS-TrafficTypeDiagnostic: MWHPR1201MB0239: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: JBuU3B4NEDhxtmVcMimK55rNtS08WozK9H9lhIMXsdYK4gRPemiO84KXevfTO2rD146kV8sUMkUJee4QAlqz6tYAHMvOIEMl8SeqbyQKBXR3vkMIrVCQbwfMeaKX10GWTQvzZaYfi4vpzY6Hx9Iop+CAQSHzNSFfo2ANGKsbsDixLEn1hcyFfZLR4NHuYS0GOJvlbQwVg8TMOjUthVr8tjG35/d+Whlfz83VBpvg02JsX7ty5qioS3PaN4eQRzZh211w9CbIat5Pyx0ovw0iWOVV38oozC4w0CmshSStpqW7RgYSPKOkGMzfeW8q76pJ/ApxnUXaq2XyREhgtpH0w3QL8TiqpZHKm5HAYZLFQU6o+lXWF3t2lQFl0KuZ+K8O0AZtOyTknC/MSeRE0jslenK7W+G0Bm6owEGfIMEa4JTbXiCJ9Z/f3Wdju+aiQ3qAMFN4XsR4HEdz3189rnmjy4DRuWDmJMfVDZwPiv/DoPjoUc+f9RPtMzXjkNAHyK7e+HGqFyjgaXZJ5lWWu67Ma+T2HLABo/+/dSOUWd6KDhqgIimMuw7KoxnAY+RU7DcxMXvRZqOTvSZApEHJRj6v8KTj83zPKms+q2LOatkZwSQbZumGQRAkDkkvFNCArmb8s4sx7ZBSn9ImDRwnlSOi+I97eXXp/eBhOnf77U2sg0JzUnf4FWrGJmCHDFKDs8On7U5uvbyF4FVxQ7ZUFfnpTQ== 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)(36840700001)(40470700004)(46966006)(6916009)(54906003)(6666004)(508600001)(86362001)(336012)(6286002)(186003)(36756003)(1076003)(7696005)(83380400001)(2616005)(426003)(16526019)(5660300002)(316002)(26005)(8936002)(70206006)(82310400004)(356005)(81166007)(36860700001)(47076005)(2906002)(40460700003)(55016003)(8676002)(4326008)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 14:38:26.6495 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3de28c7-9478-4ec9-4c6b-08d9f7a35171 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: CO1NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0239 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