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 5AB2841EB0; Thu, 16 Mar 2023 12:01:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 49E3042D2D; Thu, 16 Mar 2023 12:01:25 +0100 (CET) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by mails.dpdk.org (Postfix) with ESMTP id D53A540DF6 for ; Thu, 16 Mar 2023 12:01:22 +0100 (CET) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32G8Y4KW020702; Thu, 16 Mar 2023 11:01:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=QYSzs5VN5wN3dKDUWs2xO7YMo3J8TfL0Jdd/6wZx2C4=; b=SbIZ3B7LWcDYuE03arcDQo2lQRv83apM0or+cVemdRXvMWdU/RvKFGUBPeI1HuMzaYYh YSleSOUIowT3cN95/5dYc5jaysYOvCR7pCOL7On8p6sQvh56r2Udm3j8wWi7kLKx53cs EqypAw19rvSg7ptUgpEfk7N6a2GQjUhfPkzWWv6lQbUaF5UfwdG7mqsEwKWS4ixfORtN Gs/309REQHLQzc2oK//yoBslz0xiVPZM0FiT3Le3WrJEiHDx0i4EcltiVqnnPY/0ZULx SCxgFoqbpHIvktQpswiVyE+2EkukS/TbRFs6gtJOBJFYcYf3bn2izT+m2GM3cx192Aei lQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pbs29gua9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Mar 2023 11:01:21 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32GAALG3023691; Thu, 16 Mar 2023 11:01:21 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3pbqky3qpf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Mar 2023 11:01:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gKTtjjaDUdT5VeQN6cjFDE+O08cfQ+5SKi+FoQ1jCdcsD1oX1euTmYHhVASS0AepR9LphJnc97gnZDE7O05tpxBLeRy2rR7fTQnLBxIPe3EqPEvYNDhN9boEnZtWPYIJ6+YnC3FCPzwY7HdbeWcjo7wY+Q/CeD+8pNq8/W9OPsZHSqDnZQrcr7Dzc5Um1BVUEVwIKknwfx4kKSHf5t1pL6hprJrbMnTuvXMRM3/vpqAL+SdmVykHomvWNArhBmqXeskIYTaB4O+GZrQX5PQ687SN6EHlyzG73u71Uodt1SiJIOHBobqLo0JA0PRurrYlyB/w7TkwUokDYeSYADg0rA== 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=QYSzs5VN5wN3dKDUWs2xO7YMo3J8TfL0Jdd/6wZx2C4=; b=n9tbrGnCt71bM+YS2XrIzherWaKCJNvGj5ahtr6m2p+IQL59Poq0XsM7mTIWIVEgjPeopanP84a7OyiGgBFRRGSlTKyYEytidv/qz35RQ8cJT3yhPfzPZYQcKZexKDTodLANTVtACQaYFsVgaSAeYIFCLrEpOSbVnMrAK/qbBd68kecZaDL6PGtRpcOPsJttwxAsDmcmw9Px6uaqcgs8tJOk5QnCvZ96O1zG4xeZ8vycaCNcgPodrjNMn2mFnwhjYJjaQUpTQ04hgKyJzF1V351U8tz/otdKt1PIXgD0Lkr8Jkp7QZcjfCKU6JkcnRGkx6/71GbDZNLP8xrLe2Xhcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QYSzs5VN5wN3dKDUWs2xO7YMo3J8TfL0Jdd/6wZx2C4=; b=JN/ZU0x2Yt4Ub2oXOLCevcIHu6CeY23wBd4jvhqFoQUpYiC2mHTp0qCl7JIiTxDLVtPDFBFTbdrQ1XA9mFumuIimuEZoEtfLq7FX63SufUGLDw+2gWXvw8RZIJLoCFwqRiAGpkcz3VjFoY4AGGs5DFgeSlAfcbY9/Q5dv1cZjHk= Received: from DM6PR10MB4124.namprd10.prod.outlook.com (2603:10b6:5:218::18) by DM4PR10MB6765.namprd10.prod.outlook.com (2603:10b6:8:10f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.33; Thu, 16 Mar 2023 11:01:19 +0000 Received: from DM6PR10MB4124.namprd10.prod.outlook.com ([fe80::a6be:8c6e:df2c:dbf2]) by DM6PR10MB4124.namprd10.prod.outlook.com ([fe80::a6be:8c6e:df2c:dbf2%8]) with mapi id 15.20.6178.029; Thu, 16 Mar 2023 11:01:19 +0000 From: NAGENDRA BALAGANI To: Stephen Hemminger CC: "dev@dpdk.org" , Kapil Kumar Jain , Ramakamesh Duvvuri Subject: RE: [External] : Re: rte_pktmbuf_alloc() is returning same address on two consecutive calls Thread-Topic: [External] : Re: rte_pktmbuf_alloc() is returning same address on two consecutive calls Thread-Index: AdlHljGtNMfxFMkVT8u/54ZhM9u1fwAGqcMABBCMTzA= Date: Thu, 16 Mar 2023 11:01:19 +0000 Message-ID: References: <20230223100126.6ad6d06b@hermes.local> In-Reply-To: <20230223100126.6ad6d06b@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR10MB4124:EE_|DM4PR10MB6765:EE_ x-ms-office365-filtering-correlation-id: 8deda538-6cbf-4324-4c28-08db260dc58e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9cLQTE5lLOsIu28eUNAFwgdZFweS2laWIjMby3+PJVfxjt8ufa5Zw4nPC+LNP3LbkC8eemgh4N1y8/pE2AdTd/xcXAjWD9532xLd30BqK74ow03fxGb9mVKzRqbU1JW05/gOp5wiVPpjnl0JhGecKrm22hune3wAiKiCUMJWZvYHCOADr1W1/sCYMoLA7CV6oFmOrmtfJE3LRePVROk/I6V4siP5XcbbnwZEX1vuUKGynr/U2/WRxKH8iF7TuJf7oUh3LkudbMrSZMfmr+AfNYjiZxqa08pguJ/EQ6hBHOK7Bbq07sZFK37EOtJsp+FZ3VdjuXb+sRYJR00qme7qi6U2mj/NuEvEwuu5IDSkN45y8NHpoVyvSYemIH2a25rL0n5E+ecrt6ugWJE934i0CY3N36HFYmlCeLGrkIlXl4FzZdN6iNvPddD4qBwPlUtuD5qGn+LyIApqSl9Ffj1xTbxDYftgGgv0lN4rifpePvWnbIjgFm85n+CTzljGa6pC+gG8FKcI/82XkELtOYaX2zuvi4A6+Nd5ksfpl2s4M2exPQ/M72423NZ3cx2Udz6BEpSja9w9i8HyDv62+6kU+hIJ/gOGSBj/7D344KGZLnkabM7am8weVmjWfPZbrLzvOUkGxzjpe1qDazFzC+9nu78u9KgH3VL+aYIo6Zw7GRWMAWeVuhaKJ5zBLgwF4DB4IgyGaYuqlSC0KwmE+ZrO2A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4124.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(39860400002)(136003)(376002)(366004)(346002)(451199018)(38100700002)(86362001)(2906002)(122000001)(7696005)(316002)(71200400001)(478600001)(107886003)(53546011)(54906003)(55016003)(33656002)(9686003)(38070700005)(41300700001)(4326008)(6916009)(8676002)(64756008)(66476007)(66556008)(66946007)(76116006)(66446008)(6506007)(186003)(8936002)(52536014)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?tSdiFAjE2u/AufZNOWdlycr9WdkffSUBJph/zib2fpQptBv2UHkYof1byJxC?= =?us-ascii?Q?flLwxREfTbANWFjATv7LckoOGpH57JZvcsBoQX3PsudKr/IxpfLIfSH56MM3?= =?us-ascii?Q?DB2xPZjV6p/GzubFpEgtaP1QIpU0N2Wc+6rd0iUweJf08yILtiKOFwSl49WU?= =?us-ascii?Q?X6CNfEydyT/xzGtYr2tn50Atjd6mcBc+SV0oH8KcTP7nvmuB4ppDjuJfYQAH?= =?us-ascii?Q?eM9htn56k1mH8Bm3wwG3eVGNKCnKSSeFx/gJ5Abym3SLKuhcnpcj/5r2uFCI?= =?us-ascii?Q?Uw93XLVOogwZdFJgBfEeJMpXOvmmQ5s0mWaI6BFUVReXM2o/2HMbXGh0DhdB?= =?us-ascii?Q?fXwVtVwxPssZFPh68svmXrM88Yivni7dzIqoOD8kgZ2LEEMVFb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DZ542cFGpwAwFCFmcB7qj3RJ+2GdV9gE/?= =?us-ascii?Q?EfhJaq2TaxLahPo0t+MnNqWRiTG5ttTW1kF/52kh8ayP8A8MYQCZpd77KYeg?= =?us-ascii?Q?qyBrne32XIj2FucewVgAvpEkfmkBegZfQTMx1pkP5ENbYLtxDK8e+WFtgO77?= =?us-ascii?Q?nIDqUqcbtCVO91cO5A7CoJbMGenF03jBfp/8xC3EpHUcUOH0jf6J6B9YUAaN?= =?us-ascii?Q?Bb42fi73ui941OBvVl1YYVIKs9x8YTywsjVyq8gQbQdvYpjzKPZBMyr1dg1A?= =?us-ascii?Q?Oatm12zGH0Uk0Qq/cjdhRS52ofNt5MJHv82iiquOhtOwVZnXxQj2k1PtvwBC?= =?us-ascii?Q?lw=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Ahm8ewzn10nPxykKdW5XF83iMyKleb+tmo8Gne/rmOAKltEZEleRYXjzXhWO/27l8b4ckgcpa1KfWg7q0x+cpbg9W4GLqcCP7JCP/5E2sy0GoHDQUl5AO/7XmCx7yPzI1Cm7zxho1v+sUwmW1fsQjqXRAP6hbnc9tN6UFFvURut/L7/41AVA81x4c9OE7XZNsjidTAmBxVLMJl8+PN9ZmncwrRIkAV84KagD/Zdj9oFjDPYBxn9wg2UJasgAjnSOM49iWbqHYYjhtAU/DDHbc1Q8YjWG6NZl+0j/h8+Pz34XvaWNxiw1Ad9r+Xpbu/5cLCi94EJS+EHzaCa07ncAU9Xtjci5QQ6jjfy9gsZ7ZtFfOZ7d1voIwGjDp+iGzM5RVaU1q4ySszt3ZNb64caYY0x9qbg9upF8qBCOGzimI4v72bRqVBgW1/rVQWRXQYeqDKpigWx3tAeJ1cZnVMfu+RqyiqWl/7ArnO6CiW22CQTFmF4AvNR/JBKs0E0ZlOOGfNWNZbhXJU4aZwhfSgQI7NuHk439RJAm+keWjJ36gRf+h4l6yb8mZvyPDEDxiaeSbR8TM87RvcdvxNeTuqF6EQzEFEfSy0yZ3XReulYrD3AT4heccj5qmWVxTdLWBY3Qyy7kx60LuVDz9MH+GUQU9cSM12ZTamBJtg9VOfNTPmGAMBWK7DOHIMcvcNEmKxO9GLVqa68hIkgSuHrqoQ99m35BB3V+PkN1YE3hd0Ml8ATCBCbPXMPyuLwJzxe6Ti9WRQYtKc4JyoXfm/9rfXhPInxDLhGriO2SUXqCg8FpDDI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4124.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8deda538-6cbf-4324-4c28-08db260dc58e X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Mar 2023 11:01:19.3612 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HSJL0159BqAGYCwKfBkkCLaXsi+n6+csIpCL2PSuCfqJTmiovf87Fecc1z+qW2gEujYp38mQGtswGT8RMFdgj3cJcGGcuzwK0FcFgcQpT8Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6765 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-16_08,2023-03-16_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303160093 X-Proofpoint-ORIG-GUID: CRQzqlavZoAPJOii6i1KJFcLmkUMTF7L X-Proofpoint-GUID: CRQzqlavZoAPJOii6i1KJFcLmkUMTF7L 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 Hi Stephen/Team, Thanks for the inputs, After debugging deep into the code get to know that,= in my application code I am trying to do double free of same mbuf in certa= in condition. in my case, I didn't enable RTE_DEBUG_MBUF macro, so rte_alloc or free ap= i's not performing rte_mbuf_sanity_check(), as a result the same mbuf addre= ss is getting added twice to the cache list. I don't want to enable the MBUF DEBUG flag for my application and run (as = is cause performance impact). I am trying to find out minimal check that is= enough to avoid the double free of buffer, I checked the ref_cnt of the m= buf just before freeing it second time, its given as '1', Is this expecte= d? Please, suggest is there any minimal checking that will help to avoid doubl= e free. Regards, Nagendra -----Original Message----- From: Stephen Hemminger =20 Sent: Thursday, February 23, 2023 11:31 PM To: NAGENDRA BALAGANI Cc: dev@dpdk.org; Kapil Kumar Jain ; Ramakamesh Du= vvuri Subject: [External] : Re: rte_pktmbuf_alloc() is returning same address on = two consecutive calls On Thu, 23 Feb 2023 14:54:13 +0000 NAGENDRA BALAGANI wrote: > Hi Team, >=20 > In my dpdk application, I am facing an issue where rte_pktmbuf_alloc() is= returning same address for two consecutive calls in a single thread contex= t. >=20 > Following is the code snippet, >=20 > int Func(struct rte_mbuf *mblk) > { > struct rte_mbuf *tmpbuf =3D nullptr;; > struct rte_mbuf *copybuf =3D nullptr; > char *nextPtr =3D NULL; >=20 > tmpbuf =3D rte_pktmbuf_alloc(mbuf_pool); >=20 > nextPtr =3D rte_pktmbuf_append(tmpbuf, IPV4_HDR_LEN); > //update some info on nextptr >=20 > copybuf =3D rte_pktmbuf_copy(mblk, mbuf_pool, 0, pkt_len); >=20 > .... > return 0; > } >=20 > With the above snippet, 'tmpbuf' and 'copybuf' which are getting allocate= d from same pool (mbuf_pool), pointing to same address, Due to this tmpbuf = which gets allocated first, and further populated, is getting over written = inside rte_pktmbuf_copy() call which is not expected . > When I further debug , rte_pktmbuf_copy() is internally using rte_pktmbuf= _alloc() to get the free buffer from mbuf_pool and copy the data from mblk. >=20 > Please let us know if there is any known issue with rte_pktmbuf_alloc(), = and why it may be giving same address on two consecutive calls. >=20 > Regards, > Nagendra >=20 Most likely your mbuf pool has gotten corrupted before you get to that code= . Try building with the config options for POOL and MBUF debug.