[v3] eal/windows: ensure all enabled CPUs are counted

Message ID 1629294360-5737-1-git-send-email-navasile@linux.microsoft.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v3] eal/windows: ensure all enabled CPUs are counted |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing fail Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Narcisa Ana Maria Vasile Aug. 18, 2021, 1:46 p.m. UTC
  From: Narcisa Vasile <navasile@microsoft.com>

On Windows, -l/--lcores EAL option was unable to process CPU sets
containing CPUs other than 0 and 1, because CPU_COUNT() macro
only checked these CPUs in the set. Fix CPU_COUNT() by enumerating
all possible CPU indices.

Fixes: e8428a9d89f1 ("eal/windows: add some basic functions and macros")
Cc: pallavi.kadam@intel.com
Cc: stable@dpdk.org

Signed-off-by: Narcisa Vasile <navasile@microsoft.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Pallavi Kadam <pallavi.kadam@intel.com>
---
 lib/eal/windows/include/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Narcisa Ana Maria Vasile Oct. 8, 2021, 11:56 p.m. UTC | #1
On Wed, Aug 18, 2021 at 06:46:00AM -0700, Narcisa Ana Maria Vasile wrote:
> From: Narcisa Vasile <navasile@microsoft.com>
> 
> On Windows, -l/--lcores EAL option was unable to process CPU sets
> containing CPUs other than 0 and 1, because CPU_COUNT() macro
> only checked these CPUs in the set. Fix CPU_COUNT() by enumerating
> all possible CPU indices.
> 
> Fixes: e8428a9d89f1 ("eal/windows: add some basic functions and macros")
> Cc: pallavi.kadam@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Narcisa Vasile <navasile@microsoft.com>
> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Acked-by: Pallavi Kadam <pallavi.kadam@intel.com>
> ---
Can this be merged? This small fix will solve the issues related to threads
affinity on Windows. Thanks!
  
Thomas Monjalon Oct. 11, 2021, 6:48 p.m. UTC | #2
18/08/2021 15:46, Narcisa Ana Maria Vasile:
> From: Narcisa Vasile <navasile@microsoft.com>
> 
> On Windows, -l/--lcores EAL option was unable to process CPU sets
> containing CPUs other than 0 and 1, because CPU_COUNT() macro
> only checked these CPUs in the set. Fix CPU_COUNT() by enumerating
> all possible CPU indices.
> 
> Fixes: e8428a9d89f1 ("eal/windows: add some basic functions and macros")
> Cc: pallavi.kadam@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Narcisa Vasile <navasile@microsoft.com>
> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Acked-by: Pallavi Kadam <pallavi.kadam@intel.com>

Applied, thanks.
Sorry for the delay.
  

Patch

diff --git a/lib/eal/windows/include/sched.h b/lib/eal/windows/include/sched.h
index ff572b5dcb..bc31cc8465 100644
--- a/lib/eal/windows/include/sched.h
+++ b/lib/eal/windows/include/sched.h
@@ -49,7 +49,7 @@  count_cpu(rte_cpuset_t *s)
 	unsigned int _i;
 	int count = 0;
 
-	for (_i = 0; _i < _NUM_SETS(CPU_SETSIZE); _i++)
+	for (_i = 0; _i < CPU_SETSIZE; _i++)
 		if (CPU_ISSET(_i, s) != 0LL)
 			count++;
 	return count;