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 14E74A0510 for ; Sun, 8 May 2022 16:26:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F00D4282A; Sun, 8 May 2022 16:26:45 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2081.outbound.protection.outlook.com [40.107.243.81]) by mails.dpdk.org (Postfix) with ESMTP id 4378642827; Sun, 8 May 2022 16:26:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BT0LqPIhf+u5FnK2YqFN8I5ZfqPqxwZZGIqk4QA7sLLPL7sbTddQlIrI6HfvikDj+rBvhbLfJ40dpHJC2xe6TUyzkQQ8ZPHC8I2b79xjijHWJWLGP5urfsA8heYm4a8ghh9Uinu70VtZGUK834WC3nGsaRXRrnUbpdQG38rqNdxRQEt/jsrkJD7SkrSchu01irpLDTTjyCfL9xfXNR+Y1zp6zy5gj1LcQMZVr5YDn8MibYikHSPJaSyHnbjK8mEqLDi3e0Sh2hQaQYmEdXrrCYxfzp/d5lHP8XN8uAK4zRyKlBbtYQcCVkVqiAofh5UcE9jk0UaWHXNYMzGERSIk/A== 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=S573vHyI6PRRPWYhkuC2wa6q6aMb/Sva6p+FTJF0Qtc=; b=iRbPvha2obXkQTKE2oA4KFgg+CleObEbV/JOAntTPuZKMkXHQjAeRhtfcskwvHsKHQpAuOsGnAfvlzO0YoNVmKXkV6q6teDsbeZrgKGUXBiN2wm5eVRRmNfLYut145djzCZTqd+9xJEXmrLIU3s7CeVC4TCdOWW3pCtn1kGiV5kitEiiQc7PDueiZvfKFVda8yIVL5KkDMn0ZQaPv48EY3qkPrxWMKU3cCL1mkeK5hoGTHw0NLmCyS8nFosg7xawnp7SHlvwTA1MFAPoDmqJuMd3l74O3G8qalb9YPaFnwPG1AVijyRmr165sZWUQOh4WPSjaIaYoPHZgtfhQM43rw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=dpdk.org 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=S573vHyI6PRRPWYhkuC2wa6q6aMb/Sva6p+FTJF0Qtc=; b=O3vqnsvx1XcxSdhVZtjtrFqn2DHmdNlTC+gsAG0WSRO3aFxsDLrqx2MyCe/XPqTUoySqxbp33hZoBc/mGxI7vFoQpObYDNT/L2nEJTGaGyLuna2+6jpioD/ZpArufrUfhSRbF8Fg5JtxftjhOvcJYWe5bg5yoKYoba9t3M8+R1KdXMT7BEFEsESeX0Iea6TnHmCzkMrJI5ZH8q4t5L9OqkOleIURtXOpdrTdPmJoMGCW0OTsCrNZBeHjJdgCbNXbl8q+X9MCXXtlnFOgngz6FQJ2vRyXn6oUAE4QK2r9zyjZtch4b7CyDWOxwee+cMYQkSR1y6dlvL2Il/OB9b0IIg== Received: from DM6PR08CA0015.namprd08.prod.outlook.com (2603:10b6:5:80::28) by CY4PR1201MB0232.namprd12.prod.outlook.com (2603:10b6:910:21::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.25; Sun, 8 May 2022 14:26:40 +0000 Received: from DM6NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::13) by DM6PR08CA0015.outlook.office365.com (2603:10b6:5:80::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24 via Frontend Transport; Sun, 8 May 2022 14:26:40 +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 DM6NAM11FT010.mail.protection.outlook.com (10.13.172.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5227.15 via Frontend Transport; Sun, 8 May 2022 14:26:40 +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.32; Sun, 8 May 2022 14:26:39 +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.22; Sun, 8 May 2022 07:26:37 -0700 From: Xueming Li To: , Maxime Coquelin CC: , Subject: [PATCH v3 2/7] vdpa/mlx5: fix dead loop when process interrupted Date: Sun, 8 May 2022 17:25:49 +0300 Message-ID: <20220508142554.560354-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220508142554.560354-1-xuemingl@nvidia.com> References: <20220224132820.1939650-1-xuemingl@nvidia.com> <20220508142554.560354-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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2dfd398c-22bd-4576-ad3f-08da30fec499 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0232: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: /jIUxsIvHUIHBoEmuiCQfFUp3YhFYirnZN+XTBMfUU49OUc4pGE/PkQ7d1k1lORx/WeMAELQJC8AdtY2o/Gp+xHRSrUpgppwSS01b02/gsRPE98jAubnBKjiTLfDgZv4AG2mmVooqXgFSU056RPG0JbkVpORIG0+8jHbP0aUi9bRAkZRURev+0jbGu/oLIKz/I6JVjJhxZX0Dl/a5Kackyjn9hDGD7NgdY9Fn5DaHxt1tUlCbjITIskOJYD9cXW880KIdtrvVwuHKjlidRXDmOoC05hzEROPOPfh++Qt7ht9ZRMRD/U74gaKgmajJPhT9FYP2JS7Z0LloFtnAkquhor2qUd1Ju6Gv7wB34Erml9h6Z/IkVxCj36n1iMuTCzLzty+L4hAnMkUEW8lA6nXYKe6xUCZjLjmxqsRJWsuy4LRPUU62fhtzz10vd8VHoi45zgVvSGoUz4IYx2xe5BOVpwCXQJDDRx+6caOyJBSHmVXXd40B5yBuRwvk7ArYEv7nWA+ZxgV1Q2L9HeP4ygERgIWRsWJ7T7I8474AEkfx+XW38cPCdZ9RSbsGhmy6NaE8f3Nv8aqEQjO1kJ3R6a8bi+1y6SF7EAC0oApuC+4TgJZSCJsTi7v48u0fYPAhZ4HummSooLu1Zb19ooZkD6NzvJ6/pJLh0oWYDjnMT7IchF08nxwpejx1c8NqeBznRu3CXsYSw1cWLNpyFi5PbEWOA== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(82310400005)(26005)(6286002)(83380400001)(16526019)(7696005)(6666004)(55016003)(40460700003)(47076005)(4326008)(70206006)(70586007)(316002)(54906003)(8676002)(36860700001)(110136005)(356005)(8936002)(81166007)(86362001)(5660300002)(508600001)(1076003)(186003)(2616005)(426003)(336012)(36756003)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 14:26:40.3328 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2dfd398c-22bd-4576-ad3f-08da30fec499 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: DM6NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0232 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 Reviewed-by: Maxime Coquelin --- 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 2e517beda24..2696d54b412 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