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 4D9B641EBE; Fri, 17 Mar 2023 17:38:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A6BC42F98; Fri, 17 Mar 2023 17:38:38 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id 95D5B40395 for ; Fri, 17 Mar 2023 17:38:36 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id p13-20020a17090a284d00b0023d2e945aebso8472057pjf.0 for ; Fri, 17 Mar 2023 09:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; t=1679071116; 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=ceEXpJfAU+soxo9Y7UYEDMfYQjU0yb6COKXv3+fjK4s=; b=wSoAgTY7ptsnGgWhGl6TrhsnWVLTDpVN/yvPCKOUrz3o8jpRgk66TgOBmcP+UubhR3 xm9ad+OS/5GT/yNeLxjshI4DBHjVmcYzKXy8Ux7dRBHttdmIwhaLhVhr2GYhkM6kJgXQ K3qdLWyPrnNJbtvK/WROljFIQ9kZhcKUmWSoos/UTj2R/kImd2y6x7NwhmKYHzqYAtD3 gwyLZyXoQZM63AASyHEvTZBX7QK+BjKu1i6QuX9BK2TtTyYmz/8xkPfVQqCiygFfR6dR 2vi+TAvunsw0cLrV/lB/SxXV4kS5cfdVmDvpIzq3K6xQ0Jb7HuPMg75n5PNhGdnyWBws Vrrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679071116; 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=ceEXpJfAU+soxo9Y7UYEDMfYQjU0yb6COKXv3+fjK4s=; b=NVuFvxuaNpTnKq0cAKXMB3gXTUL93RTbSyz1+qqAPm6Zs2U8m221EhhRbv08q0R1l3 f4lNaL2P7/cvFJZqv7XwmF9saHDk2dGQKoY8PDgI2xJFOwblieBVAkx2pjW52ERNdcbJ 7WWI+sLKY66mTuz/elSOp5J9Ob3my2DdyQJpOJwlfFkMA92C6hDvhQE/Qi78HweZ1h4P ro0O8q4qeEW733XR1WW9AwB+cH5l37sXeK/ttv2KBNLpPg38AXr3dSPFuY7Sr8Io0UvG vCPccoE6A1rJnjaoogVS0ZlSGBhNXuIPxofgfgqr6qV27M3/8sIYojh+MQgQGBsVC+Tz 4jyw== X-Gm-Message-State: AO0yUKV1UjmsCep1bBQLZlg7cKVU44Hjva2b/6im40Znw+wuf98Oa4ys 8D/W2uVNFJXD0PU01+X6xVIEnQ== X-Google-Smtp-Source: AK7set8hlf5/cbwvdc6fBXLen84mwxMMpJigs5Ky+ZurCvFC6gVlsUtfx9b0sx7xE3/eG4D68kP9Yg== X-Received: by 2002:a05:6a20:a5a8:b0:d6:eeb5:61df with SMTP id bc40-20020a056a20a5a800b000d6eeb561dfmr6971381pzb.55.1679071115698; Fri, 17 Mar 2023 09:38:35 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id z20-20020aa791d4000000b00625c37469a4sm1839247pfa.97.2023.03.17.09.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Mar 2023 09:38:35 -0700 (PDT) Date: Fri, 17 Mar 2023 09:38:34 -0700 From: Stephen Hemminger To: Olivier Matz Cc: dev@dpdk.org, Aman Singh , Yuying Zhang , Ferruh Yigit Subject: Re: [PATCH v4 1/2] testpmd: go back to using cmdline_interact Message-ID: <20230317093834.6ae46737@hermes.local> In-Reply-To: References: <20230313171905.67720-1-stephen@networkplumber.org> <20230315173132.4044-1-stephen@networkplumber.org> <20230315173132.4044-2-stephen@networkplumber.org> 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, 17 Mar 2023 17:20:48 +0100 Olivier Matz wrote: > > > > +#ifdef RTE_EXEC_ENV_WINDOWS > > signal(SIGINT, signal_handler); > > signal(SIGTERM, signal_handler); > > +#else > > + /* Want read() not to be restarted on signal */ > > + struct sigaction action = { > > + .sa_handler = signal_handler, > > + }; > > + > > + sigaction(SIGINT, &action, NULL); > > + sigaction(SIGTERM, &action, NULL); > > +#endif > > If we have to change this in testpmd, we'll have to do the same in other > applications. The only a couple other program combining signal() and cmdline_interact(). These programs all exit from signal handler and never return from it. In examples/ntb, the program is using the signal suicide (lets kill myself) model, which will work. Not sure why it bothers just to print a message. In examples/vdpa, the program is trapping signal and calling close on ports. This is not signal safe, but that is up to the vdpa maintainers to address. Also, examples/vm_power_management is calling channel_XXX_exit() routines which is not signal safe. Ditto, need the maintainers to address that. > > +__rte_experimental > > +void cmdline_cancel(struct cmdline *cl); > > + > > The help says this function causes the read() in cmdline_interact to > exit, but the unix implementation is empty. > > Maybe we should instead explain in what condition this function must > called. Also, shouldn't this function call cmdline_quit() too to avoid > the user to do it? Prefer to have function not to do implicit quit. PS: cmdline functions need better documentation.