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 C9FEEA04A5; Tue, 25 Jan 2022 02:42:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B301342800; Tue, 25 Jan 2022 02:42:58 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id CE72041186; Tue, 25 Jan 2022 02:42:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643074977; x=1674610977; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=WvC6oenr5q4682xZHD35owg4WqCbY/naUcjvyS4NeuU=; b=cMdCJyIx6ItF+FEACyXyqUsosWuP+lMhKDo4FE7+rs5sYYlVM5Xa4b5O tFU0qh1R+jMvL645v+Ipt81hT8E1DKCM4DaEjKAho1TRbrqJXMq5dlvRH kUpmIpou9WV4AZxtX0sFXTX6Lopsnw58m1VHBjrB0eawL/E1Ty3fxUGP+ s/pNEksQ1AvUxdHHmj1bd6vyN3a/mgfiTXrHfG8JIvs14DW4FCu9ZgEIA 185A3me3PzvDmZ48DzIXcg+bHiBiHjLcpWHUTuvzLt4ql4ecWQ9CY1Rev /IrD8lu3df4syypMvOh43ge1tPfmYBaJ+n8qcus8yN10RH9dyv9tQ0au+ Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10237"; a="245027957" X-IronPort-AV: E=Sophos;i="5.88,313,1635231600"; d="scan'208";a="245027957" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 17:42:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,313,1635231600"; d="scan'208";a="627726078" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga004.jf.intel.com with ESMTP; 24 Jan 2022 17:42:55 -0800 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 24 Jan 2022 17:42:54 -0800 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 24 Jan 2022 17:42:54 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Mon, 24 Jan 2022 17:42:54 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.172) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Mon, 24 Jan 2022 17:42:54 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g/g+vA731BTttE3InoV7v6esNJk4gWF2FACIZb863GYD9n6AV4cy66EoY/DNtgWF2vBRORx/FkfcMn/QRAKmS9Y4jy3vptpcMNE3mLy3PLeZi492QnClBKPDjKor50v70Zom48eII2JS2NNlM532XYIu6nKTpCG3udWP5aQzny4n8nzNHPmKImUXso/7xneQ+moXqEHmlzbShuiJrySozVi/izzdfs3UeMuXF2v7QjnAXRaMa+IqmY++FnvBqiA/tPOwNvpZP26EzLp5tEy2Ip8wyS4xdfi3UG+tE+ZtdB61JuC798PxPJXyJifVZUeq3OIE8ETER3aTMjk+CLjDQg== 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=cWFogPB0syobN2hoFtVJK4kwxHmPIy1m3fJG3PtrdFE=; b=k68bxzzWgqKaJxHppjy3Dxkegfx58GVAkuZgXIa4nM2SFibPX38UJCk2wKrrjV+HvZDf10UFhl6Pvbo4ftT30HNj5SQDBgcx9yqn2ZXeXy6oXNbVR81TbdQLxNTWaQLCizuopfUGBmWUu7L3Phu5n3WWHAj2gYVRwNyIeLRYJnXBcTDxQQgLXQAGoTbBvAN0bBDBfiOAb8S0BQAkPM3cTDC2SrbH0pyiOAnrSmirCJT7tdk7qonN50xjoRiqEscFyKNbgEVpit0DKEgiYsgANeECIRvKJ3pq4RPCaSWIpVZ9XCMNO7v35bSKCeM+fdU6oyXYgGpbCgsTEUNy5R/kIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DM6PR11MB4252.namprd11.prod.outlook.com (2603:10b6:5:201::26) by MW3PR11MB4651.namprd11.prod.outlook.com (2603:10b6:303:2c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Tue, 25 Jan 2022 01:42:50 +0000 Received: from DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::88d0:b735:5126:3fb0]) by DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::88d0:b735:5126:3fb0%4]) with mapi id 15.20.4909.017; Tue, 25 Jan 2022 01:42:50 +0000 From: "Xu, Rosen" To: "Huang, Wei" , "dev@dpdk.org" , "Zhang, Qi Z" CC: "stable@dpdk.org" , "Zhang, Tianfei" , "Yigit, Ferruh" , "stephen@networkplumber.org" , "david.marchand@redhat.com" Subject: RE: [PATCH v8] raw/ifpga: fix pthread cannot join Thread-Topic: [PATCH v8] raw/ifpga: fix pthread cannot join Thread-Index: AQHYENXvBs843YuxZEK5yhgLaLD1KKxy9/qg Date: Tue, 25 Jan 2022 01:42:50 +0000 Message-ID: References: <20220124023912.18650-1-wei.huang@intel.com> <20220124035005.18955-1-wei.huang@intel.com> In-Reply-To: <20220124035005.18955-1-wei.huang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDZlMzY4NjEtMGNkMS00MTY2LWIyOWMtM2YxMDhmZGM2MTFiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiU0dFd2RZTUR0NkFJMVVyYkh3WFBTVHRlXC9KOEZUOEJyYnVDZGhsUDkreVpmRDFLRmxCbjhWeUFHNzlKWFVqVVwvIn0= x-ctpclassification: CTP_NT authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 306d6a60-b648-4c3f-a606-08d9dfa3ff7e x-ms-traffictypediagnostic: MW3PR11MB4651:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:17; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: K/x8CQXdHiJE2U7xL1JHxbQ2KELx6sHqdl9r+UVln6zOHNalW9la1IqY0fQaFWyNrg8SuEQEMwUP5XolWiJ4rEb/ZdcZIl+LJXMBWYDetvbLIaELN5qFn0BQOM3sw7ST9vDnKI1tifRxRQ+njsfUXjUThKh1QRAyfqM6Wp1cmsuyibyL6jpmCDwgalvkY4ISPxRwJVKXZEMQNc3x+BuqFedu2Faf+SpNrK7UTKft61FBVR0C15WbtavVTB4j6mVslKaxJc9DmB3DKDF8onvScdglQOdit9balyS4VGRTxN3awRBz9cVeGYSbqhLd+4INdiPAeVvwuNwkPfNmfXMblIs0QbbHRUjjPtGEblfNCu8m5NIhqFmiRcBIAK95rJoO6MCQKXHlIV7kok02IiASjeWAaRg6R63zSlYlCApTziZRokcV7F61IoWCGlv4lJrybMpYO+VLcsKBkXFxuqwtyXxh6Clm26GTz7Rf395f2nXc0H9zY74e0VrBDk3OhxSEHeh7KaNU9sEDUo2WPqtbnrnSgbf2nSpxhDjQDuKDumryGgoWREqjL7QYnkKfzzzQLX4HczkNF7sMLwcyHNeU+yBR+i5wqJeO7/VYRawxO7/5lTBi82Dm2+2ynLa71ZONFeBEnJTtWF1vA4aVmsVtGl9vcK8pBI2PXV7ldbDYlyjZGDjKenLv8V4Z2YSUZBrjBOfcuz8WjhRI//hLgley02BOomG3abNzfmgUIVWIMpI= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4252.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(5660300002)(76116006)(38070700005)(64756008)(66446008)(110136005)(8936002)(52536014)(54906003)(8676002)(82960400001)(4326008)(55016003)(33656002)(83380400001)(122000001)(6506007)(26005)(71200400001)(6636002)(2906002)(316002)(9686003)(508600001)(86362001)(186003)(53546011)(7696005)(38100700002)(66946007)(66556008)(66476007)(21314003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0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uqLivUEA6tXlJ?= =?us-ascii?Q?rSXgg/bP+jSqCfG4B80XJMMgD3x8qnipn9sNwSNlpvcWfHB9a4KJMpxgph0L?= =?us-ascii?Q?+z5RZBrU8PNibSpZhJLaUdKdu+f0zrdCL4UH4weR/Lj5Sa5lFBSC0/ethy5p?= =?us-ascii?Q?220DKBOtH8Kh02rifM1Dq21nq/TwXdImMBFJm5knXsr5CNCyC28U7ElY9/0Z?= =?us-ascii?Q?t2ftZwl1p+Iulez8RAtsib7E91sc9eJLbgIFkPdgom84S+/7jLvTOxPFZxOa?= =?us-ascii?Q?yjW3hc+b/eADrAZ7/Eihuh1GYohKdywzsb97KuMX86OfYmWo7gzWPrQ2Pr0W?= =?us-ascii?Q?TlbGanToSdfkUAKdMIKAej+jI8SNKxGLLSuc3DWbT3AUAJrsjxu7aqXj2XRV?= =?us-ascii?Q?NpzNVw/Ar6ME3OF4MfEJXLgXWKBEimNuTIhNEj9OKaqp40v4y0db34wGnHK5?= =?us-ascii?Q?nOkhpGvJWGBn1GeRJ5H/KWrzEtlxtQH+0CZ4VEhZ0EaxVgmrRtj1bRIu42+P?= =?us-ascii?Q?a14snGLJRAm3Q+evZ3Zt8Qd8KNdA0YCcl5/WuSzePBb7Sp9wKgBz2nqfrErI?= =?us-ascii?Q?l0eXZ0aIBcF4Nih0jor29lFrMAyZ+yjNeo3jb59E1ZojMa++xmfv5ZSMVffd?= =?us-ascii?Q?7Bq2i7K/d97mXTn8MZKtAKEFuu9CnOUCWgGEbACwOJvvJ4jL7eBLkt5vSgBL?= =?us-ascii?Q?y5m0fj1JyPzt1/sHwpNk4diIbXIJeqUEhehuFTyZz2s+y4N1A9ehT4XEvMya?= =?us-ascii?Q?gA=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4252.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 306d6a60-b648-4c3f-a606-08d9dfa3ff7e X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jan 2022 01:42:50.7383 (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: NNjUYG5JNDUKqeshDG2Fk+wwqP9gyrmsVoXISkxtSRf1A6v2+0z29FgwsE4/DSgnuvIqZNlY8zmB5HH71xy+1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4651 X-OriginatorOrg: intel.com 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, > -----Original Message----- > From: Huang, Wei > Sent: Monday, January 24, 2022 11:50 > To: dev@dpdk.org; Xu, Rosen ; Zhang, Qi Z > > Cc: stable@dpdk.org; Zhang, Tianfei ; Yigit, Fer= ruh > ; stephen@networkplumber.org; > david.marchand@redhat.com > Subject: [PATCH v8] raw/ifpga: fix pthread cannot join >=20 > From: Tianfei Zhang >=20 > When we want to close a thread, we should set a flag to notify thread > handler function. >=20 > Fixes: 9c006c45 ("raw/ifpga: scan PCIe BDF device tree") > Cc: stable@dpdk.org >=20 > Signed-off-by: Tianfei Zhang > --- > v2: update commit log > --- > v3: set thread id to 0 after pthread_join > --- > v4: do not evaluate and set pthread_t variable > --- > v5: use builtin atomic function to access ifpga_monitor_start flag > --- > v6: use __atomic_xxx_n to replace rte_atomicNN_xxx > --- > v7: fix typo > --- > v8: solve patch applying issue > --- > drivers/raw/ifpga/ifpga_rawdev.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/raw/ifpga/ifpga_rawdev.c > b/drivers/raw/ifpga/ifpga_rawdev.c > index 8d9db58..19c2357 100644 > --- a/drivers/raw/ifpga/ifpga_rawdev.c > +++ b/drivers/raw/ifpga/ifpga_rawdev.c > @@ -497,7 +497,7 @@ static int set_surprise_link_check_aer( > int gsd_enable, ret; > #define MS 1000 >=20 > - while (1) { > + while (__atomic_load_n(&ifpga_monitor_start, > __ATOMIC_RELAXED)) { > gsd_enable =3D 0; > for (i =3D 0; i < IFPGA_RAWDEV_NUM; i++) { > ifpga_rdev =3D &ifpga_rawdevices[i]; > @@ -525,7 +525,7 @@ static int set_surprise_link_check_aer( { > int ret; >=20 > - if (ifpga_monitor_start =3D=3D 0) { > + if (!__atomic_load_n(&ifpga_monitor_start, __ATOMIC_RELAXED)) { > ret =3D rte_ctrl_thread_create(&ifpga_monitor_start_thread, > "ifpga-monitor", NULL, > ifpga_rawdev_gsd_handle, NULL); > @@ -534,7 +534,7 @@ static int set_surprise_link_check_aer( > "Fail to create ifpga monitor thread"); > return -1; > } > - ifpga_monitor_start =3D 1; > + __atomic_store_n(&ifpga_monitor_start, 1, > __ATOMIC_RELAXED); > } >=20 > return 0; > @@ -544,7 +544,9 @@ static int set_surprise_link_check_aer( { > int ret; >=20 > - if (ifpga_monitor_start =3D=3D 1) { > + if (__atomic_load_n(&ifpga_monitor_start, __ATOMIC_RELAXED)) { > + __atomic_store_n(&ifpga_monitor_start, 0, > __ATOMIC_RELAXED); > + > ret =3D pthread_cancel(ifpga_monitor_start_thread); > if (ret) > IFPGA_RAWDEV_PMD_ERR("Can't cancel the > thread"); @@ -553,8 +555,6 @@ static int set_surprise_link_check_aer( > if (ret) > IFPGA_RAWDEV_PMD_ERR("Can't join the thread"); >=20 > - ifpga_monitor_start =3D 0; > - > return ret; > } >=20 > -- > 1.8.3.1 Acked-by: Rosen Xu