patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Narcisa Ana Maria Vasile <>
Cc: Narcisa Vasile <>,
Subject: [dpdk-stable] [PATCH v2] eal/windows: ensure all enabled CPUs are counted
Date: Tue, 29 Jun 2021 18:56:05 -0700
Message-ID: <> (raw)
In-Reply-To: <>

From: Narcisa Vasile <>

rte_cpuset_t describes a set of CPUs by using an array of masks
named '_bits'. Each element in the '_bits' array represents
a bit mask, with each bit corresponding to a CPU.
The maximum number of CPUs is given by 'CPU_SETSIZE'.
The number of bit masks is computed using '_NUM_SETS(CPU_SETSIZE)'.

count_cpu() should count the number of CPUs enabled in the set 's'.
Currently, it iterates through the number of masks in the
set 's', instead of iterating through all the bits in all the masks.
For example, if '_NUM_SETS(CPU_SETSIZE)' returns 2,
which means there are 2 bit masks: _bits[0] and _bits[1],
count_cpu() would only check if CPUs '0' and '1' are enabled.
The correct behavior is to iterate through all the CPUs in the set and
count the ones that are enabled.

This patch fixes count_cpu() to ensure all the bits in all the masks
are checked to compute the correct number of CPUs enabled in 's'.

Fixes: e8428a9d89f1 ("eal/windows: add some basic functions and macros")

Signed-off-by: Narcisa Vasile <>
  * Fix commit message.

 lib/eal/windows/include/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)
 	return count;

       reply	other threads:[~2021-06-30  1:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2021-06-30  1:56 ` Narcisa Ana Maria Vasile [this message]
2021-08-04 14:56   ` Dmitry Kozlyuk
2021-08-04 20:40   ` Kadam, Pallavi
2021-08-18 13:46   ` [dpdk-stable] [PATCH v3] " Narcisa Ana Maria Vasile
2021-10-08 23:56     ` [dpdk-stable] [dpdk-dev] " Narcisa Ana Maria Vasile
2021-10-11 18:48     ` [dpdk-stable] " Thomas Monjalon

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ \
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone