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 771FA41B83;
	Mon, 30 Jan 2023 21:11:38 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 3B0C840DF6;
	Mon, 30 Jan 2023 21:11:38 +0100 (CET)
Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com
 [209.85.214.174])
 by mails.dpdk.org (Postfix) with ESMTP id 1C47140C35
 for <dev@dpdk.org>; Mon, 30 Jan 2023 21:11:37 +0100 (CET)
Received: by mail-pl1-f174.google.com with SMTP id z1so5323796plg.6
 for <dev@dpdk.org>; Mon, 30 Jan 2023 12:11:37 -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=HMCaq76mjo33As5b8cyaGRd0gsqKlMALMJg4kwzFagU=;
 b=lDhG5ktoYCAv7uG2MfwGjk4wuaPN7rql2tsQwIadZVMz1hDYgKw02yw66aw+/a4lP8
 yg6DLOU2bidIZY1r3yFhmVklpC+yhilbRNoW6c0MrVFR7U0zYe+q1RjGPrsKilnzCngF
 NY2SLj6W7ol8f5GneD8D5tUKZbQSqhuEK7QrtTFT8KvTaqXG4wV9JiYm9rbqZxMWYDyX
 en67S68BYpLS9NE2X/J5se/FTYpNSrmj9lkTSJCfjJseRdupCJVDjkU1uSexOYpn6Cp8
 Hk6nU9sbl4iayL8O6re4WisAbyYMQtEMvfUACs1HYbjqBfevkl+6jAMuBjm8iTnfBasD
 yW3w==
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=HMCaq76mjo33As5b8cyaGRd0gsqKlMALMJg4kwzFagU=;
 b=IqnwUiKLUMiDP0CRAiTr/cLk+uevy8HuMQ/5ObCFrkseZjFA0m1mV6X9vmzsE+8nvi
 GofL04hyE4a3/WeZfuBfcOsRdCuCnJ39UFMSPVZSRPAlzi+MrVUC7AS7lZXOl87jG+t8
 T3E5gjsV9juHo9/OwaYH/KtNo+fkbc+lDU8s/ZrezENmAyAXKVQ5EtOjmODxZWcxsO8p
 dAEyiFz6gQOVadqkExjc5c5g3Qw1V6ow5kPfWvD2C1KL4XUIDamUINZxfmLKvyY/8b0Y
 sYRSYQ5tsJlaSzbDmyWUMmtMGVCPMrL6L2+CZDKG/P3brJpkWqmmQNoDlSMt4Wqcr8Gq
 z09w==
X-Gm-Message-State: AO0yUKWm5egx4wJ2TyQrxyAJBTEpQrb7nuUooVW0dM7XjUT+k5nZmQ++
 Ta+J6h5xG990iyEYb4M4rM1IWg==
X-Google-Smtp-Source: AK7set/RXq3qGnjYNsrEfA9yAFfvXKBSOWs1HUf/FcYbN8kz82+RgqCekZi36g6mKFbAHQLd5EF4gA==
X-Received: by 2002:a17:902:e14d:b0:196:2cc1:5082 with SMTP id
 d13-20020a170902e14d00b001962cc15082mr7026670pla.67.1675109496316; 
 Mon, 30 Jan 2023 12:11:36 -0800 (PST)
Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218])
 by smtp.gmail.com with ESMTPSA id
 c4-20020a170902d90400b0017f756563bcsm8201184plz.47.2023.01.30.12.11.35
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 30 Jan 2023 12:11:36 -0800 (PST)
Date: Mon, 30 Jan 2023 12:11:33 -0800
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ferruh Yigit <ferruh.yigit@amd.com>
Cc: dev@dpdk.org, Olivier Matz <olivier.matz@6wind.com>, Thomas Monjalon
 <thomas@monjalon.net>, Aman Singh <aman.deep.singh@intel.com>, Yuying Zhang
 <yuying.zhang@intel.com>, Phil Yang <phil.yang@arm.com>, Jianbo Liu
 <jianbo.liu@arm.com>
Subject: Re: [PATCH v9] testpmd: cleanup cleanly from signal
Message-ID: <20230130121133.0af0ba34@hermes.local>
In-Reply-To: <851ff1c2-ebb4-fd34-b950-06b0f6fd6ef3@amd.com>
References: <20221112172839.70087-1-stephen@networkplumber.org>
 <20230125183205.96554-1-stephen@networkplumber.org>
 <851ff1c2-ebb4-fd34-b950-06b0f6fd6ef3@amd.com>
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 Mon, 30 Jan 2023 18:48:25 +0000
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> On 1/25/2023 6:32 PM, Stephen Hemminger wrote:
> > Do a clean shutdown of testpmd when a signal is received; instead of
> > having testpmd kill itself.  This fixes the problem where a signal could
> > be received in the middle of a PMD and then the signal handler would
> > call PMD's close routine leading to locking problems.
> > 
> > An added benefit is it gets rid of some Windows specific code.
> > 
> > Fixes: d9a191a00e81 ("app/testpmd: fix quitting in container")
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>  
> 
> Patch looks good to me, but './devtools/test-null.sh' hangs with change.
> 
> It is possible the fix by updating './devtools/test-null.sh', but my
> concern is if this behavior change hit more consumers other than this
> internal tool, and I am for keeping previous behavior.
> 
> './devtools/test-null.sh' sends 'stop' command to testpmd but that seems
> not really what makes testpmd quit, because following change still works
> with original testpmd code:
>  -(sleep 1 && echo stop) |
>  +(sleep 1 && echo help) |
> Somehow testpmd gets Ctrl-D or equivalent with above command.
> 
> And it seems because of 'cmdline_interact()' and 'cmdline_poll()'
> difference behavior changes with above command.
> 
> It is possible to add something like  'cmdline_interact_one()' (non loop
> version of 'cmdline_interact()'), but not really sure that is correct
> way to fix the issue.
> 

Thanks for the review.
Fixed the end-of-file handling in v10 of the patch.
The cmdline_poll() function doesn't handle EOF correctly.

The function cmdline_poll() documentation is problematic since it
references that the return value is an enum, but the enum is actually
private and not exported by the library!