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 15A77A0351 for ; Thu, 24 Feb 2022 15:38:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 961BA4271D; Thu, 24 Feb 2022 15:38:31 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2063.outbound.protection.outlook.com [40.107.92.63]) by mails.dpdk.org (Postfix) with ESMTP id 0DEDF426F3; Thu, 24 Feb 2022 15:38:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E37jg7SjbN6jLZGwS0UsW5CpA8oDSr4xOxU7oLSUp74GWGO7g0hHjh2OMTF9sK/5jZtBBrQTddqS7p9WtYSoUgplOa31sHUCEOFVmHai1A6zJiY00G63MjnYoOJePLAeAgawYodaAmkdCMZnsydALXHrZinLGk7tlaEhd6pwEPm+HaNRCgvZ47NLXryBCGejv+N/Q5GfIGWCuNz7DU407DaAqlpZhojmRBrbSReoYlOru/J6/bdEmGOcjIIDBw2IIuSS5vgp6IElPvixjXy/I38rBp9vf0kmsZraqRdqPJSL+1RBaXJW1Gzrkxq3ndBNdRA9kEVjLeDpg9YmrKDp1Q== 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=TBmx4hPj5oPCEWmCAKLie8oSjYUpYGdXWpzoej8OAzetXQZ9ZE9+qPHXS8v9xe5053MZsArOyDffqwmxT8oMpAEhmY19YA9cotLtrNY3J2HVavtXPiP44lu9FkVc11mZEpuz8WtN9A5v/eU+Dcyq988MqExy9ocksrSeNs/Ejexm2IcBGJs7/WEOLiVxVSHPdDJgod0MxCzJtK/kMsXqu0u44NioxrWQHOIMGdkeR1NhdmsOS2/wTpTsWjDfWK9kMEKEAzMLzWdndg4Je93FD9HrTA+5opN34vTViRoC0kN2QCTVczwJTxSsqgM8nKIcxHGfLQn/eoXtSc2IAW0SdQ== 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=vlplyzhIxuG/Atpfl8B1f0BsyMqOLPadfvHXLb+bfP4=; b=ft1FALSfD7GpBSQj8OJpbW/tgvjTQVK/0HGs7fXv1Pq3GdzX2xor+ACFld3qsxt4iMQ+rYWw6DxOiuwYYdCb7gPiA8lS9bfvlAhL3p5EmylOigzI/ygmc4scGWXQL1An8hwg996us4U99szDH+/qDpdu2LOqe0RoGKzcObyyArxssaIBX0obM2PyYwOM9GpYJKEWXMIQq40/vy/AEsrkg5pfZ83dxrEn7aIvzPf45djat1hsADZatYZZQS1P16pmulowU0lSZFoMNBhx99i0KqLllJRjG1hS/pvk8yvGKBYNGmgnh8T6z2U5trVp9/kl6K/npLdZl8DqGRaxhG0xlg== Received: from MW4PR03CA0160.namprd03.prod.outlook.com (2603:10b6:303:8d::15) by DM6PR12MB5006.namprd12.prod.outlook.com (2603:10b6:5:1b8::23) 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 14:38:27 +0000 Received: from CO1NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8d:cafe::f0) by MW4PR03CA0160.outlook.office365.com (2603:10b6:303:8d::15) 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 14:38:26 +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 CO1NAM11FT032.mail.protection.outlook.com (10.13.174.218) 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 DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 14:38:23 +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:20 -0800 From: Xueming Li To: CC: , , , "Matan Azrad" , Viacheslav Ovsiienko , Maxime Coquelin Subject: [PATCH v1 1/7] vdpa/mlx5: fix interrupt trash that leads to segment fault Date: Thu, 24 Feb 2022 22:38:03 +0800 Message-ID: <20220224143809.1977642-2-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: 24827fc0-f6b6-4bad-3ccc-08d9f7a3515e X-MS-TrafficTypeDiagnostic: DM6PR12MB5006: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: LmebpqgXHQiL+GW7OO3CGETg5syfvERh6638iE/tXEC3S2+X/Jub84s7Ht7AH6oH8E+FWSZ4Q4P1Rf1+Rvg+cnxYoIVT+0zQ6LZd6sZ3S4/fwJhDkhkBUdnsKxN1tFKOhchCxBHXUoeUDEWFQasPFVvUrjHADy7pAo0JgXCzWg5qHxWEtWppbWukAb3uecpUROqGmX3JlysLzzyOAo9l6lnjTiik1nbtYhF4GNPJepj8g+2CWGHZL5KumT7IZZstazMjPOuzIiP/XGa0HlSZ5XYXkuI3BABEkMeOJDq8LwnUTQTjf5PTIxStHTTqGLmZCzzGdec7dbmd/ZFxOOxVgFKbwjYzFqri/1vEhVZIwGr1xucq0Vwv6TFaml8vr6DHVtxLlSxCGvgrWDZmuTxqRmvlARkfN9dyHT5BmlQ84hAjBxnMZxy4UnWpnA91kPrTolFBZNx66LZCLrkBNTay3JPT0ifPMGeryPgDoZ6t6uFQRUyzviGyCu9R8CD6wI9CbpHWSErVz6M3tXJnI/M9OWNfw8iXipwsg4rpmzM81t6zj+sSjMviqUqoPmNrsKZJCo0N3PiEMBzAAWzt8g9Q67V6vfGk49kSghcFhiMLtBAFNpn4eyF7/kWstoFNziZ3Hz5Zo+8Q2aZVtvoC+KpqjqHW7lfvy0S4QJFzP43y9rtz9omtzzA2d5+8FUQ5X3YZMh6Ow+NHAU4n8hetM00Mjw== 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)(46966006)(40470700004)(16526019)(1076003)(83380400001)(40460700003)(6286002)(82310400004)(2616005)(86362001)(26005)(186003)(426003)(336012)(2906002)(81166007)(316002)(47076005)(5660300002)(356005)(70586007)(6916009)(8676002)(4326008)(54906003)(7696005)(55016003)(36756003)(8936002)(6666004)(508600001)(36860700001)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 14:38:26.5402 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24827fc0-f6b6-4bad-3ccc-08d9f7a3515e 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: CO1NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5006 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 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