From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 93FCFA059F for ; Fri, 10 Apr 2020 14:09:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 47F0F1D16C; Fri, 10 Apr 2020 14:09:50 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 660D61C18F; Fri, 10 Apr 2020 14:09:46 +0200 (CEST) IronPort-SDR: xokZyUFQMNzlUxN/xN6tf9tjRY+SIwzpbRsYRzcDOywzLvT5Ffc3wB1PGRdTmTaxKFDBrRROji 1VwEutBaty0w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2020 05:09:45 -0700 IronPort-SDR: EuoZc0HWVNstT54GYy0Ddf6AIb8NyWbKpXzKfPl54SOHceqG0dHYlRQaT1t1wIYVmGHpjoNwFQ 1tL8TdzWMrrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,366,1580803200"; d="scan'208";a="452365866" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 10 Apr 2020 05:09:45 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 10 Apr 2020 05:09:45 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 10 Apr 2020 05:09:44 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 10 Apr 2020 05:09:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SrYlJ7Fv5M6aCn/+5jKpf93hyvwvU/dRuLePEMY2hAP3YotRB8zNui+/e7wmS2Aozmr9Koj7+J/YYe6P8hDNMUbqCHTKpTdCdtAufraRhE9olWaD3JPCm1zKXkYZf50cTB4AYciZO8P48QFZOO5nLNcIDVx6zVWqD142aWl5u8egV/ybWBEtOjcdyhTirALMRUg27lk1Pt+VGNO/3jVVjvzuX8/tMZBevWxkkZl8dwcr9wuS1BsWC314VUr2/B6O4Muya6/WH/obV8Nk3CO6YD6yhQdtrQ1Hie1uK5+FOBXkJb6tBGwM0YNhMdhufaLBahyCqgluX9aV6jZPeLyfyw== 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-SenderADCheck; bh=5xgKBhpQJO1nXAn15uQZxqhPhVZbxP0A9ceo/7TCP1o=; b=dcLAnUxLWWuND5BIeilH+g1B0Gd9hraM8VaAyUu30xx/hnBz1iO45eQnNNcaO3f8UxNR3GiUGKo2TXF9vW+wPlDTGAJeUAt5fSSBBe2eaTcjvBiPWh9MdW0G6tf5HO7qsFoAIhxNiZNDRSSfRthVOj95zuySb9/ICtDFrylxUao+M1Ds5aU3FMFm1koVZtbUNe+7tJGbFx5eVLrSJS3TQF0XX9mTt3PECZ38jF9JdalrIr2dG7ksvmeoChpDJ+z37f9XZRsaJ/sv0WmfCaiuC4nVU15YEroZgkYq3erZY9GC0gYdUeciBczuNqmsQcVJ4HjcnEe6vGVEnVpuJ+/4YQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5xgKBhpQJO1nXAn15uQZxqhPhVZbxP0A9ceo/7TCP1o=; b=wJZl0HJOpu/hKW++1u6G8FrqCYb75zCj+NOp6YwE3HG8bTl7ksSuAcTaJz5Q1xA/MdX+tzvGI2zwnmWRU05IY3XmewFDysN8PM23PvX1eo1+za3RhzAMKZPOPIHWg/FYmub1AAmQEHLb/6WSpdgBKzi1/spOu2jIaSQ9hY6lXo0= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (2603:10b6:805:5d::19) by SN6PR11MB3344.namprd11.prod.outlook.com (2603:10b6:805:c2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.20; Fri, 10 Apr 2020 12:09:43 +0000 Received: from SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::3982:ee47:b95a:4ed4]) by SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::3982:ee47:b95a:4ed4%3]) with mapi id 15.20.2900.015; Fri, 10 Apr 2020 12:09:43 +0000 From: "Ananyev, Konstantin" To: "Zhu, TaoX" , "Lu, Wenzhuo" , "Ye, Xiaolong" CC: "dev@dpdk.org" , "martin.weiser@allegro-packets.com" , "stable@dpdk.org" Thread-Topic: [PATCH v2] net/ixgbe: fix resource leak after thread exits normally Thread-Index: AQHWDwB2lbqMQzERmU2LHCAgEll6GqhyQPRg Date: Fri, 10 Apr 2020 12:09:43 +0000 Message-ID: References: <1586495895-9610-1-git-send-email-taox.zhu@intel.com> <20200410062227.24201-1-taox.zhu@intel.com> In-Reply-To: <20200410062227.24201-1-taox.zhu@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: spf=none (sender IP is ) smtp.mailfrom=konstantin.ananyev@intel.com; x-originating-ip: [192.198.151.160] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0f208bec-aaf1-48ff-019f-08d7dd480dae x-ms-traffictypediagnostic: SN6PR11MB3344: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:513; x-forefront-prvs: 0369E8196C x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB2558.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10019020)(376002)(396003)(136003)(39860400002)(346002)(366004)(6636002)(4326008)(71200400001)(55016002)(110136005)(54906003)(86362001)(52536014)(316002)(5660300002)(33656002)(9686003)(66476007)(66556008)(66946007)(7696005)(6506007)(26005)(2906002)(8676002)(64756008)(66446008)(81156014)(76116006)(186003)(8936002)(478600001); DIR:OUT; SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3l8oGvP0b8FdM+cbPBqHdwAcfMUhH4NUc0SVCuYhBTv+oa7PKG5eAAPYZWtxWQQZP+Nh789l+KLeJS1l/D1O/59SouT5n0KrT0BtyvDNYFVH/U3yXqt+dZ9N/jG3thKWWpJ1jDMGbquTZVIHI0lflJeIPPw2tdV/Q5F4351wLaHHCq8tEjhF689hyQ2ZBQZHE+Zahz+vBE86E/y2gzTlbSxGFTV3/0qkCiPlKiwuRSpTTYxy/U5dc85ub4Nu79j3tv8hHl91tfJE90uhLxBZbMftCJ/W/EsCvppWoAyATjsGpikzEAsvxFDXUoa3Tw2a53SDi2vX8Cl3b2jzZ5ikIMBTDNrp3pHzGJbaluBmlGAIxJZCTY6ecl+iuKyU19kA2zYyurQ9y99sC8/2cJGAK4PKH+kHtnAGgo2deFaM1ZJoe3ygrk3ibO8gxS7rOreC x-ms-exchange-antispam-messagedata: o9cJ0ATGz9ee6IjhXNMa/S6w2cUiosLEws89lCpL/t6nhFXZ4/GdKvA9hp39NMyf5Sivztzth49IzG981x8sQNDrn9HtsyAteaHY5pH70B7pvF/srkgfAm0GI0Aq3KK+s2tDq7Co7DACWTTTmTjPyA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 0f208bec-aaf1-48ff-019f-08d7dd480dae X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Apr 2020 12:09:43.1486 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: pg56MaVoUPEtd+43CCL2aon/3EA4QrpB0xYpsXrxj8psSGgufPCWvGCWuaBs67ltMRtnzSMR0Vl2gv2yNPsf62deH8LuWFuaZNHT1NKcaO4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3344 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [PATCH v2] net/ixgbe: fix resource leak after thread exits normally X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi Tao, > From: Zhu Tao >=20 > When the thread exits normally, pthread_join() is not called, which can > result in a resource leak. Therefore, the thread is set to separation > mode using function pthread_detach(), so that no program call > pthread_join() is required to recycle, and when the thread exits, > the system automatically reclaims resources. >=20 > Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events") > Cc: stable@dpdk.org >=20 > Signed-off-by: Zhu Tao > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) >=20 > v2 changes: > commit log. >=20 > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_e= thdev.c > index 2c57976..f141ae4 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -4165,11 +4165,9 @@ static int ixgbevf_dev_xstats_get_names(__rte_unus= ed struct rte_eth_dev *dev, > ixgbe_dev_cancel_link_thread(struct rte_eth_dev *dev) > { > struct ixgbe_adapter *ad =3D dev->data->dev_private; > - void *retval; >=20 > if (!ixgbe_dev_wait_setup_link_complete(dev)) { > pthread_cancel(ad->link_thread_tid); > - pthread_join(ad->link_thread_tid, &retval); As you already waiting for link thread termination in ixgbe_dev_wait_setup_link_complete(), do you still need pthread_cancel() here?=20 > rte_atomic32_clear(&ad->link_thread_running); > PMD_DRV_LOG(ERR, "Link thread not complete, cancel it!"); > } > @@ -4186,6 +4184,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unuse= d struct rte_eth_dev *dev, > u32 speed; > bool autoneg =3D false; >=20 > + pthread_detach(pthread_self()); > speed =3D hw->phy.autoneg_advertised; > if (!speed) > ixgbe_get_link_capabilities(hw, &speed, &autoneg); > -- > 1.8.3.1