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 D391CA0C40 for ; Wed, 4 Aug 2021 16:57:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C17E141250; Wed, 4 Aug 2021 16:57:03 +0200 (CEST) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by mails.dpdk.org (Postfix) with ESMTP id A6BDE41245; Wed, 4 Aug 2021 16:57:01 +0200 (CEST) Received: by mail-lf1-f45.google.com with SMTP id p38so5068192lfa.0; Wed, 04 Aug 2021 07:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SdnlaGcJAPGUBqB1sSokAjGWgBAJDQNy+zbrUKbkTxI=; b=UdA/wCD1sA0O/wjLzWDvRmGj1Y6Iow2/Y+wficTC9UYOfwh2R/SjMw9qpQjk94QUjp vLxKCxXRn7vRQBfaByfwo0xhKmF5qr0/WZVaOAfkfjsJ3elWN730CpAF0Hg8g8EbnE08 v8YrBsm4BDL+0OF2c64ll/eDC+K5zOihgTJ5PKS34yZB/tpmY1BjKpMmHJy0/Jj9/dvh 1y5uFziNlK7lZZQ0rmmbZ3qxav46HcXZwfAutAudeW3/NAFtIowJK1uDkA4/eOuWAL6H oXDGRNMZlTtGq6imw1EoEu8n6jAlmzWk/1e6Q8sBe/n6Evbzk1UtwGCtjSumLzchYmk3 uN0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SdnlaGcJAPGUBqB1sSokAjGWgBAJDQNy+zbrUKbkTxI=; b=HAhcBR4ybxs1LfOPM+FmNrZseFN/mWwoDUGH8TbI5wgIkQX50btaf6VQUpu7e/uqGR hKFxnaGhgC41WY1WvFkH2HuCbGW+GMhwdqhOGsl5dTBz0Qy7C5Jgype0rhwf1uLcNp9d 6+UzU9TuizHIICMMszdqJ34alt2Wq1gkprAVohEMtXvbhqQcv9ZyqG//1EBl/8pAJkHh KpGY0zoKmUdcsB5bSNxAlwHUAhVE4IsjHsGQx7cD0u3GoaBqCmpZ3qJgmAQsaj/iLToK XaREoO0EXaEHNKfmpgArhHhYzPXdMyrtdzdkIj6KQw1F9Y5SN2os3JMeCCH87WcDUtxO SrMw== X-Gm-Message-State: AOAM532g/9DljcplBfUtTCyvgee+LeFoQXTYZ6yvJ7LC8IjWA6xgr7yv NfMvTH3iJRFDG/9CzJ3mYdg= X-Google-Smtp-Source: ABdhPJx2SeQ0S5/yiWprsgGyHettXech1356eAnKoGz893wWPZ1yzvrWB2V1P6BoqYie4egCCIPrpA== X-Received: by 2002:ac2:57c5:: with SMTP id k5mr21210278lfo.72.1628089021200; Wed, 04 Aug 2021 07:57:01 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id f34sm219659lfv.22.2021.08.04.07.57.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 07:57:00 -0700 (PDT) Date: Wed, 4 Aug 2021 17:56:59 +0300 From: Dmitry Kozlyuk To: Narcisa Ana Maria Vasile , talshn@nvidia.com Cc: dev@dpdk.org, thomas@monjalon.net, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitrym@microsoft.com, Narcisa Vasile , stable@dpdk.org Message-ID: <20210804175659.41bd53d7@sovereign> In-Reply-To: <1625018165-27103-1-git-send-email-navasile@linux.microsoft.com> References: <1624580843-4521-1-git-send-email-navasile@linux.microsoft.com> <1625018165-27103-1-git-send-email-navasile@linux.microsoft.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [PATCH v2] eal/windows: ensure all enabled CPUs are counted X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 2021-06-29 18:56 (UTC-0700), Narcisa Ana Maria Vasile: > 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") > Cc: pallavi.kadam@intel.com > Cc: stable@dpdk.org > > Signed-off-by: Narcisa Vasile > --- > v2: > * 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) > count++; > return count; Sorry, I lost track of this patch. Great and thorough explanation, but I don't think it needs to be so long. Suggestion: 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. Whatever message is taken in the end, Acked-by: Dmitry Kozlyuk