From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 541ACA0A01 for ; Tue, 5 Jan 2021 11:09:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 436231607F1; Tue, 5 Jan 2021 11:09:23 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 17D631607E8; Tue, 5 Jan 2021 11:09:20 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 105A6MjU012711; Tue, 5 Jan 2021 02:09:14 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0220; bh=P3jjg3J6ofLJOiBMfYtqPK7k+FZqI9Tj22RqW0WfKA0=; b=PYtj6PG70LIQQi8+XE7E0py4DbbyQ0pyBjgCV3BIy+Pks/HjFLCAVIwSGJnb80NXL3Ep VlV5O/8UIejVD+EIF1jeumXG32E04kpOWhGfbMxEwUmJBcLRiGpAhPu6fbDe2isoIPmM 4O286TGjFYTJqIYHl5N8bQXg8s31XYcOOggvHLZ7kbw0PnLW6J+M6PUebkzgJ6whlWqg tP7vG8pVGgURCWDuIgk81W1WC5Xl2J7tyoeJeIzLXySJijtXFAfGuUI+GUGfmSlCN0A6 NWy1yxHt8jnEnO5XMlPBk4qsYII1OVrzL23G3CR2U9gfZSS6tGP2OCBO6brmpQN6rw/B QA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 35tq2ue515-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 05 Jan 2021 02:09:14 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 5 Jan 2021 02:09:12 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Tue, 5 Jan 2021 02:09:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AHEyQIdQ2DwedbHZ5nI3TRzXNoclRblg6vHCwYEEfV5zJV0kvyvVF1hJ5t08xrsrZ/9lc7tItx5m40B+BzjPJ8aS0AL04Y3VpVjcI8budIDrcIspQxz45B0NBzWlKWUfutACvR2oKRDXz8cIap4M14fP07xh4t8xlogzQhv9DEqTjxQZ+TCKYrnxkg5bB98qPHjJSbJxnHc+8HKwslNyvfRCiPf+FVUUDKjb5VHLAiSR1hRC+HY9SuSN023tEce/J00qOvhvuymFNAPK+wYSAT85CSqdeXli+Zeh0neWyBDNLylSu25CisPmbJm4bi0Hjyc6N/EWz5j+f+wjO2fcTA== 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=P3jjg3J6ofLJOiBMfYtqPK7k+FZqI9Tj22RqW0WfKA0=; b=nBbuoYxg86WL1aDaVzTzsg8tkfPPxkLCK5bHwTCcTts6boinvAws/dWx4TGslOit+wh58DTMgCZtyalhaQzHYfgnU7A6Qb7yG9F58LMByNaE8t1JmqUG+DqLCzXvrb26BzvzwCAkt2Tb9nPpnw0woij51WFPh6PQdW3UWurK0MR9ICeNQB5RdmXJXZNBuxxsYNfwiqMvDGmr1ua731Mj8lLZDhA7xo/VUMZpUcdT/J/LO1rTzTbd1HXIdB0M61qjCbVd1CVjMLwXhMMbUnEDT3z4pPAeNw3Qu8k3ooXXdvRNSrXKVvInQsR+67ylMK0lrzNDJ13Q3QVf2T6HXrBUEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P3jjg3J6ofLJOiBMfYtqPK7k+FZqI9Tj22RqW0WfKA0=; b=gIqClVFUBsgKLv1nvTitK5j0kQ+xXP932cPC/Km3SagBg6ltp2mNT49dcLbNEmKtAO/5MhQ1RbvFmFstSQ82UOxqyVPtxdSXAvoD0I/Jazdg2KHyI3g4TgjMw47ZmRGNBzfWqyf7rCGPqDuW0KNqkI3GZdyu+SN3CD/Y4IR/HaE= Received: from CO6PR18MB3828.namprd18.prod.outlook.com (2603:10b6:5:346::20) by MW3PR18MB3610.namprd18.prod.outlook.com (2603:10b6:303:52::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Tue, 5 Jan 2021 10:09:11 +0000 Received: from CO6PR18MB3828.namprd18.prod.outlook.com ([fe80::5c2c:a13a:4f3d:94df]) by CO6PR18MB3828.namprd18.prod.outlook.com ([fe80::5c2c:a13a:4f3d:94df%5]) with mapi id 15.20.3721.024; Tue, 5 Jan 2021 10:09:11 +0000 From: Pavan Nikhilesh Bhagavatula To: Feifei Wang , Harry van Haaren , Nikhil Rao , "Pavan Nikhilesh" CC: "dev@dpdk.org" , Jerin Jacob Kollanukkaran , "nd@arm.com" , "stable@dpdk.org" , Ruifeng Wang , Honnappa Nagarahalli Thread-Topic: [EXT] [PATCH v3] examples/eventdev: refactor ethdev port stop Thread-Index: AQHW4yHR0ulOXSG390yt7145A00HJqoYy3KQ Date: Tue, 5 Jan 2021 10:09:11 +0000 Message-ID: References: <20201221053454.47307-1-feifei.wang2@arm.com> <20210105051401.435393-1-feifei.wang2@arm.com> In-Reply-To: <20210105051401.435393-1-feifei.wang2@arm.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=marvell.com; x-originating-ip: [2405:201:d009:380f:dd34:bb91:5919:5edb] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0867a179-cbe9-4d9d-2967-08d8b161f2df x-ms-traffictypediagnostic: MW3PR18MB3610: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yOYb3TUWoWOQ0x3HLCCdgPBCZc/fw6nh0Wnc+UJBYhPsHFpd1sVC6d5JjniNlPwiX7v3JgMjpvSD6qDPB/KXviWzKQGPl0x4t7ajC27DpAvtDRQZucyiDiBC2V7re9K71smaATStKicf5yC2Z0eGujrRQ7HiNvSme+l+ikuwgy2ishWuPro6hyGf2l2K5EntWtn4VbOOaZ52EZZxggd1qB6juv1o9Q2RnKR6RMJqRA+CbiLa77GCAoC+3KCAX5aKUnoioP6cMQqd/L0NA/28mejRWzVaBuM9pQf4knQ4r1f0moMd/mTu22hFsGbcc01PTgT5xVG047DbSdxQC0UZFTJbhlWgQ0Od/KSlE1mzkVYdWcOjmHRVl1a8lbce9hREgjpKmieKC1/21s3IZN/VnA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB3828.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(7696005)(5660300002)(83380400001)(52536014)(110136005)(54906003)(71200400001)(186003)(498600001)(4326008)(33656002)(76116006)(86362001)(8676002)(55016002)(8936002)(66476007)(6506007)(9686003)(64756008)(2906002)(66556008)(66446008)(66946007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?LWl11EXk3SGbUGNnUV6KGzEooDTei9mymlQtO1eSmMuNB1vSjfk8xmphAjcO?= =?us-ascii?Q?boi1FnJ2OC+z1pvXLNCPQ920oYLYo+o3e4G3numOmuCU3Rc4QzZqdBS5MUvL?= =?us-ascii?Q?OslrySP/StRr5rC/+VLhffzOYZh4zyMqAxDgZqGYD/OXSYNFbPG4kcGuoXVF?= =?us-ascii?Q?IbHXZIS1pzkL5BLRAP3YlDnPeKdZjpBce9vjLHIxFgBFC24FoUw2Is7jH+8I?= =?us-ascii?Q?uSCrFrKKve6JaOVjOssWS0m5mjsGRuqTRxV5j/OOq7DHRTK2WAFQnag9u0ue?= =?us-ascii?Q?+9rCTx5JYh2q71aai0WdkgGiMiYejkT3odz027LewV3qCUBUcLldByVYGpqh?= =?us-ascii?Q?OxTKK6+tZeLUrRO1PamfCi+FLQni5Kk7zMu8kpUD+zqEis0VeG56hNO/tNt+?= =?us-ascii?Q?BGi2LdEd06ReSI17Ii1sWLiSBOlVf4CConiemYNYPVU+Eok95p7Lm/dyc5dq?= =?us-ascii?Q?6U83x1gr5igvjk26AnuLg/5aIR2nR2CJkc6VyYKrFjlK/3hzT43hJv+YP9Gi?= =?us-ascii?Q?jLH9TDVpawi2kiTmcBqX9P924y9eaoc5rn4psB428GlI3ewTMoay5NjvsV7A?= =?us-ascii?Q?zJocI2lv1u73/JeXAHAeCPNSxxqhLt3ddNnlk2pFmE4Q05CVbTPTAnaMfCmF?= =?us-ascii?Q?I/wZe4p27xUasEJn85NwU/lmludbmbvQ5sk1L37aQY2l1WvveKo4qwkZ/H5e?= =?us-ascii?Q?SGJFW/EdrxcLzl27H3LESNnyikeYkAteNkx3Ojcd2g1JU1dj6w8XZMU6eIWf?= =?us-ascii?Q?g5abhRYac3IT1jWzGctJ0C4UI10T0FgKU9Qfm3IPtiRDIvao1Z1xCTBuawMe?= =?us-ascii?Q?DTZ/t78pMnISmSos8u8oObY1OeH4BOH9LrnoB18RhlSMU+app/s7zGYBmJks?= =?us-ascii?Q?qq2NOv1Rg7OB74aqyooX/71WmeJqgoUdn4sjiw5YGLsW3xw3OMLccgo3/TEp?= =?us-ascii?Q?b7Rs0fu8MfFrVbTjpHC/bOswsyrrta4urMBclPAX4bNBeaMwSwwNFWGX+3jp?= =?us-ascii?Q?NowKlhhjM+PNKgOrURJPdHQV5bBo9eYXVJ5kr3R+ICscGT0=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: CO6PR18MB3828.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0867a179-cbe9-4d9d-2967-08d8b161f2df X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2021 10:09:11.6814 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: E64ZI1SmGqp3lYq/jnwx2ksti0GnDwaM6z/DFJDI/YBAJztskNPNoOVykch0RUPA98pfp9fbU8vTkL9LmtBLhFZYy2hYHvi8iWvMgtStspE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR18MB3610 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-05_01:2021-01-05, 2021-01-05 signatures=0 Subject: Re: [dpdk-stable] [EXT] [PATCH v3] examples/eventdev: refactor ethdev port stop 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 Sender: "stable" Hi Feifei, >Move eth stop code from "signal_handler" function to the end of >"main" >function. There are two reasons for this: > >First, this improves code maintenance and makes code look simple and >clear. Based on this change, after receiving the interrupt signal, >"fdata->done" is set as 1. Then the main thread will wait all worker >lcores to jump out of the loop. Finally, the main thread will stop and >then close eth dev port. > >Second, for older version, the main thread first stops eth dev port and >then waits the end of worker lcore. This may cause errors because it >may >stop the eth dev port which worker lcores are using. This moving >change >can fix this by waiting all worker threads to exit and then stop the >eth dev port. Apologies for the delayed reply, In case of event dev the workers don't interact with eth device directly,=20 Instead eth device "injects" packets into event device and event device is responsible for scheduling them to the workers. If the producer is not stopped i.e. in this case eth device then the worker threads might never exit and the main core would wait indefinitely for workers to exit. This will be predominantly seen in cases where there are only a few flows and large number of workers causing a lot of intra thread dependency. Regards, Pavan. > >In the meanwhile, remove wmb in signal_handler. > >This is because when the main lcore receive the stop signal, it stores 1 >into fdata->done. And then the worker lcores load "fdata->done" and >jump >out of the loop to stop running. Nothing should be stored after >updating >fdata->done, so the wmb is unnecessary. > >Fixes: 085edac2ca38 ("examples/eventdev_pipeline: support Tx >adapter") >Cc: pbhagavatula@marvell.com >Cc: stable@dpdk.org > >Suggested-by: Ruifeng Wang >Signed-off-by: Feifei Wang >Reviewed-by: Ruifeng Wang >Reviewed-by: Honnappa Nagarahalli > >Acked-by: Harry van Haaren >--- > >v2: >1. Delete unused variable to fix build error >2. Reduce commit message length to fix coding style issues > >v3: >1. Title improvement (Van Haaren) > > examples/eventdev_pipeline/main.c | 16 ++++------------ > 1 file changed, 4 insertions(+), 12 deletions(-) > >diff --git a/examples/eventdev_pipeline/main.c >b/examples/eventdev_pipeline/main.c >index 823f8b51c..fdbaf667b 100644 >--- a/examples/eventdev_pipeline/main.c >+++ b/examples/eventdev_pipeline/main.c >@@ -280,7 +280,6 @@ static void > signal_handler(int signum) > { > static uint8_t once; >- uint16_t portid; > > if (fdata->done) > rte_exit(1, "Exiting on signal %d\n", signum); >@@ -291,17 +290,6 @@ signal_handler(int signum) > rte_event_dev_dump(0, stdout); > once =3D 1; > fdata->done =3D 1; >- rte_smp_wmb(); >- >- RTE_ETH_FOREACH_DEV(portid) { >- rte_event_eth_rx_adapter_stop(portid); >- rte_event_eth_tx_adapter_stop(portid); >- if (rte_eth_dev_stop(portid) < 0) >- printf("Failed to stop port %u", portid); >- } >- >- rte_eal_mp_wait_lcore(); >- > } > if (signum =3D=3D SIGTSTP) > rte_event_dev_dump(0, stdout); >@@ -465,6 +453,10 @@ main(int argc, char **argv) > } > > RTE_ETH_FOREACH_DEV(portid) { >+ rte_event_eth_rx_adapter_stop(portid); >+ rte_event_eth_tx_adapter_stop(portid); >+ if (rte_eth_dev_stop(portid) < 0) >+ printf("Failed to stop port %u", portid); > rte_eth_dev_close(portid); > } > >-- >2.25.1