From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F007C43219 for ; Tue, 30 Apr 2019 09:42:19 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id D27A32080C for ; Tue, 30 Apr 2019 09:42:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D27A32080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 89C0F5F36; Tue, 30 Apr 2019 11:42:17 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 146A85F32 for ; Tue, 30 Apr 2019 11:42:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 02:42:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,413,1549958400"; d="scan'208";a="166212864" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.113]) ([10.237.220.113]) by fmsmga002.fm.intel.com with ESMTP; 30 Apr 2019 02:42:13 -0700 To: "Suanming.Mou" , dev@dpdk.org Cc: vipin.varghese@intel.com References: <1556595548-53745-1-git-send-email-mousuanming@huawei.com> <1556624124-54930-1-git-send-email-mousuanming@huawei.com> <1556624124-54930-2-git-send-email-mousuanming@huawei.com> From: "Burakov, Anatoly" Message-ID: <655f3c30-b277-fad7-6a68-64dd70fd3601@intel.com> Date: Tue, 30 Apr 2019 10:42:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1556624124-54930-2-git-send-email-mousuanming@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5] app/pdump: add pudmp exits with primary support. 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 30-Apr-19 12:35 PM, Suanming.Mou wrote: > When primary app exits, the residual running pdump will stop the > primary app to restart. Add pdump exits with primary support. > > Suggested-by: Varghese, Vipin > Suggested-by: Burakov, Anatoly > Signed-off-by: Suanming.Mou > --- > static void > +disable_primary_monitor(void) > +{ > + int ret; > + > + /* Don't worry about it is primary exit case. The alarm cancel > + * function will take care about that. */ > + ret = rte_eal_alarm_cancel(monitor_primary, NULL); > + if (ret < 0) > + printf("Fail to disable monitor fail:%d\n", ret); Double fail :) > +} > + > +static void > signal_handler(int sig_num) > { > if (sig_num == SIGINT) { > @@ -910,6 +936,19 @@ struct parse_val { > ; > } > > +static void > +enable_primary_monitor(void) > +{ > + int ret; > + > + /* Once primary exits, so will pdump. */ > + ret = rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL); > + if (ret < 0) { > + cleanup_pdump_resources(); > + rte_exit(EXIT_FAILURE, "Fail to monitor primary:%d\n", ret); > + } Why is this function void, when you could've called rte_exit() in the caller on failure? And why is it such a fatal error to set up the timer? IMO just a warning would've been enough. > +} > + > int > main(int argc, char **argv) > { > @@ -950,11 +989,13 @@ struct parse_val { > rte_exit(EXIT_FAILURE, "Invalid argument\n"); > } > > - /* create mempool, ring and vdevs info */ > + /* create mempool, ring, vdevs info and primary monitor */ > create_mp_ring_vdev(); > enable_pdump(); > + enable_primary_monitor(); > dump_packets(); > > + disable_primary_monitor(); > cleanup_pdump_resources(); > /* dump debug stats */ > print_pdump_stats(); > -- Thanks, Anatoly