DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] eal/windows: set Windows main lcore affinitization
@ 2022-03-30  9:00 Tyler Retzlaff
  2022-04-07 13:14 ` David Marchand
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Tyler Retzlaff @ 2022-03-30  9:00 UTC (permalink / raw)
  To: dev; +Cc: dmitry.kozliuk, Tyler Retzlaff

add missing code to affinitize main_lcore from lcore configuration.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/windows/eal.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index ca3c41a..9c61780 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -401,6 +401,12 @@ enum rte_proc_type_t
 		return -1;
 	}
 
+	if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
+			&lcore_config[config->main_lcore].cpuset) != 0) {
+		rte_eal_init_alert("Cannot set affinity");
+		rte_errno = EINVAL;
+		return -1;
+	}
 	__rte_thread_init(config->main_lcore,
 		&lcore_config[config->main_lcore].cpuset);
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] eal/windows: set Windows main lcore affinitization
  2022-03-30  9:00 [PATCH] eal/windows: set Windows main lcore affinitization Tyler Retzlaff
@ 2022-04-07 13:14 ` David Marchand
  2022-04-12 16:30   ` Tyler Retzlaff
  2022-04-14 12:40 ` [PATCH v2] " Tyler Retzlaff
  2022-04-14 12:43 ` [PATCH v3] " Tyler Retzlaff
  2 siblings, 1 reply; 8+ messages in thread
From: David Marchand @ 2022-04-07 13:14 UTC (permalink / raw)
  To: Tyler Retzlaff; +Cc: dev, Dmitry Kozlyuk

Hello Tyler,

On Wed, Mar 30, 2022 at 11:00 AM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> add missing code to affinitize main_lcore from lcore configuration.

Nit: Add*

>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/eal/windows/eal.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
> index ca3c41a..9c61780 100644
> --- a/lib/eal/windows/eal.c
> +++ b/lib/eal/windows/eal.c
> @@ -401,6 +401,12 @@ enum rte_proc_type_t
>                 return -1;
>         }
>
> +       if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
> +                       &lcore_config[config->main_lcore].cpuset) != 0) {
> +               rte_eal_init_alert("Cannot set affinity");
> +               rte_errno = EINVAL;
> +               return -1;
> +       }
>         __rte_thread_init(config->main_lcore,
>                 &lcore_config[config->main_lcore].cpuset);
>

- It looks like the affinity is dumped for workers (see below), I
would dump affinity for the main lcore like other OS do:

    ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));

    RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%p;cpuset=[%s%s])\n",
        config->main_lcore, thread_id, cpuset,
        ret == 0 ? "" : "...");


- Which makes me notice that windows/eal_thread.c probably dumps
random stuff in logs because it is missing a call to
eal_thread_dump_current_affinity() to format affinity as a string.

lib/eal/windows/eal_thread.c:   char cpuset[RTE_CPU_AFFINITY_STR_LEN];
lib/eal/windows/eal_thread.c:   __rte_thread_init(lcore_id,
&lcore_config[lcore_id].cpuset);
lib/eal/windows/eal_thread.c:   RTE_LOG(DEBUG, EAL, "lcore %u is ready
(tid=%zx;cpuset=[%s])\n",
lib/eal/windows/eal_thread.c:           lcore_id, (uintptr_t)thread_id, cpuset);


-- 
David Marchand


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] eal/windows: set Windows main lcore affinitization
  2022-04-07 13:14 ` David Marchand
@ 2022-04-12 16:30   ` Tyler Retzlaff
  2022-04-14  9:50     ` David Marchand
  0 siblings, 1 reply; 8+ messages in thread
From: Tyler Retzlaff @ 2022-04-12 16:30 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Dmitry Kozlyuk

On Thu, Apr 07, 2022 at 03:14:33PM +0200, David Marchand wrote:
> Hello Tyler,
> 
> On Wed, Mar 30, 2022 at 11:00 AM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > add missing code to affinitize main_lcore from lcore configuration.
> 
> Nit: Add*
> 
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  lib/eal/windows/eal.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
> > index ca3c41a..9c61780 100644
> > --- a/lib/eal/windows/eal.c
> > +++ b/lib/eal/windows/eal.c
> > @@ -401,6 +401,12 @@ enum rte_proc_type_t
> >                 return -1;
> >         }
> >
> > +       if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
> > +                       &lcore_config[config->main_lcore].cpuset) != 0) {
> > +               rte_eal_init_alert("Cannot set affinity");
> > +               rte_errno = EINVAL;
> > +               return -1;
> > +       }
> >         __rte_thread_init(config->main_lcore,
> >                 &lcore_config[config->main_lcore].cpuset);
> >
> 
> - It looks like the affinity is dumped for workers (see below), I
> would dump affinity for the main lcore like other OS do:

yep, it's missing i should have noticed that. i'll submit a new version
to dump the affinity for the main lcore.

> 
>     ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
> 
>     RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%p;cpuset=[%s%s])\n",
>         config->main_lcore, thread_id, cpuset,
>         ret == 0 ? "" : "...");
> 
> 
> - Which makes me notice that windows/eal_thread.c probably dumps
> random stuff in logs because it is missing a call to
> eal_thread_dump_current_affinity() to format affinity as a string.

oh yeah, that's not so good.

i think the series you submitted for eal_thread_loop should resolve this
shouldn't it? shall we ride your change to fix the issue or do you feel
it's worth me adding the missing call in this series?


--

ty

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] eal/windows: set Windows main lcore affinitization
  2022-04-12 16:30   ` Tyler Retzlaff
@ 2022-04-14  9:50     ` David Marchand
  0 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2022-04-14  9:50 UTC (permalink / raw)
  To: Tyler Retzlaff; +Cc: dev, Dmitry Kozlyuk

Hello Tyler,

On Tue, Apr 12, 2022 at 6:30 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
> > - Which makes me notice that windows/eal_thread.c probably dumps
> > random stuff in logs because it is missing a call to
> > eal_thread_dump_current_affinity() to format affinity as a string.
>
> oh yeah, that's not so good.
>
> i think the series you submitted for eal_thread_loop should resolve this
> shouldn't it? shall we ride your change to fix the issue or do you feel
> it's worth me adding the missing call in this series?

This issue here is only for a log on cpu affinity.
Lcores cpu affinity is not correct for Windows in LTS releases, in any case.
So let's keep it as is and don't bother fixing it.


I'll add a note in my series about this log and apply it.
I marked this current patch as "Changes requested", wrt to my first comment.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] eal/windows: set Windows main lcore affinitization
  2022-03-30  9:00 [PATCH] eal/windows: set Windows main lcore affinitization Tyler Retzlaff
  2022-04-07 13:14 ` David Marchand
@ 2022-04-14 12:40 ` Tyler Retzlaff
  2022-04-14 12:43 ` [PATCH v3] " Tyler Retzlaff
  2 siblings, 0 replies; 8+ messages in thread
From: Tyler Retzlaff @ 2022-04-14 12:40 UTC (permalink / raw)
  To: dev; +Cc: dmitry.kozliuk, david.marchand, Tyler Retzlaff

add missing code to affinitize main_lcore from lcore configuration.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---

v2: RTE_LOG of eal_thread_dump_current_affinity as linux does

 lib/eal/windows/eal.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index ca3c41aaa7..98d8b155c7 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -279,6 +279,7 @@ rte_eal_init(int argc, char **argv)
 	bool has_phys_addr;
 	enum rte_iova_mode iova_mode;
 	int ret;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 
 	eal_log_init(NULL, 0);
 
@@ -401,9 +402,20 @@ rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
+	if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
+			&lcore_config[config->main_lcore].cpuset) != 0) {
+		rte_eal_init_alert("Cannot set affinity");
+		rte_errno = EINVAL;
+		return -1;
+	}
 	__rte_thread_init(config->main_lcore,
 		&lcore_config[config->main_lcore].cpuset);
 
+	ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
+	RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
+		config->main_lcore, (uintptr_t)pthread_self(), cpuset,
+		ret == 0 ? "" : "...");
+
 	RTE_LCORE_FOREACH_WORKER(i) {
 
 		/*
-- 
2.33.0.vfs.0.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3] eal/windows: set Windows main lcore affinitization
  2022-03-30  9:00 [PATCH] eal/windows: set Windows main lcore affinitization Tyler Retzlaff
  2022-04-07 13:14 ` David Marchand
  2022-04-14 12:40 ` [PATCH v2] " Tyler Retzlaff
@ 2022-04-14 12:43 ` Tyler Retzlaff
  2022-04-14 13:08   ` David Marchand
  2 siblings, 1 reply; 8+ messages in thread
From: Tyler Retzlaff @ 2022-04-14 12:43 UTC (permalink / raw)
  To: dev; +Cc: dmitry.kozliuk, david.marchand, Tyler Retzlaff

Add missing code to affinitize main_lcore from lcore configuration.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---

v3: update commit message s/add/Add/
v2: RTE_LOG of eal_thread_dump_current_affinity as linux does

 lib/eal/windows/eal.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index ca3c41a..98d8b15 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -279,6 +279,7 @@ enum rte_proc_type_t
 	bool has_phys_addr;
 	enum rte_iova_mode iova_mode;
 	int ret;
+	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 
 	eal_log_init(NULL, 0);
 
@@ -401,9 +402,20 @@ enum rte_proc_type_t
 		return -1;
 	}
 
+	if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
+			&lcore_config[config->main_lcore].cpuset) != 0) {
+		rte_eal_init_alert("Cannot set affinity");
+		rte_errno = EINVAL;
+		return -1;
+	}
 	__rte_thread_init(config->main_lcore,
 		&lcore_config[config->main_lcore].cpuset);
 
+	ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
+	RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
+		config->main_lcore, (uintptr_t)pthread_self(), cpuset,
+		ret == 0 ? "" : "...");
+
 	RTE_LCORE_FOREACH_WORKER(i) {
 
 		/*
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] eal/windows: set Windows main lcore affinitization
  2022-04-14 12:43 ` [PATCH v3] " Tyler Retzlaff
@ 2022-04-14 13:08   ` David Marchand
  2022-04-25  8:28     ` David Marchand
  0 siblings, 1 reply; 8+ messages in thread
From: David Marchand @ 2022-04-14 13:08 UTC (permalink / raw)
  To: Tyler Retzlaff; +Cc: dev, Dmitry Kozlyuk

On Thu, Apr 14, 2022 at 2:43 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> Add missing code to affinitize main_lcore from lcore configuration.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] eal/windows: set Windows main lcore affinitization
  2022-04-14 13:08   ` David Marchand
@ 2022-04-25  8:28     ` David Marchand
  0 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2022-04-25  8:28 UTC (permalink / raw)
  To: Tyler Retzlaff; +Cc: dev, Dmitry Kozlyuk

On Thu, Apr 14, 2022 at 3:08 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Thu, Apr 14, 2022 at 2:43 PM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > Add missing code to affinitize main_lcore from lcore configuration.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-25  8:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30  9:00 [PATCH] eal/windows: set Windows main lcore affinitization Tyler Retzlaff
2022-04-07 13:14 ` David Marchand
2022-04-12 16:30   ` Tyler Retzlaff
2022-04-14  9:50     ` David Marchand
2022-04-14 12:40 ` [PATCH v2] " Tyler Retzlaff
2022-04-14 12:43 ` [PATCH v3] " Tyler Retzlaff
2022-04-14 13:08   ` David Marchand
2022-04-25  8:28     ` David Marchand

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).