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 46148428F8 for ; Sun, 9 Apr 2023 17:31:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C89542BAC; Sun, 9 Apr 2023 17:31:35 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2045.outbound.protection.outlook.com [40.107.223.45]) by mails.dpdk.org (Postfix) with ESMTP id 247E640A80 for ; Sun, 9 Apr 2023 17:31:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aWhgZmuEff9wXdLu3r11qXjsXf90GYKtMcFqAwxt7oqMN/mh7J449f30SdK78PIDRDZk1GGil6PQI6eeCh0MwE4agUy4HMKsw8BqWGKL2Y+kdbVuqxKTi/X1tVj4pngs+nR04vdMgtT68Aa/nUfCOQV7keHEYGQkJxIz+F7BGauIzNBxDQ0SrMy3m3LRpOPJ4kBGgeeONSA4z4QVJDbOTshu36NcEUTbIxCiEsQ7KJbbjVEYBRhGdX3YZiNzTC1bm83EPdoPkYGomHDxLYgpEckloexS/v3IIR5dOS/wxUknFmXhwgLpb6t84ZPCZCZ+bZGgJ1I0k1D+QW6IWOlhPw== 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=XKykMlKw59UWtfYyS6TpGmkvOE0Hb/YqBlvB3yWcjcU=; b=R/YYIw78UXge+Xoi6XFg49Ljhg/DbJXBsTUEnWE8B2h09SMJQvz8yeCRy+R/MR3upF01X1Dokh/+GnboL/cgDs9U5cbV/Q2nE971+3rvsScw+jbKjVa5XdO+m3uTA7zcmLDzjcZOSu/8lqyNpaZOeP8yLzH5unT+ub6KNp85obQUBX8RG39+RBPK4oFRURfFzsz4SiPWf49WoaeTBQg76s66EP+R7yjAPuKc/dYulK1O6ARgO/D81D2YqvuBUOuUfLPBLVpiCO4fBzxhTVMv0+x2QEzxBx/Xp16BkNvN8p44tGbdeZL0j6bqwtMzhJb7yQmSMRWSazu613n0t9VY8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.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=XKykMlKw59UWtfYyS6TpGmkvOE0Hb/YqBlvB3yWcjcU=; b=kQvtxWJXOpiqYUVB3W8frEQYPNFDvX9VUrUobxGBq+eSsbFexY8y9DH2THldG1mAqodYk3bcJOGzCat3D2741jjseeto+2kvOcn/3IsB7a8qaSiVEnr0ROFFM00ysBcUDpzGCBC8qcQjsKwjlOvGA1o4RzXjf75GBgJBF28uBW+dgIyPVPnI1tQW0YFgqYTi2aXvujJ8ifBCTYPKORCKUbYoO/5P3jnq9wsHBiyfon7Ir7wxmDrDrCQolgNavR4Cbo+cLAjN0PnM/yE2/AP82D/BZVGq6ftUmnqxpMVqojikiTVdmlhwQUqZprTffODce5322JeWPBBDq6Ll9Nz2DA== Received: from DM6PR06CA0023.namprd06.prod.outlook.com (2603:10b6:5:120::36) by SA3PR12MB7807.namprd12.prod.outlook.com (2603:10b6:806:304::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36; Sun, 9 Apr 2023 15:31:32 +0000 Received: from DM6NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::1a) by DM6PR06CA0023.outlook.office365.com (2603:10b6:5:120::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38 via Frontend Transport; Sun, 9 Apr 2023 15:31:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT037.mail.protection.outlook.com (10.13.172.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.25 via Frontend Transport; Sun, 9 Apr 2023 15:31:32 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sun, 9 Apr 2023 08:31:19 -0700 Received: from nvidia.com (10.126.230.37) 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.37; Sun, 9 Apr 2023 08:31:18 -0700 From: Xueming Li To: Yangchao Zhou CC: Ferruh Yigit , dpdk stable Subject: patch 'kni: fix possible starvation when mbufs are exhausted' has been queued to stable release 22.11.2 Date: Sun, 9 Apr 2023 23:24:15 +0800 Message-ID: <20230409152529.5308-68-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230409152529.5308-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230409152529.5308-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] 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-TrafficTypeDiagnostic: DM6NAM11FT037:EE_|SA3PR12MB7807:EE_ X-MS-Office365-Filtering-Correlation-Id: e0e23852-f3e3-4d3c-6864-08db390f7f49 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oi5hK+cnXUsXQWLZypHOV57idlfjL//og7dL8ic9DiO2NR0t/rxerCiORRpn0wtMscpinzjVY+N+fic6rtiGYb8wcPaTOTbsuXScn0gQEFVVhYG98KLnNrB/7EktEvwrSW2BCprsG0RlWDt1qIbHS0jJzLQRoS9bnkajJzPc3J5Pzn8oMSAdQXYFTnwc3MLHtgD8wm+wgoSWUnTKJwSUv3nwD4CbJkaUJPFLMjoalFGltGuSXc94/fCRpzZemMS5a8HgdX7oRm3SajzRPzg5LK9pky34qrzae4Pub/HhIe3CeMe33z3T4G6mLbKByKSizCrFjddU2Lj4GiMqZn2DJ1eRovp43FJMD9IbR2Chd9umfGjlhYLCcfizSSCw0xdorq3uPZkqwbpbkx8b9TKVJ3PEm6fdMFH8PdDJuWWbnhX+M9ecCw9nTvMU+yNcVNEcNNKO1DJZ9prI2sseeOkRMb+597zcCQdrOsRU8KNNK3xKX5NYdMJd3BOJ0DDfw/dCjQc0g5QAnMUcK1DE0Xt3hCQc51cVHsMRT/dy1y82krrwpcHXhHhkBiYr3MnrFY+eV2pNHzQ4XGQeXxBs97FMfP93wkJL8LAQn6kADSoEDTi4AyaPiM+EhVV+SwDUxUaNvqUHg7/mil9eZ4H12YirueX572RxnRTtd/W8eHK4rjmnIV7tCHhOw+911kuRX70xleFopeEeF33jPBFgcSJMxkj4MgpbtZjqNu2HBGOipnLMLt4yvg8AgpDTXdmW0jyg3KIlRf9n2KOlevPcShcOrkvBS7ukq9X2gbqC5a7ZM+iRSiLpG2wodt3Du0GPWgw9b8dZMIUrzrWAkgN+rcQu9g== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(136003)(396003)(376002)(346002)(39860400002)(451199021)(40470700004)(36840700001)(46966006)(36860700001)(426003)(336012)(47076005)(2616005)(83380400001)(70586007)(966005)(478600001)(7696005)(6666004)(16526019)(6286002)(186003)(54906003)(26005)(53546011)(1076003)(2906002)(40460700003)(36756003)(5660300002)(7636003)(70206006)(6916009)(356005)(82740400003)(4326008)(41300700001)(8676002)(8936002)(82310400005)(86362001)(316002)(55016003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2023 15:31:32.4460 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0e23852-f3e3-4d3c-6864-08db390f7f49 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7807 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 Hi, FYI, your patch has been queued to stable release 22.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/11/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/09b626852e51df9bb11dc300e9aaa9b2a49ef77a Thanks. Xueming Li --- >From 09b626852e51df9bb11dc300e9aaa9b2a49ef77a Mon Sep 17 00:00:00 2001 From: Yangchao Zhou Date: Fri, 30 Dec 2022 12:23:38 +0800 Subject: [PATCH] kni: fix possible starvation when mbufs are exhausted Cc: Xueming Li [ upstream commit 676ed80ad98fcff39943d09b8fe21e2e01ae3d4a ] In some scenarios, mbufs returned by rte_kni_rx_burst are not freed immediately. So kni_allocate_mbufs may be failed, but we don't know. Even worse, when alloc_q is completely exhausted, kni_net_tx in rte_kni.ko will drop all tx packets. kni_allocate_mbufs is never called again, even if the mbufs are eventually freed. In this patch, we try to allocate mbufs for alloc_q when it is empty. According to historical experience, the performance bottleneck of KNI is offen the usleep_range of kni thread in rte_kni.ko. The check of kni_fifo_count is trivial and the cost should be acceptable. Fixes: 3e12a98fe397 ("kni: optimize Rx burst") Signed-off-by: Yangchao Zhou Acked-by: Ferruh Yigit --- lib/kni/rte_kni.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c index 8ab6c47153..bfa6a001ff 100644 --- a/lib/kni/rte_kni.c +++ b/lib/kni/rte_kni.c @@ -634,8 +634,8 @@ rte_kni_rx_burst(struct rte_kni *kni, struct rte_mbuf **mbufs, unsigned int num) { unsigned int ret = kni_fifo_get(kni->tx_q, (void **)mbufs, num); - /* If buffers removed, allocate mbufs and then put them into alloc_q */ - if (ret) + /* If buffers removed or alloc_q is empty, allocate mbufs and then put them into alloc_q */ + if (ret || (kni_fifo_count(kni->alloc_q) == 0)) kni_allocate_mbufs(kni); return ret; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-04-09 21:45:40.495984800 +0800 +++ 0067-kni-fix-possible-starvation-when-mbufs-are-exhausted.patch 2023-04-09 21:45:38.679042200 +0800 @@ -1 +1 @@ -From 676ed80ad98fcff39943d09b8fe21e2e01ae3d4a Mon Sep 17 00:00:00 2001 +From 09b626852e51df9bb11dc300e9aaa9b2a49ef77a Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 676ed80ad98fcff39943d09b8fe21e2e01ae3d4a ] @@ -20 +22,0 @@ -Cc: stable@dpdk.org