[dpdk-dev][dpdk-users] A problem about memory may not be all-zero allocated by rte_zmalloc_socket()
Honnappa Nagarahalli
Honnappa.Nagarahalli at arm.com
Tue Feb 8 19:05:00 CET 2022
Hi Yunjian,
This is not a synchronization problem. The memory is getting allocated and used in the same thread. Are you using a single socket system?
Thanks,
Honnappa
From: wangyunjian <wangyunjian at huawei.com>
Sent: Tuesday, February 8, 2022 2:01 AM
To: Honnappa Nagarahalli <Honnappa.Nagarahalli at arm.com>; dev at dpdk.org; users at dpdk.org
Cc: Feifei Wang <Feifei.Wang2 at arm.com>; Ruifeng Wang <Ruifeng.Wang at arm.com>; Huangshaozhang <huangshaozhang at huawei.com>; dingxiaoxiong <dingxiaoxiong at huawei.com>; nd <nd at arm.com>
Subject: RE: [dpdk-dev][dpdk-users] A problem about memory may not be all-zero allocated by rte_zmalloc_socket()
There is also a condition that the hugepagesz is 1G.
If the hugepagesz is 2M, this problem cannot be repeated.
Thanks,
Yunjian
From: wangyunjian
Sent: Monday, February 7, 2022 10:44 AM
To: 'Honnappa Nagarahalli' <Honnappa.Nagarahalli at arm.com<mailto:Honnappa.Nagarahalli at arm.com>>; dev at dpdk.org<mailto:dev at dpdk.org>; users at dpdk.org<mailto:users at dpdk.org>
Cc: Feifei Wang <Feifei.Wang2 at arm.com<mailto:Feifei.Wang2 at arm.com>>; Ruifeng Wang <Ruifeng.Wang at arm.com<mailto:Ruifeng.Wang at arm.com>>; Huangshaozhang <huangshaozhang at huawei.com<mailto:huangshaozhang at huawei.com>>; dingxiaoxiong <dingxiaoxiong at huawei.com<mailto:dingxiaoxiong at huawei.com>>; nd <nd at arm.com<mailto:nd at arm.com>>
Subject: RE: [dpdk-dev][dpdk-users] A problem about memory may not be all-zero allocated by rte_zmalloc_socket()
Hi, Honnappa
This problem is probability. Test case need to be executed multiple times.
The test steps and code are as follows:
/home/dpdk #./arm64-armv8a-linuxapp-gcc/app/dpdk-testpmd --legacy-mem -c 0xC -m 8192
app/test-pmd/testpmd.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 55eb293cc0..3c127f9623 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4251,6 +4251,20 @@ main(int argc, char** argv)
rte_stats_bitrate_reg(bitrate_data);
}
#endif
+
+ printf("start test rte_zmalloc_socket\n");
+ char *a;
+ while((a = rte_zmalloc_socket(NULL, 1024 * 1024, 0, SOCKET_ID_ANY)) != NULL) {
+ for (int i = 0; i < 1024 * 1024; i++) {
+ if (a[i] != 0) {
+ printf("a[%d] = %d\n",i,a[i]);
+ }
+ a[i] = 255; // This assignment is important. It can increase the probability.
+ }
+ }
+ printf("end test rte_zmalloc_socket\n");
+ return EXIT_SUCCESS;
+
#ifdef RTE_LIB_CMDLINE
if (strlen(cmdline_filename) != 0)
cmdline_read_from_file(cmdline_filename);
Thanks,
Yunjian
From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli at arm.com]
Sent: Monday, January 31, 2022 12:22 PM
To: wangyunjian <wangyunjian at huawei.com<mailto:wangyunjian at huawei.com>>; dev at dpdk.org<mailto:dev at dpdk.org>; users at dpdk.org<mailto:users at dpdk.org>
Cc: Feifei Wang <Feifei.Wang2 at arm.com<mailto:Feifei.Wang2 at arm.com>>; Ruifeng Wang <Ruifeng.Wang at arm.com<mailto:Ruifeng.Wang at arm.com>>; Huangshaozhang <huangshaozhang at huawei.com<mailto:huangshaozhang at huawei.com>>; dingxiaoxiong <dingxiaoxiong at huawei.com<mailto:dingxiaoxiong at huawei.com>>; Honnappa Nagarahalli <Honnappa.Nagarahalli at arm.com<mailto:Honnappa.Nagarahalli at arm.com>>; nd <nd at arm.com<mailto:nd at arm.com>>
Subject: RE: [dpdk-dev][dpdk-users] A problem about memory may not be all-zero allocated by rte_zmalloc_socket()
Hi Yunjian,
That's interesting. Is it possible to elaborate the use case or possibly provide the code snippet?
It is possible that it is a synchronization problem due to relaxed memory model that Arm architecture uses. There could be a barrier missing in the code.
Thanks,
Honnappa
From: wangyunjian <wangyunjian at huawei.com<mailto:wangyunjian at huawei.com>>
Sent: Saturday, January 29, 2022 9:21 PM
To: dev at dpdk.org<mailto:dev at dpdk.org>; users at dpdk.org<mailto:users at dpdk.org>
Cc: Feifei Wang <Feifei.Wang2 at arm.com<mailto:Feifei.Wang2 at arm.com>>; Ruifeng Wang <Ruifeng.Wang at arm.com<mailto:Ruifeng.Wang at arm.com>>; Huangshaozhang <huangshaozhang at huawei.com<mailto:huangshaozhang at huawei.com>>; dingxiaoxiong <dingxiaoxiong at huawei.com<mailto:dingxiaoxiong at huawei.com>>
Subject: [dpdk-dev][dpdk-users] A problem about memory may not be all-zero allocated by rte_zmalloc_socket()
Hi, all
There's a problem that the memory are allocated by rte_zmalloc_socket()
may not be all-zero on the ARM platform.
However, the x86 platform does not have this problem.
Any ideas ?
Thanks,
Yunjian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20220208/4071ced4/attachment-0001.htm>
More information about the dev
mailing list