From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id F149BA0547;
	Fri, 11 Nov 2022 17:49:32 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id E6B684014F;
	Fri, 11 Nov 2022 17:49:32 +0100 (CET)
Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com
 [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 6DB6F40141
 for <dev@dpdk.org>; Fri, 11 Nov 2022 17:49:31 +0100 (CET)
Received: by mail-pj1-f46.google.com with SMTP id
 e7-20020a17090a77c700b00216928a3917so8205517pjs.4
 for <dev@dpdk.org>; Fri, 11 Nov 2022 08:49:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20210112.gappssmtp.com; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:from:to:cc:subject:date
 :message-id:reply-to;
 bh=701rJFpHrWdyAdMfMqg+ji7O1lFlLoZVl0d1DzwnM/A=;
 b=p9VTxL8sbwCLuo4j2RJu+1voorhAXokzQCDejYs3boJnZ1w6guxOkS1Xo5uxqL7EBB
 MNSjk2oiqOkBqfcxCkMsad/S79McW3XAGtUzA7Q1I8p6JVlQA2W3xpK+vI/UGPOmmzLG
 pMI1qNK8FgG0yX2AbLnoOrYC4Uhi/JD/hLFWrCIfQFWOWw0KHuBWltx+XRqDwRaxBraX
 wo55sR5OWIL2dWq06HFxSGgPgbo09YOSqHzQUxlf65IZziK+mM/gQL24djze1C4ibRye
 v3CsUkBwEYv8C820RZl3Pd7XZzULnAIMyPWJ1fW3u+3VucE7mWnUGoA5qqKE1XjINks7
 QSGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=701rJFpHrWdyAdMfMqg+ji7O1lFlLoZVl0d1DzwnM/A=;
 b=pDH+LDzRDnYt6nBOv3j4S4njBlEfn1+J1Zhyt0x4hILeswH3U63HniBxuUlvG9lYs/
 QfnTVw/7WvGHnuDhwZbA2xw2Fe9ZJHAEPcHLvEYmSDrjWXhEKcpZYiKqbscWW4qLTgNO
 pnpX8qX1B9c8lAgf6koFxWxC5JhOurkATGqTyIdkcHgvPmK5H4OT/QGA0hkAwj1Ew8QE
 Ov4XLjUvCH/6DrWWRVw5nWZ6xLNogZpbv5oSf54F17jaul2BhbCRUhmJD5WvUoz70H1w
 0lZlQry3jfShr1JZRs5Y5LIuP3I3RyRHA7QMoY/+YH5+dM9Eb1/JMVHhN8ST3kcsZhUV
 psfw==
X-Gm-Message-State: ANoB5pkEb/U5etBtlZuU4ToV5pXU5HREw4WtDRDxYNnbwZO6FLXONINV
 LxjMJ6a4p3bVK1YDGVSd72GCLdBxHXdEIg==
X-Google-Smtp-Source: AA0mqf7r1sVC9BZCCumKLf4djiRNJnN4LIOIUFYtNDbxFLQqhHa7tHSwfVCfSnTTzkB8JADN4hEdVw==
X-Received: by 2002:a17:902:9a81:b0:185:378d:7c2a with SMTP id
 w1-20020a1709029a8100b00185378d7c2amr3251310plp.127.1668185370632; 
 Fri, 11 Nov 2022 08:49:30 -0800 (PST)
Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218])
 by smtp.gmail.com with ESMTPSA id
 u6-20020a17090341c600b0017f9021ddc6sm1931290ple.289.2022.11.11.08.49.29
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 11 Nov 2022 08:49:30 -0800 (PST)
Date: Fri, 11 Nov 2022 08:49:27 -0800
From: Stephen Hemminger <stephen@networkplumber.org>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev@dpdk.org, Aman Singh <aman.deep.singh@intel.com>, Yuying Zhang
 <yuying.zhang@intel.com>, Phil Yang <phil.yang@arm.com>, Jianbo Liu
 <jianbo.liu@linaro.org>
Subject: Re: [PATCH v6] testpmd: cleanup cleanly from signal
Message-ID: <20221111084927.5500dd9c@hermes.local>
In-Reply-To: <39978e88-a231-9ef4-197e-ee1948d9c8ef@oktetlabs.ru>
References: <20221014172328.185219-2-stephen@networkplumber.org>
 <20221110165359.343010-1-stephen@networkplumber.org>
 <39978e88-a231-9ef4-197e-ee1948d9c8ef@oktetlabs.ru>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Fri, 11 Nov 2022 11:05:24 +0300
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru> wrote:

> It looks wrong to skip pmd_test_exit() in periodic stats
> case (if body above). Earlier it happened in signal handler.
> IMHO, pmd_test_exit() should be done just before pdump
> uninit below (outside if/else bodies (and removed from
> interactive == 1 branch above).
> 
> > +			if (rc < 0)
> > +				return 1;  
> 
> It took some time for me to understand what's happening here.
> Finally I came to conclusion that it just preserve previous
> behaviour to return with failure code immediately if read
> fails. Except addition of pmd_test_exit() above.
> I think it is a wrong behaviour to skip all cleanup which
> is done below, but I agree that it is a separate issue to
> fix.
> 
> > +			prompt_exit();  
> 
> prompt_exit() is registered as atexit() callback and if I'm not
> mistakes will be called anyway.


Good catch.
Trying to unwind the intentions of earlier code here.

Next version should be cleaner.