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 B155EA0C46; Mon, 20 Sep 2021 21:30:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FCB540DF7; Mon, 20 Sep 2021 21:30:56 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mails.dpdk.org (Postfix) with ESMTP id 2391A40DF5 for ; Mon, 20 Sep 2021 21:30:55 +0200 (CEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18KJGBQI000872; Mon, 20 Sep 2021 15:30:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=AlwXk/NpRV5Koa3vKEpmDFfdf5RU3Phacqa6BLGAP0k=; b=TFpUnRMvJckrL3NZDw9FKv7gfJEDM0WMb+GJi3JW9kq7Rfr/JzrOb0qItRKIKXmS0w4c 5NKVfUe8YPSiHVu4DVZk99sxabUIWcsCBOAVIw4wRsxZAAFnvviZNgTuCQ1MplkNTtWj DKbSGLCSug5CuKXPh6t9EvVurWeloBp/PxD46giHqoEGprAhc4sjC+v7V8QNdsUN7+Ls +YC88NotFV7ex6qtDiVcy26/9apEQp1pLWKCyy1iS+09mt27QUFj/oGghfI97ewsazr0 B++Os3hzc6bWJS0xWCqSaAYu8rSn3Dbhy+y9LWHPaYR0i1yY8gKYHTPFm0j2rQBzQAiB Nw== Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com with ESMTP id 3b5w0pkrn0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Sep 2021 15:30:54 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18KJN8Ab028778; Mon, 20 Sep 2021 19:30:53 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma03dal.us.ibm.com with ESMTP id 3b57ra8ufy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Sep 2021 19:30:53 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18KJUqAf34996586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Sep 2021 19:30:52 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6BD002805E; Mon, 20 Sep 2021 19:30:52 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 80CCB28072; Mon, 20 Sep 2021 19:30:51 +0000 (GMT) Received: from Davids-MBP.randomparity.org (unknown [9.211.49.26]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 20 Sep 2021 19:30:51 +0000 (GMT) To: Pablo de Lara , yipeng1.wang@intel.com, byron.marohn@intel.com Cc: dev@dpdk.org, John McNamara References: <20210910165346.807715-1-pablo.de.lara.guarch@intel.com> <20210917125606.2524678-1-pablo.de.lara.guarch@intel.com> From: David Christensen Message-ID: <91cf5326-e01d-3f85-a642-879f50b4c8b5@linux.vnet.ibm.com> Date: Mon, 20 Sep 2021 12:30:50 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <20210917125606.2524678-1-pablo.de.lara.guarch@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: FwifZKmmhRYKWExWC-qVWt-vy9uqgscJ X-Proofpoint-GUID: FwifZKmmhRYKWExWC-qVWt-vy9uqgscJ Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-20_07,2021-09-20_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 clxscore=1011 priorityscore=1501 malwarescore=0 impostorscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109200111 Subject: Re: [dpdk-dev] [PATCH v3] efd: change data type of parameter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 9/17/21 5:56 AM, Pablo de Lara 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 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 > Acked-by: John McNamara > --- > > v3: Fixed commit message > > v2: Fixed EFD tests > > --- > > app/test/test_efd.c | 4 ++-- > app/test/test_efd_perf.c | 4 ++-- > lib/efd/rte_efd.c | 2 +- > lib/efd/rte_efd.h | 2 +- > 4 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/app/test/test_efd.c b/app/test/test_efd.c > index 180dc4748e..581519c1e0 100644 > --- a/app/test/test_efd.c > +++ b/app/test/test_efd.c > @@ -91,9 +91,9 @@ static struct flow_key keys[5] = { > /* Array to store the data */ > static efd_value_t data[5]; > > -static inline uint8_t efd_get_all_sockets_bitmask(void) > +static inline uint64_t efd_get_all_sockets_bitmask(void) > { > - uint8_t all_cpu_sockets_bitmask = 0; > + uint64_t all_cpu_sockets_bitmask = 0; > unsigned int i; > unsigned int next_lcore = rte_get_main_lcore(); > const int val_true = 1, val_false = 0; > diff --git a/app/test/test_efd_perf.c b/app/test/test_efd_perf.c > index 1c47704475..f3fe3b1736 100644 > --- a/app/test/test_efd_perf.c > +++ b/app/test/test_efd_perf.c > @@ -29,9 +29,9 @@ > #endif > static unsigned int test_socket_id; > > -static inline uint8_t efd_get_all_sockets_bitmask(void) > +static inline uint64_t efd_get_all_sockets_bitmask(void) > { > - uint8_t all_cpu_sockets_bitmask = 0; > + uint64_t all_cpu_sockets_bitmask = 0; > unsigned int i; > unsigned int next_lcore = rte_get_main_lcore(); > const int val_true = 1, val_false = 0; > 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 > After applying the patch I receive a segmentation fault when I use lcores on the second NUMA node (node 8). $ lscpu Architecture: ppc64le .. NUMA node0 CPU(s): 0-63 NUMA node8 CPU(s): 64-127 Working case: --------------------------- $ sudo /home/drc/src/dpdk/build/app/test/dpdk-test -l 59-63 -n 4 --no-pci EAL: Detected 128 lcore(s) EAL: Detected 2 NUMA nodes EAL: Detected static linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: No available 1048576 kB hugepages reported EAL: VFIO support initialized APP: HPET is not enabled, using TSC as default timer RTE>>efd_autotest Entering test_add_delete Entering test_efd_find_existing Entering test_add_update_delete Entering test_five_keys Entering test_efd_creation_with_bad_parameters, **Errors are expected ** EFD: Allocating key array on socket 0 failed EFD: At least one CPU socket must be enabled in the bitmask EFD: Allocating EFD table management structure on socket 255 failed # Test successful. No more errors expected Evaluating table utilization and correctness, please wait Added 2097152 Succeeded 2097152 Lost 0 Added 2097152 Succeeded 2097152 Lost 0 Added 2097152 Succeeded 2097152 Lost 0 Average table utilization = 100.00% (2097152/2097152) Test OK RTE>>quit Failing case: --------------------------- sudo /home/drc/src/dpdk/build/app/test/dpdk-test -l 64-69 -n 4 --no-pci EAL: Detected 128 lcore(s) EAL: Detected 2 NUMA nodes EAL: Detected static linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: No available 1048576 kB hugepages reported EAL: VFIO support initialized APP: HPET is not enabled, using TSC as default timer RTE>>efd_autotest Entering test_add_delete Segmentation fault What's the purpose of "test_socket_id" in the file app/test/test_efd.c? I don't see it set during the test, default to 0, and it looks like it should be 8 in this situation: sudo gdb --args /home/drc/src/dpdk/build/app/test/dpdk-test -l 64-69 -n 4 --no-pci GNU gdb (GDB) Red Hat Enterprise Linux 8.2-12.el8 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "ppc64le-redhat-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/drc/src/dpdk/build/app/test/dpdk-test...done. (gdb) b test_and_delete Function "test_and_delete" not defined. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) b efd_get_choice Breakpoint 1 at 0x1090dbdc: file ../lib/efd/rte_efd.c, line 319. (gdb) b test_add_delete Breakpoint 2 at 0x1009d7a8: test_add_delete. (2 locations) (gdb) start Temporary breakpoint 3 at 0x1000f340: file ../app/test/test.c, line 105. Starting program: /home/drc/src/dpdk/build/app/test/dpdk-test -l 64-69 -n 4 --no-pci [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/power9/libthread_db.so.1". Temporary breakpoint 3, main (argc=6, argv=0x7ffffffff138) at ../app/test/test.c:105 105 { Missing separate debuginfos, use: yum debuginfo-install libibverbs-52mlnx1-1.53100.ppc64le (gdb) c Continuing. EAL: Detected 128 lcore(s) EAL: Detected 2 NUMA nodes EAL: Detected static linkage of DPDK [New Thread 0x7ffff746d090 (LWP 290647)] EAL: Multi-process socket /var/run/dpdk/rte/mp_socket [New Thread 0x7ffff6c5d090 (LWP 290648)] EAL: Selected IOVA mode 'VA' EAL: No available 1048576 kB hugepages reported EAL: VFIO support initialized [New Thread 0x7ffff644d090 (LWP 290649)] [New Thread 0x7ffff5c3d090 (LWP 290650)] [New Thread 0x7ffff542d090 (LWP 290651)] [New Thread 0x7ffff4c1d090 (LWP 290652)] [New Thread 0x7ffff440d090 (LWP 290653)] [New Thread 0x7ffff3bfd090 (LWP 290654)] [New Thread 0x7ffff33ed090 (LWP 290655)] APP: HPET is not enabled, using TSC as default timer RTE>>efd_autotest Thread 1 "dpdk-test" hit Breakpoint 2, test_add_delete () at ../app/test/test_efd.c:120 120 printf("Entering %s\n", __func__); (gdb) bt #0 test_add_delete () at ../app/test/test_efd.c:120 #1 0x000000001009ec54 in test_efd () at ../app/test/test_efd.c:448 #2 0x0000000010009b4c in cmd_autotest_parsed (parsed_result=0x7fffffff8620, cl=0x200196d0, data=0x0) at ../app/test/commands.c:71 #3 0x000000001095a808 in cmdline_parse (cl=0x200196d0, buf=0x20019718 "efd_autotest\n") at ../lib/cmdline/cmdline_parse.c:290 #4 0x0000000010957c90 in cmdline_valid_buffer (rdl=0x200196e0, buf=0x20019718 "efd_autotest\n", size=14) at ../lib/cmdline/cmdline.c:26 #5 0x000000001095e8a8 in rdline_char_in (rdl=0x200196e0, c=10 '\n') at ../lib/cmdline/cmdline_rdline.c:421 #6 0x0000000010958258 in cmdline_in (cl=0x200196d0, buf=0x7fffffffe800 "\n\226\001 ", size=1) at ../lib/cmdline/cmdline.c:149 #7 0x00000000109585f0 in cmdline_interact (cl=0x200196d0) at ../lib/cmdline/cmdline.c:223 #8 0x000000001000f988 in main (argc=1, argv=0x7ffffffff160) at ../app/test/test.c:234 (gdb) n Entering test_add_delete 122 handle = rte_efd_create("test_add_delete", (gdb) n 125 TEST_ASSERT_NOT_NULL(handle, "Error creating the EFD table\n"); (gdb) n 127 data[0] = mrand48() & VALUE_BITMASK; (gdb) n 128 TEST_ASSERT_SUCCESS(rte_efd_update(handle, test_socket_id, &keys[0], (gdb) p test_socket_id $1 = 0 (gdb) c Continuing. Thread 1 "dpdk-test" hit Breakpoint 1, efd_get_choice (table=0x1003fff00, socket_id=0, chunk_id=218, bin_id=120) at ../lib/efd/rte_efd.c:319 319 struct efd_online_chunk *chunk = &table->chunks[socket_id][chunk_id]; (gdb) p table $2 = (const struct rte_efd_table * const) 0x1003fff00 (gdb) p *table $3 = {name = "test_add_delete", '\000' , key_len = 13, max_num_rules = 3670016, num_rules = 0, num_chunks = 2048, num_chunks_shift = 11, lookup_fn = EFD_LOOKUP_SCALAR, chunks = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11011dff00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, offline_chunks = 0x10327e000, free_slots = 0x1049ffd00, keys = 0x100480000 ""} (gdb) p *table->chunk[0] There is no member named chunk. (gdb) p *table->chunks[0] Cannot access memory at address 0x0 (gdb) p *table->chunks[8] $4 = {bin_choice_list = '\000' , groups = {{hash_idx = {0, 0, 0, 0, 0, 0, 0, 0}, lookup_table = {0, 0, 0, 0, 0, 0, 0, 0}} }} (gdb) c Continuing. Thread 1 "dpdk-test" received signal SIGSEGV, Segmentation fault. 0x000000001090dc18 in efd_get_choice (table=0x1003fff00, socket_id=0, chunk_id=218, bin_id=120) at ../lib/efd/rte_efd.c:325 325 uint8_t choice_chunk = (gdb) p chunk $5 = (struct efd_online_chunk *) 0x70680 (gdb) p *chunk Cannot access memory at address 0x70680 (gdb) Not clear to me if this is an existing problem with POWER or related to your patch. Can someone more familiar with EFD chime in? Dave