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 21D5FA00C4 for ; Thu, 6 Oct 2022 09:48:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18F1D42B8D; Thu, 6 Oct 2022 09:48:33 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id DD91641153; Thu, 6 Oct 2022 09:48:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lQlFjhX4n1gWvEgYJaTh/0X+53lC6+/PAc9Iue3zjrISs08R7nF+9Nxzcl/laSLwX8uvSbD66VYtqJp4b0zg3dnRJryV+tyBptpLdhM/QrJxh4qcSzDjQJna082Xji9ypHBhPoqdyLCrAt+PXmgXjOtfqOhOzFW7u7c7uWy6uWMo82e7n4wCcBdchnsHMkaHXuRjEYXsfwJLA1k3mXkMC6fBCTkWo9ecMnEtxAxCsmLpzIbainoeZomcKISibNdVqLS/uJIICtL2KO8futPEbDkFAyX9dFwlA4b9LMAG0v+jA14+6Jn6E70Z6i5nM7VGTMVUbfuMt7VOiV/K1UvT4g== 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=BEZlsd5w3OKNDn1Cm3BAktn74Ytw9IKoxF4SLm+PFIg=; b=UPQOsfI2E+Pb0+eJK0Ad/uv8el1PJpp+qKsGFStxjYc31pcg3g3eTqtHBvWpME1+FhQLg1Al7tJiWmyuvvqYSqqdkN6z5L3rD6U1id7LX81+QQJZnNTJPfhIGSZkIJw+jePmHFT4Iy5m+VAHntaIjOL2Q+K4a8mi41o7Kjd+QyMYiBGcqXZYrrgo1M1vvQjqd0gffRacc0XZUzn+JaEWOkCBX9PeJiXq7KNAPeAJSrppKHV9+WRWCf1MIdw/XCaAyF0olsUZ1zCgNruCiuvasCTZd8j+4ycA0iVQo9lHkH3Xg5bSza2xXBkKh638MP3cg3GnpZo42E6tJ/LAngC37Q== 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=BEZlsd5w3OKNDn1Cm3BAktn74Ytw9IKoxF4SLm+PFIg=; b=QAqQll+xbt0Czu987VXyjhcDvaPUjaY3Xu2UlFK4fWNePXWEpymihsXOQ143ofo503BoYZiBTzl5Iq/iOw0n2NmfJvbH67s0mwL2Fulg7ojA55PyeZDuTdyzj9S4f3M+KndP2X2mZXPR+r/zSXIZpbuFq/MkRoOfYkR+uIxEv88= 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 BL1PR12MB5825.namprd12.prod.outlook.com (2603:10b6:208:394::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Thu, 6 Oct 2022 07:48:28 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::d07a:463f:6f93:337f]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::d07a:463f:6f93:337f%7]) with mapi id 15.20.5676.036; Thu, 6 Oct 2022 07:48:27 +0000 Message-ID: Date: Thu, 6 Oct 2022 08:48:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH 08/15] net/dpaa2: fix buffer free on transmit SG packets Content-Language: en-US To: Gagandeep Singh , dev@dpdk.org Cc: stable@dpdk.org References: <20220928052516.1279442-1-g.singh@nxp.com> <20220928052516.1279442-9-g.singh@nxp.com> From: Ferruh Yigit In-Reply-To: <20220928052516.1279442-9-g.singh@nxp.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0481.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::6) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BL1PR12MB5825:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d336c72-9c64-401d-0930-08daa76f2775 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xwrg1vMOm+fjEqphoZD32HMOBlslLJ6y9VSldFPP/p+OjEif6h4uBoLe5a77DFZBx50OoQIqnO83avumlGs1sJ5Lqcw6c4nMVHeSQVkbdQgSMBcRt13yx+cb7oNg61cASipLvnBxGcUCYHq3qHgKlkETV40HFzO7TangnbgTnI3Mkp2oMN73I+rqpVdOWi14YbEAlPe6apApW+D9jQsx0qAIhKghjKZxRifgdaJiPqyDnr4lGpZdbZAk/1CVWUnRmwcRsEEA8M9KIx/njPV+TvjXgiDteG36kCK1fo26KP4/fwiIq+RzJwxV/GJho7DZJj6iC/1fFY1mhCAr49oA5ZukeUWzt9DEej5F250BK20ZC7enWophboxeX45UvsscpkypMyGSrBKnDmOnPrFjxbVsXuj7sDeS3pgF1u1YD9V2CqZ+O3DXwjVpPku6vBT15s1ghj5f1PbNCqz6zInpwyG9Kl8/Ydgi19DwvLF15fa6PEj3MdRQy40O4S2hyJLv/V4UnaYg+zPdlIOEn4R3Zbn18QxRNXMWa08QI++wyCuf+ZOjmYmL7Cw0ZN88KqxgOCHc1eccQHnpIT/B+JgrOLFuHm8bGYYp02tIxDbyrA9MZSzs50tWSdyVzrGNtnlSVnEf8rx8TiECOM0YZTmp0aAOgIH5QURIvZeF5pZUJQKUZvkqMIpuil26iNOu/WgAnSXkMl8Pih7YfUL9JUuM4uCZvRbmic+jr36n+EQuvHWsEhzCI4bQBBVSSZ7n1oX+vv/xhsWV98+CNAZgfCZqB62Kxy5A8fMILopVcSu15Fc= 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)(396003)(346002)(136003)(366004)(376002)(39860400002)(451199015)(8936002)(6512007)(186003)(6506007)(6666004)(44832011)(2906002)(53546011)(26005)(2616005)(41300700001)(5660300002)(66556008)(4326008)(316002)(66476007)(8676002)(6486002)(66946007)(478600001)(86362001)(31696002)(36756003)(38100700002)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R1gxT1VxR1laTllQWnhnL2pNYWFCR0dnWEc0SnBMcllackxUR0h4cUI4WGxR?= =?utf-8?B?VkJmNWZVNno2a3NUNVdObnpFYXQwdmk4bjdpeTVoTUdoQnEvQU1ISTdFdnM5?= =?utf-8?B?MVlhZjlUeHI3K0FyV1BRVHp2ZGFxVXh1aWdFMXNjT0tlTitaM0NNKzRnYUV1?= =?utf-8?B?Zm1JRGRZczMveEtIb1RONU1tRDliQS9kT3RUM2FqN2hBUElxT2l5SldLU0lP?= =?utf-8?B?VHZXWFpDWXBxTGs5bzlJa1YxUzhvekxsRnowdlJNaERBenNOazM5cUpGSklO?= =?utf-8?B?RWZRYXhp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UxaWlYU1BhRzdvUlFyYUxxeEI0cFRwMFZD?= =?utf-8?Q?Lqc0kHQCfrPl7mYbHdrZU75p0?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d336c72-9c64-401d-0930-08daa76f2775 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2022 07:48:27.3098 (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: bUvMBN3Le3slCL0HUGhq/aBO/xlg3n8s6WwWF1qY54XeZ0hzJRjMfT+wB9LYcbGF X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5825 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 On 9/28/2022 6:25 AM, Gagandeep Singh wrote: > When using SG list to TX with external and direct buffers, > HW free the direct buffers and driver free the external buffers. > > Software scans the complete SG mbuf list to find the external > buffers to free, but this is wrong as hardware can free the > direct buffers if any present in the list and same can be > re-allocated for other purpose in multi thread or high spead s/spead/speed/ > running traffic environment with new data in it. So the software > which is scanning the SG mbuf list, if that list has any direct > buffer present then that direct buffer's next pointor can give s/pointor/pointer/ > wrong pointer value, if already freed by hardware which > can do the mempool corruption or memory leak. > > In this patch instead of relying on user given SG mbuf list > we are storing the buffers in an internal list which will > be scanned by driver after transmit to free non-direct > buffers. > > This patch also fixes 2 more memory leak issues. > > Driver is freeing complete SG list by checking external buffer > flag in first segment only, but external buffer can be attached > to any of the segment. Because of which driver either can double > free buffers or there can be memory leak. > > In case of indirect buffers, driver is modifying the original > buffer list to free the indirect buffers but this orginal buffer s/orginal/original/ same fixes needed for dpaa version of this patch, 14/15. > list is being used even after transmit packets for software > buffer cleanup. This can cause the buffer leak issue. > > Fixes: 6bfbafe18d15 ("net/dpaa2: support external buffers in Tx") > Cc: stable@dpdk.org > > Signed-off-by: Gagandeep Singh <...>