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 3ECCFA04B0; Sun, 18 Oct 2020 11:25:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1FD09CF7F; Sun, 18 Oct 2020 11:25:37 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 11DB4CF7D for ; Sun, 18 Oct 2020 11:25:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603013134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dhAC9FnMLB4ch3OeaRdgs7tTLLDNovPOipmsIjJ6E/M=; b=Eu3m0XBqXNPNOM7DdG2kv8UyAvN6kSQlyrtEbAIKql35mXcRF67PXSsZeseJPa92XMfwx8 D/dvoIE9oqZ6WclClsEyPtfMMdwZH6F8rNnCVg5G1y+s4aYCoNgg1o677UbuSWCp4cs9rn A7PwuErGBjr3bI/jPKd+cFh1COqgwzM= Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-147-4HXNG2R2PaKHb2fvoaYm9A-1; Sun, 18 Oct 2020 05:25:31 -0400 X-MC-Unique: 4HXNG2R2PaKHb2fvoaYm9A-1 Received: by mail-ua1-f69.google.com with SMTP id 36so889062uaw.18 for ; Sun, 18 Oct 2020 02:25:31 -0700 (PDT) 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=dhAC9FnMLB4ch3OeaRdgs7tTLLDNovPOipmsIjJ6E/M=; b=mxHLiVXy1dz/BYC9PX9gjjEdfX2C4XvDUlc7Gzfohg0E7yaPeGU7tjbjNk1ldnSXeh umGVISXEHRTPE9hFdLn8RF6oGPiYx0py/l7RT5Nv9wHGNmz2OzJUg9da0YaM0zyZYxDY eb3larLjmjQeiME34ustv9P4fX9huGHLOcpZAglholvz0YhXrSrNOsycrDSjwG+syBZd RvCykWaBlesg3beyx7ZMG8jAm6DMYCpaBh0DneqIJEtF0L6KjC3zfB/dBAB2hcSfOCuJ 5U47POfLOzSKQ4h0IpoKTprtxrz+/NPXegfm6DkfPFHUM0dJ2ETtu79e38l8cbeyqGLB BO+g== X-Gm-Message-State: AOAM531W7+zlc/pKO2aDkPMY2xLKb4j84HNJjB8Vc5OOYHnnEDKlwGVR xCUeO7PSBUtI0+R6IjqEuTOsKJJ1UxciACulo6u49QODilm3WQZ2WA1zN5y5Ju/c4lhVT7JerqK NLIttEqFl8caLMpYN2hM= X-Received: by 2002:a1f:9651:: with SMTP id y78mr6412264vkd.22.1603013130972; Sun, 18 Oct 2020 02:25:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOaIEcV2BkuK9z4ps8em1k0WGpvISF6JdDOikTNmyvcKKnWJgyqEDgDSHQ8iguk/tPsVg6N3aJuZmIQx+XBnY= X-Received: by 2002:a1f:9651:: with SMTP id y78mr6412255vkd.22.1603013130751; Sun, 18 Oct 2020 02:25:30 -0700 (PDT) MIME-Version: 1.0 References: <20200826055233.26075-1-rohit.raj@nxp.com> <20201008153048.19369-1-rohit.raj@nxp.com> <20201008153048.19369-2-rohit.raj@nxp.com> In-Reply-To: <20201008153048.19369-2-rohit.raj@nxp.com> From: David Marchand Date: Sun, 18 Oct 2020 11:25:19 +0200 Message-ID: To: rohit.raj@nxp.com Cc: Anatoly Burakov , dev Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v4 2/5] examples/multi_process: cleanup bus objects while terminating app X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Oct 8, 2020 at 5:31 PM wrote: > > From: Rohit Raj > > Certain bus objects may need to be closed and re-acquired > while terminating and rerunning the client application. > Hence a signal handler is required to catch the termination > of the App and hence closing the bus objects. > > This patch adds the missing signal handler in the client > app and closes the Bus objects in both client and server > applications when the signal Handler is called. > > Signed-off-by: Rohit Raj > --- > .../multi_process/client_server_mp/mp_client/client.c | 11 +++++++++++ > .../multi_process/client_server_mp/mp_server/main.c | 4 +++- > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c > index 361d90b54..c37516b4c 100644 > --- a/examples/multi_process/client_server_mp/mp_client/client.c > +++ b/examples/multi_process/client_server_mp/mp_client/client.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -196,6 +197,14 @@ handle_packet(struct rte_mbuf *buf) > > } > > +static void > +signal_handler(int signal) > +{ > + if (signal == SIGINT) > + rte_eal_cleanup(); > + exit(0); > +} Calling rte_eal_cleanup from a signal handler is a bad idea. In most cases, you are racing with other threads still using DPDK resources. https://git.dpdk.org/dpdk/commit?id=2c434431f4 https://git.dpdk.org/dpdk/commit?id=613ce6691c This might not be a problem in this multi_process example, but let's keep a consistent way across all examples. Thanks. -- David Marchand