From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F3D84A046B for ; Tue, 23 Jul 2019 08:13:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DB68F1BF8A; Tue, 23 Jul 2019 08:13:44 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id A8C7B1B9AA for ; Tue, 23 Jul 2019 08:13:43 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6N65jLr023011; Mon, 22 Jul 2019 23:13:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=NdQUS9oDxvr5ktYBIcCUDjdBvF0kSlfrChOfc/HQ6Ac=; b=a6etZzCpAkWOZ6EaW5E45NaS5hAbt4BY+zSucIA5ZcKeh9/tiooucWyqxyzGLVrCh3Vw vVKhsqcIohQgiCIFBft0eD3uBLIGNNesIhjGLUL5X1Dv7rNAn2X/fiYNFrSLhFpyX7F8 tfRjAen5p6bUQmFTsvUKX/+G4lOwo+XVnU647FWAdh2bPmJAjr2nDuEQzTSoHqadADxe 0dCw8x1BBJQLRT5A+r8BQwcC5df10slzPP7mEVkAXNb6/0xRyb/2QF1Rc94qlb3ggxlh 38U1pBzVxbEEZnrMoDDR7c9rxHLZTYeiVGf0iyGGOuENA+cE+dKGuwj/Rd/sRp+fBhD2 Sg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2tv2fj9m7b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 22 Jul 2019 23:13:42 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 22 Jul 2019 23:13:40 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.52) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 22 Jul 2019 23:13:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kRJ5JhFz28aE4sod182Nzqm3bMcwMI1cnO6/RGes+fZMfUTZlC6wWmEAOFPojsX6xmYvcLZtxSmooEyJeOPJ8gJJRHaNjliRkJIFr4bxuJ5P93WEIOpEx+5QT5iTsv8dWFzrIPZd6437MIv360KMBUHl7e6B3I0xTlo7i+jE7lMnfK/32+1GIsit6Ueug6maaWulyLyOkIeRwfoP8HgULE3yq7iwSE4QdnmRSC4rL2SO0njbk0t8omKdy0dv1CqaBACa6oVEiTUk1zSQJUlC52ZIX/S+f9gjZl5pWulibiayGztxrk0LEHzHFFlFC3ep8G2ZHResqq3chfugG/Uf5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NdQUS9oDxvr5ktYBIcCUDjdBvF0kSlfrChOfc/HQ6Ac=; b=je+fievTBUbptw4/67EEbnO3MqbRUG8FC6UdJqVzjOq4Ymfm9F1QJs6+soVQwLXjEMf2D1uNiNESoSFjMd7i8Zn0WPAYkcBBhh6m0qBvTwa0pppkyJah/b2Yl1cJTpq9WtS5IDzpjHtKUMy+627VP3cHhG5Vbs85BiMbGb1bFd34jND+YON3qWOdPz/NUeglVJ/nMXlYBsK0dbSEX8+X3Am+JfGOsBBtIDLWdK/xYKGiwLblFoWZe9HGylTHzqL4zbTGorMR/EKzn0dLy34TN3u7qXBZaL3KqzWPmJWMzKYFXXCHkCBR9TaeZFKxO+bIjp2dpNkRg/nvC+SFmhSdwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=marvell.com;dmarc=pass action=none header.from=marvell.com;dkim=pass header.d=marvell.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NdQUS9oDxvr5ktYBIcCUDjdBvF0kSlfrChOfc/HQ6Ac=; b=bB/iyFRKviMVvmqnNmJa2jUwXwYH3YOIYjBVWi76ctUkgqhYqRtI3s8uIXZeEu56Wmo62UL0nWVDpo/w1KusmoQvlxplyfW7Twxi5ziZmV2pzASg9RIE0p8z/crIaTKCiTrR1HPiWzf0ixv5/8WzQu4ILOMZEMNeXITLJTTYW3U= Received: from CH2PR18MB3381.namprd18.prod.outlook.com (52.132.246.204) by CH2PR18MB3173.namprd18.prod.outlook.com (52.132.247.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.17; Tue, 23 Jul 2019 06:13:35 +0000 Received: from CH2PR18MB3381.namprd18.prod.outlook.com ([fe80::189c:3889:b207:8922]) by CH2PR18MB3381.namprd18.prod.outlook.com ([fe80::189c:3889:b207:8922%5]) with mapi id 15.20.2073.012; Tue, 23 Jul 2019 06:13:35 +0000 From: Vamsi Krishna Attunuru To: "dev@dpdk.org" CC: "thomas@monjalon.net" , Jerin Jacob Kollanukkaran , "david.marchand@redhat.com" , "aconole@redhat.com" , Anatoly Burakov Thread-Topic: [PATCH v3 1/1] app/test: fix --socket-mem option in eal flag autotest Thread-Index: AQHVOH0d35WzgPLmJUe+zOzDhAjovabXyaYQ Date: Tue, 23 Jul 2019 06:13:35 +0000 Message-ID: References: <20190711051532.21054-1-vattunuru@marvell.com> <20190712064320.8106-1-vattunuru@marvell.com> In-Reply-To: <20190712064320.8106-1-vattunuru@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.140.231.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5979c069-7055-4c02-470d-08d70f34e527 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:CH2PR18MB3173; x-ms-traffictypediagnostic: CH2PR18MB3173: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:418; x-forefront-prvs: 0107098B6C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(366004)(39860400002)(376002)(396003)(346002)(199004)(189003)(13464003)(54906003)(14454004)(6916009)(2501003)(71190400001)(71200400001)(68736007)(6116002)(2351001)(316002)(33656002)(3846002)(7696005)(305945005)(74316002)(7736002)(99286004)(2906002)(8676002)(476003)(11346002)(446003)(66066001)(6506007)(81156014)(53546011)(55016002)(55236004)(486006)(76176011)(26005)(6436002)(5640700003)(76116006)(66946007)(66446008)(52536014)(25786009)(66476007)(66556008)(5660300002)(6246003)(9686003)(229853002)(53936002)(186003)(256004)(102836004)(478600001)(8936002)(14444005)(1730700003)(81166006)(4326008)(64756008)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:CH2PR18MB3173; H:CH2PR18MB3381.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 95LrDvhCdORy7P6vykNYzOJLcHu+UpQ/neWR5DJr7Q1s861M0YyWc+ZgCd6rjQhaymMTuSD6O0k+wwJKJ+9IyoQNgsZy0rE7IfBU2e7lNonakIV/QA9z6npUUyUJPgxy0cguxm1LcwIfGuP8d5x6L/quLSDfxz4Ji4CC9xfMlgvIeAcgOHhoABmXD/i5x6+FNxCAKz0agoviGJM3ByJExxLEDGe3TzttzC0GXc2znvLTAxl9O4AXAnKIpkTrqUYW8nTBuolOy28bS+PrPRMfHiKmHdXJBV1hWttjSTTdOBjQ6m8HCtXokY8h2aAGs2K7XzG3Fm2lcUBbHpcHqIsLeSWxQGv67EK5hLnu3a5HeiVhn7tou+RS8lBZFLZwyyqE2ic03zwnkhNz+7Ai5/IRSBO03Oy7m7Hsx+qw75VI1uI= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5979c069-7055-4c02-470d-08d70f34e527 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jul 2019 06:13:35.2087 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vattunuru@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR18MB3173 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-23_03:2019-07-23,2019-07-23 signatures=0 Subject: Re: [dpdk-dev] [PATCH v3 1/1] app/test: fix --socket-mem option in eal flag autotest 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" Ping V3 review request.. > -----Original Message----- > From: vattunuru@marvell.com > Sent: Friday, July 12, 2019 12:13 PM > To: dev@dpdk.org > Cc: thomas@monjalon.net; Jerin Jacob Kollanukkaran ; > david.marchand@redhat.com; aconole@redhat.com; Vamsi Krishna Attunuru > > Subject: [PATCH v3 1/1] app/test: fix --socket-mem option in eal flag aut= otest >=20 > From: Vamsi Attunuru >=20 > eal flag autotest fails when multiple mem size flags are passed to --sock= et-mem > option irrespective of RTE_MAX_NUMA_NODES. >=20 > Patch fixes --socket-mem option by setting enough numbers of numa node me= m > flags based on RTE_MAX_NUMA_NODES config. >=20 > Fixes: 45f1b6e8680a ("app: add new tests on eal flags") >=20 > Signed-off-by: Vamsi Attunuru > --- > V3 changes: > * Pass buffer size info to populate socket mem routine which strlcpy requ= ires. >=20 > V2 changes: > * Add routine to populate --socket-mem option and use it to form valid an= d > invalid test commands. >=20 > app/test/test_eal_flags.c | 121 +++++++++++++++++++++++++++-------------= ----- > - > 1 file changed, 71 insertions(+), 50 deletions(-) >=20 > diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index > 672ca0a..053d694 100644 > --- a/app/test/test_eal_flags.c > +++ b/app/test/test_eal_flags.c > @@ -1250,12 +1250,46 @@ test_file_prefix(void) > return 0; > } >=20 > +static void > +populate_socket_mem_param(int num_sockets, const char *mem, > + char *buf, size_t buf_size) > +{ > + char tmp[SOCKET_MEM_STRLEN]; > + int i; > + > + snprintf(buf, SOCKET_MEM_STRLEN, "--socket-mem=3D"); > + > + for (i =3D 0; i < num_sockets ; i++) { > + snprintf(tmp, sizeof(tmp), "%s%s", buf, mem); > + strlcpy(buf, tmp, buf_size); > + > + if (num_sockets + 1 - i > 1) { > + snprintf(tmp, sizeof(tmp), "%s,", buf); > + strlcpy(buf, tmp, buf_size); > + } > + } > +} > + > /* > * Tests for correct handling of -m and --socket-mem flags > */ > static int > test_memory_flags(void) > { > + char buf[SOCKET_MEM_STRLEN]; /* to avoid copying string onto itself > */ > + > +#ifdef RTE_EXEC_ENV_FREEBSD > + int num_sockets =3D 1; > +#else > + int num_sockets =3D RTE_MIN(get_number_of_sockets(), > + RTE_MAX_NUMA_NODES); > +#endif > + > + if (num_sockets <=3D 0) { > + printf("Error - cannot get number of sockets!\n"); > + return -1; > + } > + > #ifdef RTE_EXEC_ENV_FREEBSD > /* BSD target doesn't support prefixes at this point */ > const char * prefix =3D ""; > @@ -1277,85 +1311,72 @@ test_memory_flags(void) > "--file-prefix=3D" memtest, "-m", DEFAULT_MEM_SIZE}; >=20 > /* valid (zero) --socket-mem flag */ > + char arg2_socket_mem[SOCKET_MEM_STRLEN]; > + populate_socket_mem_param(num_sockets - 1, "0", buf, sizeof(buf)); > + snprintf(arg2_socket_mem, sizeof(arg2_socket_mem), "%s%s", buf, > "0"); > const char *argv2[] =3D {prgname, > - "--file-prefix=3D" memtest, "--socket-mem=3D0,0,0,0"}; > + "--file-prefix=3D" memtest, arg2_socket_mem}; >=20 > /* invalid (incomplete) --socket-mem flag */ > + char arg3_socket_mem[SOCKET_MEM_STRLEN]; > + populate_socket_mem_param(num_sockets - 1, "2", buf, sizeof(buf)); > + snprintf(arg3_socket_mem, sizeof(arg3_socket_mem), "%s%s", buf, > "2,"); > const char *argv3[] =3D {prgname, > - "--file-prefix=3D" memtest, "--socket-mem=3D2,2,"}; > + "--file-prefix=3D" memtest, arg3_socket_mem}; >=20 > /* invalid (mixed with invalid data) --socket-mem flag */ > + char arg4_socket_mem[SOCKET_MEM_STRLEN]; > + populate_socket_mem_param(num_sockets - 1, "2", buf, sizeof(buf)); > + snprintf(arg4_socket_mem, sizeof(arg4_socket_mem), "%s%s", buf, > +"Fred"); > const char *argv4[] =3D {prgname, > - "--file-prefix=3D" memtest, "--socket-mem=3D2,2,Fred"}; > + "--file-prefix=3D" memtest, arg4_socket_mem}; >=20 > /* invalid (with numeric value as last character) --socket-mem flag */ > + char arg5_socket_mem[SOCKET_MEM_STRLEN]; > + populate_socket_mem_param(num_sockets - 1, "2", buf, sizeof(buf)); > + snprintf(arg5_socket_mem, sizeof(arg5_socket_mem), > + "%s%s", buf, "Fred0"); > const char *argv5[] =3D {prgname, > - "--file-prefix=3D" memtest, "--socket-mem=3D2,2,Fred0"}; > + "--file-prefix=3D" memtest, arg5_socket_mem}; >=20 > /* invalid (with empty socket) --socket-mem flag */ > + char arg6_socket_mem[SOCKET_MEM_STRLEN]; > + populate_socket_mem_param(num_sockets - 1, "2", buf, sizeof(buf)); > + snprintf(arg6_socket_mem, sizeof(arg6_socket_mem), "%s%s", buf, > ",,"); > const char *argv6[] =3D {prgname, > - "--file-prefix=3D" memtest, "--socket-mem=3D2,,2"}; > + "--file-prefix=3D" memtest, arg6_socket_mem}; >=20 > /* invalid (null) --socket-mem flag */ > const char *argv7[] =3D {prgname, > "--file-prefix=3D" memtest, "--socket-mem=3D"}; >=20 > /* valid --socket-mem specified together with -m flag */ > + char arg8_socket_mem[SOCKET_MEM_STRLEN]; > + populate_socket_mem_param(num_sockets - 1, "2", buf, sizeof(buf)); > + snprintf(arg8_socket_mem, sizeof(arg8_socket_mem), "%s%s", buf, > "2"); > const char *argv8[] =3D {prgname, > - "--file-prefix=3D" memtest, "-m", DEFAULT_MEM_SIZE, "- > -socket-mem=3D2,2"}; > + "--file-prefix=3D" memtest, "-m", > + DEFAULT_MEM_SIZE, arg8_socket_mem}; >=20 > /* construct an invalid socket mask with 2 megs on each socket plus > * extra 2 megs on socket that doesn't exist on current system */ > char invalid_socket_mem[SOCKET_MEM_STRLEN]; > - char buf[SOCKET_MEM_STRLEN]; /* to avoid copying string onto > itself */ > - > -#ifdef RTE_EXEC_ENV_FREEBSD > - int i, num_sockets =3D 1; > -#else > - int i, num_sockets =3D RTE_MIN(get_number_of_sockets(), > - RTE_MAX_NUMA_NODES); > -#endif > - > - if (num_sockets <=3D 0) { > - printf("Error - cannot get number of sockets!\n"); > - return -1; > - } > - > - snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "--socket- > mem=3D"); > - > - /* add one extra socket */ > - for (i =3D 0; i < num_sockets + 1; i++) { > - snprintf(buf, sizeof(buf), "%s%s", invalid_socket_mem, > DEFAULT_MEM_SIZE); > - strlcpy(invalid_socket_mem, buf, sizeof(invalid_socket_mem)); > - > - if (num_sockets + 1 - i > 1) { > - snprintf(buf, sizeof(buf), "%s,", invalid_socket_mem); > - strlcpy(invalid_socket_mem, buf, > - sizeof(invalid_socket_mem)); > - } > - } > - > - /* construct a valid socket mask with 2 megs on each existing socket */ > - char valid_socket_mem[SOCKET_MEM_STRLEN]; > - > - snprintf(valid_socket_mem, sizeof(valid_socket_mem), "--socket- > mem=3D"); > - > - /* add one extra socket */ > - for (i =3D 0; i < num_sockets; i++) { > - snprintf(buf, sizeof(buf), "%s%s", valid_socket_mem, > DEFAULT_MEM_SIZE); > - strlcpy(valid_socket_mem, buf, sizeof(valid_socket_mem)); > - > - if (num_sockets - i > 1) { > - snprintf(buf, sizeof(buf), "%s,", valid_socket_mem); > - strlcpy(valid_socket_mem, buf, > - sizeof(valid_socket_mem)); > - } > - } > + populate_socket_mem_param(num_sockets, DEFAULT_MEM_SIZE, > + buf, sizeof(buf)); > + snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), > + "%s%s", buf, DEFAULT_MEM_SIZE); >=20 > /* invalid --socket-mem flag (with extra socket) */ > const char *argv9[] =3D {prgname, > "--file-prefix=3D" memtest, invalid_socket_mem}; >=20 > + /* construct a valid socket mask with 2 megs on each existing socket */ > + char valid_socket_mem[SOCKET_MEM_STRLEN]; > + populate_socket_mem_param(num_sockets - 1, DEFAULT_MEM_SIZE, > + buf, sizeof(buf)); > + snprintf(valid_socket_mem, sizeof(valid_socket_mem), > + "%s%s", buf, DEFAULT_MEM_SIZE); > + > /* valid --socket-mem flag */ > const char *argv10[] =3D {prgname, > "--file-prefix=3D" memtest, valid_socket_mem}; > -- > 2.8.4