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 2F809A034F; Mon, 7 Feb 2022 03:44:03 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A874C4069D; Mon, 7 Feb 2022 03:44:02 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id E4EE940685; Mon, 7 Feb 2022 03:44:00 +0100 (CET) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4JsVkS4WGFzVfq7; Mon, 7 Feb 2022 10:40:48 +0800 (CST) Received: from dggpemm100016.china.huawei.com (7.185.36.192) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 7 Feb 2022 10:43:58 +0800 Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggpemm100016.china.huawei.com (7.185.36.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 7 Feb 2022 10:43:57 +0800 Received: from dggpemm500008.china.huawei.com ([7.185.36.136]) by dggpemm500008.china.huawei.com ([7.185.36.136]) with mapi id 15.01.2308.021; Mon, 7 Feb 2022 10:43:57 +0800 From: wangyunjian To: Honnappa Nagarahalli , "dev@dpdk.org" , "users@dpdk.org" CC: Feifei Wang , Ruifeng Wang , Huangshaozhang , dingxiaoxiong , nd Subject: RE: [dpdk-dev][dpdk-users] A problem about memory may not be all-zero allocated by rte_zmalloc_socket() Thread-Topic: [dpdk-dev][dpdk-users] A problem about memory may not be all-zero allocated by rte_zmalloc_socket() Thread-Index: AdgViF0h9zoMAuSNQ6SwzCLA7pDXJwA0WT2gAVxGsfA= Date: Mon, 7 Feb 2022 02:43:57 +0000 Message-ID: References: <61c1d85e0f8a42d4812830864fc59b0a@huawei.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.242.157] Content-Type: multipart/alternative; boundary="_000_c46f2cfe9ee34d79b7fd80dabc642dcfhuaweicom_" MIME-Version: 1.0 X-CFilter-Loop: Reflected 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 --_000_c46f2cfe9ee34d79b7fd80dabc642dcfhuaweicom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 0= xC -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 =3D rte_zmalloc_socket(NULL, 1024 * 1024, 0, SOCKET_ID_ANY= )) !=3D NULL) { + for (int i =3D 0; i < 1024 * 1024; i++) { + if (a[i] !=3D 0) { + printf("a[%d] =3D %d\n",i,a[i]); + } + a[i] =3D 255; // This assignment is important. I= t can increase the probability. + } + } + printf("end test rte_zmalloc_socket\n"); + return EXIT_SUCCESS; + #ifdef RTE_LIB_CMDLINE if (strlen(cmdline_filename) !=3D 0) cmdline_read_from_file(cmdline_filename); Thanks, Yunjian From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com] Sent: Monday, January 31, 2022 12:22 PM To: wangyunjian ; dev@dpdk.org; users@dpdk.org Cc: Feifei Wang ; Ruifeng Wang = ; Huangshaozhang ; dingxiaoxiong ; Honnappa Nagarahalli ; nd Subject: RE: [dpdk-dev][dpdk-users] A problem about memory may not be all-z= ero allocated by rte_zmalloc_socket() Hi Yunjian, That's interesting. Is it possible to elaborate the use cas= e or possibly provide the code snippet? It is possible that it is a synchronization problem due to relaxed memory m= odel that Arm architecture uses. There could be a barrier missing in the co= de. Thanks, Honnappa From: wangyunjian > Sent: Saturday, January 29, 2022 9:21 PM To: dev@dpdk.org; users@dpdk.org Cc: Feifei Wang >; Ruifen= g Wang >; Huangshaozhang = >; dingxiaoxion= g > 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 --_000_c46f2cfe9ee34d79b7fd80dabc642dcfhuaweicom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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-l= inuxapp-gcc/app/dpdk-testpmd --legacy-mem  -c 0xC  -m 8192

 

app/test-pmd/testpmd.c | 14 = ++++++++++++++=

1 file changed, 14 insertion= s(+)

 

diff --git a/app/test-pmd/te= stpmd.c b/app/test-pmd/testpmd.c

index 55eb293cc0..3c127f9623= 100644

--- a/app/test-pmd/testpmd.c=

+++ b/app/test-p= md/testpmd.c

@@ -4251,6 +4251,20 @@ m= ain(int argc, char** argv)

    &nbs= p;             = rte_stats_bitrate_reg(bitrate_data);

    &nbs= p;   }

#endif

+

+    = ;   printf("start test rte_zmalloc_socket\n");

+    = ;   char *a;

+    = ;   while((a =3D rte_zmalloc_socket(NULL, 1024 * 1024, 0, SOCKET_= ID_ANY)) !=3D NULL) {

+    = ;            for (in= t i =3D 0; i < 1024 * 1024; i++) {

+    = ;            &n= bsp;         if (a[i] !=3D 0) {

+    = ;            &n= bsp;            = ;      printf("a[%d] =3D %d\n",i,a[i]);<= o:p>

+    = ;            &n= bsp;         }

+    = ;            &n= bsp;         a[i] =3D 255; // This = assignment is important. It can increase the probability.=

+    = ;            }<= /o:p>

+    = ;   }

+    = ;   printf("end test rte_zmalloc_socket\n");=

+    = ;   return EXIT_SUCCESS;

+

#ifdef RTE_LIB_CMDLINE<= /o:p>

    &nbs= p;   if (strlen(cmdline_filename) !=3D 0)

    &nbs= p;             = cmdline_read_from_file(cmdline_filename);

&n= bsp;

Than= ks,

Yunj= ian

&n= bsp;

From: Honnappa Nagarahalli [mailto:Honnappa.Nagarah= alli@arm.com]
Sent: Monday, January 31, 2022 12:22 PM
To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org; users@= dpdk.org
Cc: Feifei Wang <Feifei.Wang2@arm.com>; Ruifeng Wang <Ruife= ng.Wang@arm.com>; Huangshaozhang <huangshaozhang@huawei.com>; ding= xiaoxiong <dingxiaoxiong@huawei.com>; Honnappa Nagarahalli <Honnap= pa.Nagarahalli@arm.com>; nd <nd@arm.com>
Subject: RE: [dpdk-dev][dpdk-users] A problem about memory may not b= e all-zero allocated by rte_zmalloc_socket()

 

Hi Y= unjian,

&nbs= p;            &= nbsp;  That’s interesting. Is it possible to elaborate the use c= ase or possibly provide the code snippet?

 

It i= s 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.<= o:p>

 

Than= ks,

Honn= appa

 

From: wangyunjian <wangyunjian@huawei.com>
Sent: Saturday, January 29, 2022 9:21 PM
To: dev@dpdk.org; users@dpdk.org
Cc: Feifei Wang <Feifei.W= ang2@arm.com>; Ruifeng Wang <Ruifeng.Wang@arm.com>; Huangshaozhang <huangshaozhang@huawei.com>; dingxiaoxiong <dingxiaoxion= g@huawei.com>
Subject: [dpdk-dev][dpdk-users] A problem about memory may not be al= l-zero allocated by rte_zmalloc_socket()

 

Hi, all

 

There's a problem that the memo= ry 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

 

--_000_c46f2cfe9ee34d79b7fd80dabc642dcfhuaweicom_--