DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Dengdui Huang" <huangdengdui@huawei.com>, <dev@dpdk.org>
Cc: <fengchengwen@huawei.com>, <lihuisong@huawei.com>,
	<haijie1@huawei.com>, <liuyonglong@huawei.com>,
	<roretzla@linux.microsoft.com>, <dmitry.kozliuk@gmail.com>,
	<david.marchand@redhat.com>, <stephen@networkplumber.org>,
	"Harry van Haaren" <harry.van.haaren@intel.com>
Subject: RE: [PATCH v3 2/3] eal: fix unckeck pipe
Date: Wed, 2 Apr 2025 16:45:12 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9FB8D@smartserver.smartshare.dk> (raw)
In-Reply-To: <20250402122454.2148612-3-huangdengdui@huawei.com>

> From: Dengdui Huang [mailto:huangdengdui@huawei.com]
> Sent: Wednesday, 2 April 2025 14.25
> 
> The communication pipe may be unavailable, for example,
> when the lcore role is ROLE_OFF or ROLE_NON_EAL.
> So check whether the pipe is available before using it.
> 
> Fixes: a95d70547c57 ("eal: factorize lcore main loop")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> ---
>  lib/eal/unix/eal_unix_thread.c | 3 +++
>  lib/eal/windows/eal_thread.c   | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/lib/eal/unix/eal_unix_thread.c
> b/lib/eal/unix/eal_unix_thread.c
> index ef6cbff0ee..103571cabf 100644
> --- a/lib/eal/unix/eal_unix_thread.c
> +++ b/lib/eal/unix/eal_unix_thread.c
> @@ -17,6 +17,9 @@ eal_thread_wake_worker(unsigned int worker_id)
>  	char c = 0;
>  	int n;
> 
> +	if (m2w == 0 || w2m == 0)
> +		return -EINVAL;
> +
>  	do {
>  		n = write(m2w, &c, 1);
>  	} while (n == 0 || (n < 0 && errno == EINTR));
> diff --git a/lib/eal/windows/eal_thread.c
> b/lib/eal/windows/eal_thread.c
> index 9e3df200b9..82bb974868 100644
> --- a/lib/eal/windows/eal_thread.c
> +++ b/lib/eal/windows/eal_thread.c
> @@ -24,6 +24,9 @@ eal_thread_wake_worker(unsigned int worker_id)
>  	char c = 0;
>  	int n;
> 
> +	if (m2w == 0 || w2m == 0)
> +		return -EINVAL;
> +
>  	do {
>  		n = _write(m2w, &c, 1);
>  	} while (n == 0 || (n < 0 && errno == EINTR));
> --
> 2.33.0

This internal function eal_thread_wake_worker() is only called from rte_eal_remote_launch().
It would be better to check the lcore role there.

References:
https://elixir.bootlin.com/dpdk/v25.03-rc2/A/ident/eal_thread_wake_worker
https://elixir.bootlin.com/dpdk/v25.03-rc2/source/lib/eal/common/eal_common_launch.c#L52

Furthermore, in theory, file descriptor 0 is a valid file descriptor; if "stdin" has been closed, a newly opened file (or pipe) may be assigned file descriptor 0.


  reply	other threads:[~2025-04-02 14:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21  4:03 [PATCH 0/2] fix the problem of dma-perf infinite loop Dengdui Huang
2025-03-21  4:03 ` [PATCH 1/2] eal: fix wake a incorrect lcore Dengdui Huang
2025-03-21  4:03 ` [PATCH 2/2] app/dma-perf: fix infinite loop Dengdui Huang
2025-03-21 15:58   ` Stephen Hemminger
2025-03-24  3:42     ` huangdengdui
2025-03-21  7:49 ` [PATCH 0/2] fix the problem of dma-perf " David Marchand
2025-03-24  3:42   ` huangdengdui
2025-03-27  8:58 ` [PATCH] app/dma-perf: fix " Dengdui Huang
2025-03-27  8:58   ` [PATCH 1/2] eal: fix uncheck worker ID Dengdui Huang
2025-03-27  8:58   ` [PATCH 2/2] app/dma-perf: fix infinite loop Dengdui Huang
2025-03-27  9:01 ` [PATCH v2 0/2] fix the problem of dma-perf " Dengdui Huang
2025-03-27  9:01   ` [PATCH v2 1/2] eal: fix uncheck worker ID Dengdui Huang
2025-03-27  9:32     ` Morten Brørup
2025-04-02  8:28       ` huangdengdui
2025-03-27  9:01   ` [PATCH v2 2/2] app/dma-perf: fix infinite loop Dengdui Huang
2025-04-02 12:24 ` [PATCH v3 0/3] fix the problem of dma-perf " Dengdui Huang
2025-04-02 12:24   ` [PATCH v3 1/3] eal: fix uncheck lcore ID Dengdui Huang
2025-04-02 12:24   ` [PATCH v3 2/3] eal: fix unckeck pipe Dengdui Huang
2025-04-02 14:45     ` Morten Brørup [this message]
2025-04-03  8:12       ` huangdengdui
2025-04-02 12:24   ` [PATCH v3 3/3] app/dma-perf: fix infinite loop Dengdui Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35E9FB8D@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=fengchengwen@huawei.com \
    --cc=haijie1@huawei.com \
    --cc=harry.van.haaren@intel.com \
    --cc=huangdengdui@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=liuyonglong@huawei.com \
    --cc=roretzla@linux.microsoft.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).