From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 63B42A49 for ; Tue, 7 May 2019 12:39:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 May 2019 03:39:52 -0700 X-ExtLoop1: 1 Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by fmsmga001.fm.intel.com with ESMTP; 07 May 2019 03:39:51 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.31]) by IRSMSX108.ger.corp.intel.com ([169.254.11.82]) with mapi id 14.03.0415.000; Tue, 7 May 2019 11:39:51 +0100 From: "Ananyev, Konstantin" To: David Christensen , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 3/4] test: change memory barrier variables to uint64_t Thread-Index: AQHVBEFTp2pkqW2q9EmAHe4XI/qYO6ZfeOoQ Date: Tue, 7 May 2019 10:39:50 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772580148AA2191@irsmsx105.ger.corp.intel.com> References: <1557170634-99830-1-git-send-email-drc@linux.vnet.ibm.com> In-Reply-To: <1557170634-99830-1-git-send-email-drc@linux.vnet.ibm.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzBlNTM0NWUtM2E4OS00MjMyLWI5ZmQtNDM2MDI4NzU5ODU2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiakxpSEhjZm5WK3NTalBNZGN3Q1I4Y3ZIVVZVWEc3RG1qZHBqRFBWUUptUUxmUlJvQWQzMkhKMFwvRnpTWVQ4Q1kifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 3/4] test: change memory barrier variables to uint64_t X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 May 2019 10:39:55 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Christensen > Sent: Monday, May 6, 2019 8:24 PM > To: dev@dpdk.org > Cc: David Christensen > Subject: [dpdk-dev] [PATCH v2 3/4] test: change memory barrier variables = to uint64_t >=20 > Memory barrier failures can be intermittent. Increase the size of the > sum/val/iteration variables to allow tests that can run for days so that > sporadic errors can be identified. >=20 > Signed-off-by: David Christensen > --- > v2: > * Removed change to ITER_MAX >=20 > app/test/test_barrier.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) >=20 > diff --git a/app/test/test_barrier.c b/app/test/test_barrier.c > index ae37b1e..a022708 100644 > --- a/app/test/test_barrier.c > +++ b/app/test/test_barrier.c > @@ -55,8 +55,8 @@ struct plock { > */ > struct plock_test { > struct plock lock; > - uint32_t val; > - uint32_t iter; > + uint64_t val; > + uint64_t iter; > }; >=20 > /* > @@ -65,8 +65,8 @@ struct plock_test { > */ > struct lcore_plock_test { > struct plock_test *pt[2]; /* shared, lock-protected data */ > - uint32_t sum[2]; /* local copy of the shared data */ > - uint32_t iter; /* number of iterations to perfom */ > + uint64_t sum[2]; /* local copy of the shared data */ > + uint64_t iter; /* number of iterations to perfom */ > uint32_t lc; /* given lcore id */ > }; Not sure why you think this is needed - right now both iter and sum wouldn't be bigger than 32bit (max value that sum can reach: 2^27). >=20 > @@ -130,7 +130,8 @@ struct lcore_plock_test { > plock_test1_lcore(void *data) > { > uint64_t tm; > - uint32_t i, lc, ln, n; > + uint32_t lc, ln; > + uint64_t i, n; > struct lcore_plock_test *lpt; >=20 > lpt =3D data; > @@ -166,9 +167,9 @@ struct lcore_plock_test { >=20 > tm =3D rte_get_timer_cycles() - tm; >=20 > - printf("%s(%u): %u iterations finished, in %" PRIu64 > + printf("%s(%u): %lu iterations finished, in %" PRIu64 > " cycles, %#Lf cycles/iteration, " > - "local sum=3D{%u, %u}\n", > + "local sum=3D{%lu, %lu}\n", > __func__, lc, i, tm, (long double)tm / i, > lpt->sum[0], lpt->sum[1]); > return 0; > @@ -184,11 +185,11 @@ struct lcore_plock_test { > * and local data are the same. > */ > static int > -plock_test(uint32_t iter, enum plock_use_type utype) > +plock_test(uint64_t iter, enum plock_use_type utype) > { > int32_t rc; > uint32_t i, lc, n; > - uint32_t *sum; > + uint64_t *sum; > struct plock_test *pt; > struct lcore_plock_test *lpt; >=20 > @@ -199,7 +200,7 @@ struct lcore_plock_test { > lpt =3D calloc(n, sizeof(*lpt)); > sum =3D calloc(n + 1, sizeof(*sum)); >=20 > - printf("%s(iter=3D%u, utype=3D%u) started on %u lcores\n", > + printf("%s(iter=3D%lu, utype=3D%u) started on %u lcores\n", > __func__, iter, utype, n); >=20 > if (pt =3D=3D NULL || lpt =3D=3D NULL || sum =3D=3D NULL) { > @@ -247,7 +248,7 @@ struct lcore_plock_test { >=20 > rc =3D 0; > for (i =3D 0; i !=3D n; i++) { > - printf("%s: sum[%u]=3D%u, pt[%u].val=3D%u, pt[%u].iter=3D%u;\n", > + printf("%s: sum[%u]=3D%lu, pt[%u].val=3D%lu, pt[%u].iter=3D%lu;\n", Here and in other places, you need to use PRIu64 for 64 bit values. > __func__, i, sum[i], i, pt[i].val, i, pt[i].iter); >=20 > /* race condition occurred, lock doesn't work properly */ > -- > 1.8.3.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9C956A0096 for ; Tue, 7 May 2019 12:39:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 84AF928FD; Tue, 7 May 2019 12:39:56 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 63B42A49 for ; Tue, 7 May 2019 12:39:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 May 2019 03:39:52 -0700 X-ExtLoop1: 1 Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by fmsmga001.fm.intel.com with ESMTP; 07 May 2019 03:39:51 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.31]) by IRSMSX108.ger.corp.intel.com ([169.254.11.82]) with mapi id 14.03.0415.000; Tue, 7 May 2019 11:39:51 +0100 From: "Ananyev, Konstantin" To: David Christensen , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 3/4] test: change memory barrier variables to uint64_t Thread-Index: AQHVBEFTp2pkqW2q9EmAHe4XI/qYO6ZfeOoQ Date: Tue, 7 May 2019 10:39:50 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772580148AA2191@irsmsx105.ger.corp.intel.com> References: <1557170634-99830-1-git-send-email-drc@linux.vnet.ibm.com> In-Reply-To: <1557170634-99830-1-git-send-email-drc@linux.vnet.ibm.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzBlNTM0NWUtM2E4OS00MjMyLWI5ZmQtNDM2MDI4NzU5ODU2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiakxpSEhjZm5WK3NTalBNZGN3Q1I4Y3ZIVVZVWEc3RG1qZHBqRFBWUUptUUxmUlJvQWQzMkhKMFwvRnpTWVQ4Q1kifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 3/4] test: change memory barrier variables to uint64_t X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Message-ID: <20190507103950.Jl7mgBT3nBPgY-ofADnJBiBj_XpUeKEje-vaIl0Rmoo@z> > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Christensen > Sent: Monday, May 6, 2019 8:24 PM > To: dev@dpdk.org > Cc: David Christensen > Subject: [dpdk-dev] [PATCH v2 3/4] test: change memory barrier variables = to uint64_t >=20 > Memory barrier failures can be intermittent. Increase the size of the > sum/val/iteration variables to allow tests that can run for days so that > sporadic errors can be identified. >=20 > Signed-off-by: David Christensen > --- > v2: > * Removed change to ITER_MAX >=20 > app/test/test_barrier.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) >=20 > diff --git a/app/test/test_barrier.c b/app/test/test_barrier.c > index ae37b1e..a022708 100644 > --- a/app/test/test_barrier.c > +++ b/app/test/test_barrier.c > @@ -55,8 +55,8 @@ struct plock { > */ > struct plock_test { > struct plock lock; > - uint32_t val; > - uint32_t iter; > + uint64_t val; > + uint64_t iter; > }; >=20 > /* > @@ -65,8 +65,8 @@ struct plock_test { > */ > struct lcore_plock_test { > struct plock_test *pt[2]; /* shared, lock-protected data */ > - uint32_t sum[2]; /* local copy of the shared data */ > - uint32_t iter; /* number of iterations to perfom */ > + uint64_t sum[2]; /* local copy of the shared data */ > + uint64_t iter; /* number of iterations to perfom */ > uint32_t lc; /* given lcore id */ > }; Not sure why you think this is needed - right now both iter and sum wouldn't be bigger than 32bit (max value that sum can reach: 2^27). >=20 > @@ -130,7 +130,8 @@ struct lcore_plock_test { > plock_test1_lcore(void *data) > { > uint64_t tm; > - uint32_t i, lc, ln, n; > + uint32_t lc, ln; > + uint64_t i, n; > struct lcore_plock_test *lpt; >=20 > lpt =3D data; > @@ -166,9 +167,9 @@ struct lcore_plock_test { >=20 > tm =3D rte_get_timer_cycles() - tm; >=20 > - printf("%s(%u): %u iterations finished, in %" PRIu64 > + printf("%s(%u): %lu iterations finished, in %" PRIu64 > " cycles, %#Lf cycles/iteration, " > - "local sum=3D{%u, %u}\n", > + "local sum=3D{%lu, %lu}\n", > __func__, lc, i, tm, (long double)tm / i, > lpt->sum[0], lpt->sum[1]); > return 0; > @@ -184,11 +185,11 @@ struct lcore_plock_test { > * and local data are the same. > */ > static int > -plock_test(uint32_t iter, enum plock_use_type utype) > +plock_test(uint64_t iter, enum plock_use_type utype) > { > int32_t rc; > uint32_t i, lc, n; > - uint32_t *sum; > + uint64_t *sum; > struct plock_test *pt; > struct lcore_plock_test *lpt; >=20 > @@ -199,7 +200,7 @@ struct lcore_plock_test { > lpt =3D calloc(n, sizeof(*lpt)); > sum =3D calloc(n + 1, sizeof(*sum)); >=20 > - printf("%s(iter=3D%u, utype=3D%u) started on %u lcores\n", > + printf("%s(iter=3D%lu, utype=3D%u) started on %u lcores\n", > __func__, iter, utype, n); >=20 > if (pt =3D=3D NULL || lpt =3D=3D NULL || sum =3D=3D NULL) { > @@ -247,7 +248,7 @@ struct lcore_plock_test { >=20 > rc =3D 0; > for (i =3D 0; i !=3D n; i++) { > - printf("%s: sum[%u]=3D%u, pt[%u].val=3D%u, pt[%u].iter=3D%u;\n", > + printf("%s: sum[%u]=3D%lu, pt[%u].val=3D%lu, pt[%u].iter=3D%lu;\n", Here and in other places, you need to use PRIu64 for 64 bit values. > __func__, i, sum[i], i, pt[i].val, i, pt[i].iter); >=20 > /* race condition occurred, lock doesn't work properly */ > -- > 1.8.3.1