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 BC91CA034D for ; 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 B8CAA4272A; Thu, 24 Feb 2022 16:51:26 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2049.outbound.protection.outlook.com [40.107.223.49]) by mails.dpdk.org (Postfix) with ESMTP id 055C942710; Thu, 24 Feb 2022 16:51:24 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hcnp5dZ6v0mjk6w7R3ZF2lcE99kmzd3OblO3Qo9dEUiv+XzlrPysb3teENgm9iiAf7U2//woAClT3oPJ1prXlONroV58wHlHiAgrmR+GOes73IGNAikw7xNqLg6PAGQvZGzDZuX+MDSrK26dekmhmx/VU6VsLj6Fm+pl5z6fq+hnxm6WFVufIFiCBKfVyMRCNeFP2IbJm1NjdK9caJkdA6NZVTY1BhPjISMbwOi7+zcGL6VRATFtVRN5oah9Dzma5N98rf4hoOfpP/KcJFzDeqANtw7Q+CBMidpGMf91LgSJfD6K9AQWDVT6wGpIb2plfhp9F7uKY6tKgA7xIoT4tQ== 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=Y3X1Micmw2ogm7YjoMr3+YpukD/7MXG8XrEtp7uqLxCkBvNGWrSeAoRmLsC8WQYhsxSL6fQAy+gdqQYrxwztNkBTkngdgH/6jMVUMD+8mXhywKEhIvL5CN2vR9+K1cvpNCsdSPMJMfHJrv88JFM4N8ZMq0utjE/H6Dza16HFNKsRbugSMKrLwCQlbkV0OU8/3UDA/7WknyW27qLDs+1hKn+LYXTedRdSrIvd3wkrhtIoEKKAbfBFCq3WXZzMmbiwU2ZRtG0QDqBQYanuiFvfFbTzVDuN6S2vPe+ggu/Eh9HV9pvC/qVF1nivSJDhlzzQi86XY9fYoq2ece8LVQNKCQ== 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=lrQRc6PY08XzlLHhONbwBNbqLbu6NNZ4dF8VZE269Ko=; b=igfRQQCK2BUMwNsc5HPnPE+GnT9TuR6Rd/jDrdMfUiVrPDfLyDK8heSo8Es0oMPuMKPzvREnTM16sdS1icF/rcG/N/nag4YimRLYsa/KfgljX/3LDHOoalSG7kTmR9B/e5bZkOwK+cC1WIZBcXGYLiIhGBFvMydsG3kwHCwlcqwSE3XLBZCNqqq7PG1bSNVvXatRLlVEgi49gKlcsf4opGlJoFBRAZx9pVh8XJ8Udd2Mqyy7KpYIERpEesqsKvGbqhDJl2W9GIEKf5g4cUKBU9y3ekwrTCLc6/v1CwUVFmKr8/Fi48DWJ9xaVjVq2jSR53wJN54IzuaabxtbyJjtOw== Received: from MWHPR14CA0071.namprd14.prod.outlook.com (2603:10b6:300:81::33) by MW5PR12MB5622.namprd12.prod.outlook.com (2603:10b6:303:198::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Thu, 24 Feb 2022 15:51:22 +0000 Received: from CO1NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:300:81:cafe::8f) by MWHPR14CA0071.outlook.office365.com (2603:10b6:300:81::33) 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 15:51:22 +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 CO1NAM11FT019.mail.protection.outlook.com (10.13.175.57) 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:22 +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 15:51:20 +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:18 -0800 From: Xueming Li To: CC: , , Matan Azrad , Viacheslav Ovsiienko , Maxime Coquelin Subject: [PATCH v2 2/7] vdpa/mlx5: fix dead loop when process interrupted Date: Thu, 24 Feb 2022 23:50:56 +0800 Message-ID: <20220224155101.1991626-3-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: 54323827-e32b-49c1-1c8c-08d9f7ad8177 X-MS-TrafficTypeDiagnostic: MW5PR12MB5622: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: fzj91bf8Mb53pT7lhu10uI5sId7qaP1xJ1ddkxWBLKPUBysaVTKBEg1UCwGfdTHR3eTH1TgTzP59EkahBjZ4GHRi1Rc28DUH76L0WZ5K1x9Bcl+2Bpex+nfq5AUttcW4jC5GI3dH//qpu5isnYj5/M1VwLTEpi4PFGDdfqTY8tM1njkvBYoFM9tjNpnE5H210cOH5LenPt1YRVgOI1zCLqjDJfz7NcB1umjSiGL8OOvB6mehmwaLYLlbaPvzZKmupVHmmTwzAxA0a8ymeyERz6DQlQMF3t/M8Lb6AFLYt1wq5XH8wA/G63ceiEBjdBlCVT2st8C0EXEu8k1W+OYF3NbDFc8j3MCI3FHqM/TZ6Sr1wvD6Fs3iGKzWbipWUeMnGRIQVZ2kOf1eXUJBz0I5o/Z+12hHPKtBFOZjIQZRP4BMRxaXAslTvUMVNcSmM2vY2SQSXvF8F4m4rK+RMVlWwNu/b8J/373I631ZOENY43oDu/clZg+P3eVjdhACV2d6eh4C8KLW1LdDZ119yzHV/YXIEQFVum/VYfNx2e1G74wAJNhzyOXdxXbc2nVeEVF2f/UanxCVgkfdTfhStahc8r01++as+vgTo05TuZIY7087NHx6eDyGilnRsQQ4Cyu1ssZAidX8TPckwZCs0GNGcVM8tNauLZhZvm1B+YDePEeUibr7udaT2+Qsck5HlEUabUwBGPrJHVdbsaJHxhaaAQ== 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)(36840700001)(40470700004)(46966006)(26005)(8676002)(7696005)(16526019)(6666004)(70206006)(36756003)(83380400001)(40460700003)(2906002)(426003)(336012)(186003)(55016003)(6286002)(2616005)(47076005)(1076003)(70586007)(86362001)(5660300002)(54906003)(508600001)(316002)(6916009)(4326008)(8936002)(82310400004)(356005)(81166007)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 15:51:22.2012 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54323827-e32b-49c1-1c8c-08d9f7ad8177 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: CO1NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5622 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