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 0526BA0A0B for ; Tue, 26 Jan 2021 14:37:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D95971414C1; Tue, 26 Jan 2021 14:37:45 +0100 (CET) Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by mails.dpdk.org (Postfix) with ESMTP id B1796140CC2; Tue, 26 Jan 2021 14:37:43 +0100 (CET) Received: by mail-io1-f50.google.com with SMTP id p72so33490414iod.12; Tue, 26 Jan 2021 05:37:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3Oc/wJu+gY3KuFxQwqZdX/imgdMv2a6hHQcS7UN1WIw=; b=PA9NfYkXeh/pi28e0ELBQAt6xCUYxXbO1w+KaixlR5pI9UUatIocJMqX6GVuKd9DXC eLmVvV75nSuh+9D1rvpym4b0t76h0JBVJKxEsBiGCZmSJ0BcnO6atkXiSy8qL0G0N+At b9jMt+l2XRwgNTP+fGGvbS4vMFDJ+I6993MPQ4j2EXbkjTT6XwP6OpBFP80jfWsV9r3T TtfTsCnw/6eJwVX1UNTQhKj9MYo9M3SRhw6yr1XPvDXWibFsvCj35uxNvHO0qFRE+hXi LkKlXJRC8JefuZbBwMsVPFIQEmToo7/HkRWxz9yH68Ff75+9hvkESzHZ9Ogmgb/IpJq1 4fHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3Oc/wJu+gY3KuFxQwqZdX/imgdMv2a6hHQcS7UN1WIw=; b=Z8wbdHiHPOBrCZqk6FrKY9KKatW7tT/I38ZnhyB6LK7lFJgznocEuYV0dYY5gRoqPC RJKjoeeoXDjpdA+iYBkfXoNwWiys6KbYc4NUN9fE+81WETL/5Dtxw+Y8oEyPxWaYtAlp sxiGo92xW6nDgbhBsMYjdzI4VkCYug+vzmRvSwuxDBA8RjDCISqYZ0sPPSFhmHUpzm3l JzcJLCvUMWJnqA60oBmL6cmUGRMt7cKpwe6E0+4byI9N8DcOtrx6R1ygs0i6/E30om5a dXnhWHXAk+c0cirh7Vb9R1nAvFsSN+2NCeaAjPzAayTRFxcZSBSTH6UsVzyOaWmK3FTW DY7w== X-Gm-Message-State: AOAM5300m19jjLZJDuyS6mp+kRP9gyt3IntXYdWVLYHeZHSpsO/5PoAF 6/r03qBvmGodx/nqiGyZ82XGKWObnw2vEcoSpB0= X-Google-Smtp-Source: ABdhPJxJLTqqYy5FsWmjt8zLF8WhcJE6LDMMd4NkF6fpn/ngVwl4cUdPCsd42DEgqb/pL1f6LtVYpwM6+euRPYHO958= X-Received: by 2002:a02:5ec1:: with SMTP id h184mr4697125jab.133.1611668263067; Tue, 26 Jan 2021 05:37:43 -0800 (PST) MIME-Version: 1.0 References: <20201221053454.47307-1-feifei.wang2@arm.com> <20210114103101.738262-1-feifei.wang2@arm.com> <20210114103101.738262-4-feifei.wang2@arm.com> In-Reply-To: From: Jerin Jacob Date: Tue, 26 Jan 2021 19:07:25 +0530 Message-ID: To: Pavan Nikhilesh Bhagavatula Cc: Feifei Wang , Harry van Haaren , Pavan Nikhilesh , Nikhil Rao , "dev@dpdk.org" , "nd@arm.com" , "stable@dpdk.org" , Ruifeng Wang , Honnappa Nagarahalli Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] [dpdk-dev] [EXT] [PATCH v4 3/3] examples/eventdev: move eth stop to the end 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" On Mon, Jan 25, 2021 at 11:22 PM Pavan Nikhilesh Bhagavatula wrote: > > >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. > > > >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 > > Acked-by: Pavan Nikhilesh Series applied to dpdk-next-eventdev/for-main. Thanks. > > >--- > > 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 3526d4d3d..4621e8a89 100644 > >--- a/examples/eventdev_pipeline/main.c > >+++ b/examples/eventdev_pipeline/main.c > >@@ -311,7 +311,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); > >@@ -322,17 +321,6 @@ signal_handler(int signum) > > rte_event_dev_dump(0, stdout); > > once = 1; > > fdata->done = 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 == SIGTSTP) > > rte_event_dev_dump(0, stdout); > >@@ -483,6 +471,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 >