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 327FAA00C2; Wed, 4 Jan 2023 15:34:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9360842B8E; Wed, 4 Jan 2023 15:34:26 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2088.outbound.protection.outlook.com [40.107.237.88]) by mails.dpdk.org (Postfix) with ESMTP id 232FB40041; Wed, 4 Jan 2023 15:34:25 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EEFKjJRjVlkD8GnDYEbCvC1K8H8gDZIhnBt9os9rwOt58fDYl0YoUONxjxWvVO1ykg5ArBNyLuRusx+uYk8oaruQD0PIHbk6VTwLtE8IAVkgf9f+u2U7fhd0Q3TNrlzlFjkMx9xxf/jqTXuXIeIvVJMkNBNt6Qe9fhm2SS/OS264FWXvtnZJr0UKzPosQj8IjgtTSG89/6YwnlXB3a7kL8QunkHqy8Qv4TgwT1ikXn/6TDCsFC66vivwPv+xEwWvk1h5yLSIXujbKeviN323XKektONkiYZ4P4Mt0zdnCDAu7zE78SWYzGvF1sDwP0r27hb9pSIibOD/nQXLOgjQYA== 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=u0M2fdZn/kKhGKysfixM9LxoQUhfpdu7iKLwnlioppE=; b=YGs39j7aeWJMK+x9eVz/bpYD6G5/DaV7nALAxEjwVpeEOqy4GiuyjOn8gajpM/D26A+hOPxto7rt3UnnYQjbYfEQkTVAcn4BZcA82OXwddUE5HJR3/H05nymoZyfd1h9qNyptJjERz1QIiZCpPouZbazUvJqVixlafMhYEbgoVEmWXVcigb/ym0K/zYv6sKNfWdIfgZyyu1s4rDCG7JtBheTq/YvW5khWFrDPrBOP4G4P+Otb0rEeBGrYtb1FG0AF5ixi1qqfunCVyqU8hfNORHxJVqInS4IG0Ncntl2csUbhlKCsD+wnnedXyw5M+/yAM717PB9QApWu5WWydvYnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u0M2fdZn/kKhGKysfixM9LxoQUhfpdu7iKLwnlioppE=; b=5a/Mmq3aXEvf2VLeh4gfmE9AmHF4G8n2uZtjN/qcG6iRAYFgL/alxk48evHAjxEBEiIpSIIIU7COAP4o2kULBooG8KS/vJWUrswwgf4KiediSDuYqm/xMvw4xmI4NchHgPb4DR6rXUt+sFFWszKN9GkvszZHjDjhNdoTMKcXXIo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by CH0PR12MB5091.namprd12.prod.outlook.com (2603:10b6:610:be::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 14:34:22 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a%7]) with mapi id 15.20.5944.016; Wed, 4 Jan 2023 14:34:22 +0000 Message-ID: Date: Wed, 4 Jan 2023 14:34:16 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v3] kni: fix possible alloc_q starvation when mbufs are exhausted Content-Language: en-US To: Matt Cc: dev@dpdk.org, stephen@networkplumber.org, stable@dpdk.org References: <20221109060434.2012064-1-zhouyates@gmail.com> <20221230042338.1670768-1-zhouyates@gmail.com> <042de5cd-c410-7925-efe9-bea547fec736@amd.com> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO2P265CA0176.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::20) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|CH0PR12MB5091:EE_ X-MS-Office365-Filtering-Correlation-Id: fc26569b-a4d8-4a3f-0c71-08daee60c4f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JKrOrfAYfXW0zq3WR7VoLPggqGRDMcIfPDNxbPnd1wZp9wW2kzbkTOyu4+Ifch7Rl2bSXCstKblzV1jTRPOGqAR59j2O5fZZ53MT9qMFzi7Fn7L+knKYCJnJaUhKhXEOcChjLV1Mnc88WIqMBbq5ids9G3B6xbR9+YJTw4stOa6VUG48s2OvUyBl/cjWdr2UYpaBYw3c8Ct00zE4p+Z9KNxx+q9uNBHHEcdwqY77Kpg3PciWtASE2n0W/b/YCnewofVw3p5XxEYiFY98ILJqI+3pPeDzlRKT4CTjtMrOsFb6s2VHWfwKFKYmX++3jjnVqpd8tv4jlsUdWKWNvw0Fg+KL09i/NKMMF81ec0s3oWnPknjExYIHhgHrqXQzpfPRNCaXHqV8PZOgFqzEpXz71ENAqlnyeTxTX6VLWEPhaUe4dTZ6s30c5U1v08GlsgZYV10WHi2m/0y0BGCxNx4peHe1wVhZcZ7TG30g//HKytA5dPTyjdv2h9349UQ37patE6DoPo42ZKA880SWE7quyx1U+BUyZTZ142ZUBW3y1fd3VTzEFqYqcDt4mqI3OPDPsgQ45HWspju01tcmg0l3HsCdwJrir5WUKH4aQVL0JcqsmuSpDy8sCvsqLp28tS/TyUCTxX94Xin1/TRKc9GU2pixIByOYA7iAThFo9vQLtrwUXVZz4oWduu/bRhsLkiiEqSLs0Y6xuWQXYgfse73uIf8U1prDWBMOOIK3cDuKv8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(366004)(346002)(39860400002)(376002)(396003)(451199015)(36756003)(2906002)(8936002)(38100700002)(44832011)(5660300002)(41300700001)(83380400001)(31696002)(86362001)(6916009)(66946007)(6486002)(31686004)(66556008)(6666004)(478600001)(8676002)(4326008)(66476007)(316002)(53546011)(186003)(6506007)(6512007)(26005)(2616005)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Rjc1ektRajJGblFMRFlkRHNjMXdtWEI0eGpzUVBEVG13L3FIRE4xQ0F2MVpY?= =?utf-8?B?Tk9qaExjMlk0TEsrd3FWL2tSc2gxWDdIejhEdUk1VGNkWlVtR1MydGRVNkxB?= =?utf-8?B?VExMekt3YXJ5b1gwcXB1RnQxQ2ZPcTJ4QkFMT1FoRDk4d2R5a0JVL2Q3ZDhT?= =?utf-8?B?ZE44NnhxMFZ1R0RQQ3kvcEhtVWVheGZheERYdkxqbjNENWtZTnFVN3hqdkpT?= =?utf-8?B?MGlESGNKQitUU3h1NHplSFBEZWFkZS9HZG5UdDNIbWp3R1pERUhLcG5XV00w?= =?utf-8?B?U3NlVVJpL0ZYU3plK1FqbCthckthUmU3Z05IYTBkcWNNQ0pGbEl0dVFZ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Nyyl+mzjO?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc26569b-a4d8-4a3f-0c71-08daee60c4f6 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 14:34:21.9138 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lpVb1mJ2cQHYnO8uN4KeKk0xURHL+DTpRvheUytWnpjzgfn0HGLvDbJqoa2RB3v2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5091 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 1/4/2023 11:57 AM, Matt wrote: > Hi Ferruh, > > In my case, the traffic is not large, so I can't see the impact. > I also tested under high load(>2Mpps with 2 DPDK cores and 2 kernel threads) > and found no significant difference in performance either. > I think the reason should be that it will not > run to 'kni_fifo_count(kni->alloc_q) == 0' under high load. > I agree, additional check most likely hit on the low bandwidth, thanks for checking for performance impact. > On Tue, Jan 3, 2023 at 8:47 PM Ferruh Yigit > wrote: > > On 12/30/2022 4:23 AM, Yangchao Zhou wrote: > > 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. > > > > Hi Yangchao, > > Are you observing any performance impact with this change in you use > case? > > > > Fixes: 3e12a98fe397 ("kni: optimize Rx burst") > > Cc: stable@dpdk.org > > > > Signed-off-by: Yangchao Zhou > Acked-by: Ferruh Yigit