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 EFA36A0A04 for ; Mon, 18 Jan 2021 12:47:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E2B7A140E52; Mon, 18 Jan 2021 12:47:53 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 29109140E36; Mon, 18 Jan 2021 12:47:50 +0100 (CET) IronPort-SDR: TFhLyDIEtRfKgiN2wgLDF4dvdUg615vguwd2nWgjeXPzum6EmaIyzd2Gt9cz9JwFKU4B/TwDsh 63LozVmucFkg== X-IronPort-AV: E=McAfee;i="6000,8403,9867"; a="166459542" X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="166459542" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 03:47:49 -0800 IronPort-SDR: gEB15wK04gfx8PYWxp/Hl3Cc8zGRfLBIUv/gEzWfrbb8Ydc70VMgxJJuDq/U2UlENwH3BVLE4H A+GWaWpwj4cQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,356,1602572400"; d="scan'208";a="569165127" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga005.jf.intel.com with ESMTP; 18 Jan 2021 03:47:47 -0800 Received: from shsmsx604.ccr.corp.intel.com (10.109.6.214) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 18 Jan 2021 03:47:46 -0800 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by SHSMSX604.ccr.corp.intel.com (10.109.6.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 18 Jan 2021 19:47:44 +0800 Received: from shsmsx603.ccr.corp.intel.com ([10.109.6.143]) by SHSMSX603.ccr.corp.intel.com ([10.109.6.143]) with mapi id 15.01.1713.004; Mon, 18 Jan 2021 19:47:44 +0800 From: "Yu, DapengX" To: "Li, Xiaoyun" , "Xing, Beilei" , "Lu, Wenzhuo" , "Iremonger, Bernard" , Stephen Hemminger CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: avoid exit without resource release Thread-Index: AQHW2aj5/CAd4DaR5Ey10dRM51y+NaoGm42AgACSPZCAIPhQcP//pQqAgAA7HYCABV+q4A== Date: Mon, 18 Jan 2021 11:47:44 +0000 Message-ID: <7b14b0f2c51f4072a92c0c89ec132ae4@intel.com> References: <20201224035748.67012-1-dapengx.yu@intel.com> <20201224190317.4bac8b59@hermes.local> <5a697c3c06324bdbbe7b2bef265df4a4@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] app/testpmd: avoid exit without resource release 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" @Stephen Hemminger Xiaoyun proposed a solution which may match your idea, but there are some c= oncerns: 1. a global variable for original terminal setting has to be defined. 2. in each app which uses cmdline, a function has to be registered with= atexit() in prompt() to restore original terminal setting. @Stephen Hemminger, can you give some feedback on these concerns? Thanks! -----Original Message----- From: Li, Xiaoyun=20 Sent: Friday, January 15, 2021 5:22 PM To: Xing, Beilei ; Yu, DapengX ; Lu, Wenzhuo ; Iremonger, Bernard ; Stephen Hemminger Cc: dev@dpdk.org; stable@dpdk.org Subject: RE: [dpdk-dev] [PATCH] app/testpmd: avoid exit without resource re= lease Hi Actually, you can just type "stty echo" to solve the problem you met. But anyway, if you want to fix it in DPDK I think you misunderstood stephan= 's solution. You don't need to implement atexit() yourself in eal. It's a common functio= n like exit() in rte_exit(). Then when exit() is called. Each function registered by atexit() will be ca= lled in stack order. The simplest way to solve this problem is to register a function with atexi= t() in prompt() in each app which uses cmdline. Then when exit() in rte_exit() is called, the registered clean function wil= l be called directly. Registering in prompt() is because that prompt() is the function which star= ts cmdline in each app. @Stephen Hemminger What do you think of this about atexit() in prompt() in = each app? I understand it's cmdline and rte_exit problem. But atexit needs a function= without parameters. And the cleanup for cmdline is cmdline_stdin_exit(struct cmdline *cl) which= needs cmdline as the parameter to restore original terminal setting. Setting a global value will be too ugly to me. BRs Xiaoyun > -----Original Message----- > From: stable On Behalf Of Xing, Beilei > Sent: Friday, January 15, 2021 13:50 > To: Yu, DapengX ; Lu, Wenzhuo=20 > ; Iremonger, Bernard=20 > > Cc: Stephen Hemminger ; dev@dpdk.org;=20 > stable@dpdk.org > Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] app/testpmd: avoid exit=20 > without resource release >=20 > > -----Original Message----- > > From: Yu, DapengX > > Sent: Friday, January 15, 2021 11:29 AM > > To: Lu, Wenzhuo ; Xing, Beilei=20 > > ; Iremonger, Bernard=20 > > > > Cc: Yu, DapengX ; Stephen Hemminger=20 > > ; dev@dpdk.org; stable@dpdk.org > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: avoid exit without=20 > > resource release > > > > Hi Wenzhuo, Beilei, Bernard > > > > I need testpmd app maintainers' comment : > > Do you prefer the simple solution in this patch or Stephen's=20 > > comprehensive and generic solution(which will modify librte_cmdline,=20 > > testpmd (and maybe rte_exit()))? >=20 > The patch just workarounds a specific case, the issue exits in many=20 > cases, such as Rxonly mode and Rxq is 0. > So It's better to investigate how to solve the generic problem=20 > according to Stephen's comments. >=20 > > So I can continue resolving the defect. > > > > Thanks! > > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yu, DapengX > > Sent: Friday, December 25, 2020 1:09 PM > > To: Stephen Hemminger > > Cc: Lu, Wenzhuo ; Xing, Beilei=20 > > ; Iremonger, Bernard=20 > > ; dev@dpdk.org; stable@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: avoid exit without=20 > > resource release > > > > Hi Stephen, > > > > Do you mean this solution? > > 1. support atexit() in librte_eal, other component can use it to=20 > > register a function to be called when rte_exit() is called. > > 2. in librte_cmdline, use atexit() to register a function to release=20 > > resource > > > > I am looking forward to more comments from other maintainers, since=20 > > this solution will modify librte_eal and librte_cmdline, but not just t= estpmd app. > > > > > > -----Original Message----- > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Friday, December 25, 2020 11:03 AM > > To: Yu, DapengX > > Cc: Lu, Wenzhuo ; Xing, Beilei=20 > > ; Iremonger, Bernard=20 > > ; dev@dpdk.org; stable@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: avoid exit without=20 > > resource release > > > > On Thu, 24 Dec 2020 11:57:48 +0800 > > dapengx.yu@intel.com wrote: > > > > > From: YU DAPENG > > > > > > In interactive mode, if testpmd exit by calling rte_exit without=20 > > > cmdline resource release, terminal will not echo keyboard input.=20 > > > So add code to just show error message, but not exit testpmd when=20 > > > unexpected happens on starting packet forwarding in interactive=20 > > > mode. User > > can type "quit" > > > to exit testpmd later. > > > > > > Fixes: 5a8fb55c48ab ("app/testpmd: support unidirectional > > > configuration") > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: YU DAPENG > > > > Sounds like a more generic problem with rte_exit and librte_cmdline. > > Would it better to fix it in librte_cmdline by adding an atexit() handl= er. > >