diff mbox series

efd: change data type of parameter

Message ID 20210910165346.807715-1-pablo.de.lara.guarch@intel.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series efd: change data type of parameter | expand

Checks

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

Commit Message

De Lara Guarch, Pablo Sept. 10, 2021, 4:53 p.m. UTC
rte_efd_create() function was using uint8_t for a socket bitmask,
for one of its parameters.
This limits the maximum of NUMA sockets to be 8.
Changing to to uint64_t increases it to 64, which should be
more future-proof.

Coverity issue: 366390
Fixes: 56b6ef874f8 ("efd: new Elastic Flow Distributor library")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---

This fix requires an API breakage and therefore it is not
a good candidate for backporting (besides, it is a very low impact bug).
Hence, I am not CC'ing stable.

---

 lib/efd/rte_efd.c | 2 +-
 lib/efd/rte_efd.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Mcnamara, John Sept. 13, 2021, 6:18 p.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Pablo de Lara
> Sent: Friday, September 10, 2021 5:54 PM
> To: Wang, Yipeng1 <yipeng1.wang@intel.com>; Marohn, Byron
> <byron.marohn@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [dpdk-dev] [PATCH] efd: change data type of parameter
> 
> rte_efd_create() function was using uint8_t for a socket bitmask, for one
> of its parameters.
> This limits the maximum of NUMA sockets to be 8.
> Changing to to uint64_t increases it to 64, which should be more future-
> proof.
> 
> Coverity issue: 366390
> Fixes: 56b6ef874f8 ("efd: new Elastic Flow Distributor library")
> 


As noted in the commit message this change is required to fix Coverity defect 366390. 

https://scan4.coverity.com/reports.htm#v34998/p10075/fileInstanceId=107231002&defectInstanceId=14260754&mergedDefectId=366390


Acked-by: John McNamara <john.mcnamara@intel.com>
David Marchand Sept. 14, 2021, 7:10 a.m. UTC | #2
On Fri, Sep 10, 2021 at 6:54 PM Pablo de Lara
<pablo.de.lara.guarch@intel.com> wrote:
>
> rte_efd_create() function was using uint8_t for a socket bitmask,
> for one of its parameters.
> This limits the maximum of NUMA sockets to be 8.
> Changing to to uint64_t increases it to 64, which should be
> more future-proof.

Cc: ppc maintainer, since I think powerX servers have non contiguous
NUMA sockets.


>
> Coverity issue: 366390
> Fixes: 56b6ef874f8 ("efd: new Elastic Flow Distributor library")
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>
> This fix requires an API breakage and therefore it is not
> a good candidate for backporting (besides, it is a very low impact bug).
> Hence, I am not CC'ing stable.

This is an unannounced breakage for a stable API.
Cc: techboard + Ray for awareness.


>
> ---
>
>  lib/efd/rte_efd.c | 2 +-
>  lib/efd/rte_efd.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
> index 77f46809f8..68a2378e88 100644
> --- a/lib/efd/rte_efd.c
> +++ b/lib/efd/rte_efd.c
> @@ -495,7 +495,7 @@ efd_search_hash(struct rte_efd_table * const table,
>
>  struct rte_efd_table *
>  rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
> -               uint8_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket)
> +               uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket)
>  {
>         struct rte_efd_table *table = NULL;
>         uint8_t *key_array = NULL;
> diff --git a/lib/efd/rte_efd.h b/lib/efd/rte_efd.h
> index c2be4c09ae..d3d7befd0c 100644
> --- a/lib/efd/rte_efd.h
> +++ b/lib/efd/rte_efd.h
> @@ -139,7 +139,7 @@ typedef uint16_t efd_hashfunc_t;
>   */
>  struct rte_efd_table *
>  rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
> -       uint8_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket);
> +       uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket);
>
>  /**
>   * Releases the resources from an EFD table
> --
> 2.25.1
>
Kinsella, Ray Sept. 14, 2021, 10:49 a.m. UTC | #3
On 14/09/2021 08:10, David Marchand wrote:
> On Fri, Sep 10, 2021 at 6:54 PM Pablo de Lara
> <pablo.de.lara.guarch@intel.com> wrote:
>>
>> rte_efd_create() function was using uint8_t for a socket bitmask,
>> for one of its parameters.
>> This limits the maximum of NUMA sockets to be 8.
>> Changing to to uint64_t increases it to 64, which should be
>> more future-proof.
> 
> Cc: ppc maintainer, since I think powerX servers have non contiguous
> NUMA sockets.
> 
> 
>>
>> Coverity issue: 366390
>> Fixes: 56b6ef874f8 ("efd: new Elastic Flow Distributor library")
>>
>> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>> ---
>>
>> This fix requires an API breakage and therefore it is not
>> a good candidate for backporting (besides, it is a very low impact bug).
>> Hence, I am not CC'ing stable.
> 
> This is an unannounced breakage for a stable API.
> Cc: techboard + Ray for awareness.

Understood.
Its low impact, at a time we are changing the ABI in any case.

> 
> 
>>
>> ---
>>
>>  lib/efd/rte_efd.c | 2 +-
>>  lib/efd/rte_efd.h | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
>> index 77f46809f8..68a2378e88 100644
>> --- a/lib/efd/rte_efd.c
>> +++ b/lib/efd/rte_efd.c
>> @@ -495,7 +495,7 @@ efd_search_hash(struct rte_efd_table * const table,
>>
>>  struct rte_efd_table *
>>  rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
>> -               uint8_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket)
>> +               uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket)
>>  {
>>         struct rte_efd_table *table = NULL;
>>         uint8_t *key_array = NULL;
>> diff --git a/lib/efd/rte_efd.h b/lib/efd/rte_efd.h
>> index c2be4c09ae..d3d7befd0c 100644
>> --- a/lib/efd/rte_efd.h
>> +++ b/lib/efd/rte_efd.h
>> @@ -139,7 +139,7 @@ typedef uint16_t efd_hashfunc_t;
>>   */
>>  struct rte_efd_table *
>>  rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
>> -       uint8_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket);
>> +       uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket);
>>
>>  /**
>>   * Releases the resources from an EFD table
>> --
>> 2.25.1
>>
> 
>
David Christensen Sept. 14, 2021, 6:20 p.m. UTC | #4
On 9/14/21 12:10 AM, David Marchand wrote:
> On Fri, Sep 10, 2021 at 6:54 PM Pablo de Lara
> <pablo.de.lara.guarch@intel.com> wrote:
>>
>> rte_efd_create() function was using uint8_t for a socket bitmask,
>> for one of its parameters.
>> This limits the maximum of NUMA sockets to be 8.
>> Changing to to uint64_t increases it to 64, which should be
>> more future-proof.
> 
> Cc: ppc maintainer, since I think powerX servers have non contiguous
> NUMA sockets.

Definitely correct, POWER CPU NUMA sockets are not necessarily contiguous.

Can you update efd_autotest and efd_perf_autotest as well?  After 
applying this patch the test still fails on my POWER9 system:

$ sudo /home/drc/src/dpdk/build/app/test/dpdk-test -l 64-127 -n 4 --no-pci
...
RTE>>efd_autotest
Entering test_add_delete
EFD: At least one CPU socket must be enabled in the bitmask
EAL: Test assert test_add_delete line 125 failed: Error creating the EFD 
table

Test Failed
RTE>>

On this system lcores 64-127 reside on NUMA socket 8.

Dave
diff mbox series

Patch

diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index 77f46809f8..68a2378e88 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -495,7 +495,7 @@  efd_search_hash(struct rte_efd_table * const table,
 
 struct rte_efd_table *
 rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
-		uint8_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket)
+		uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket)
 {
 	struct rte_efd_table *table = NULL;
 	uint8_t *key_array = NULL;
diff --git a/lib/efd/rte_efd.h b/lib/efd/rte_efd.h
index c2be4c09ae..d3d7befd0c 100644
--- a/lib/efd/rte_efd.h
+++ b/lib/efd/rte_efd.h
@@ -139,7 +139,7 @@  typedef uint16_t efd_hashfunc_t;
  */
 struct rte_efd_table *
 rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
-	uint8_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket);
+	uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket);
 
 /**
  * Releases the resources from an EFD table