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 3368CA0548; Tue, 17 Aug 2021 22:05:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D61340DF5; Tue, 17 Aug 2021 22:05:25 +0200 (CEST) Received: from mx0a-002c1b01.pphosted.com (mx0a-002c1b01.pphosted.com [148.163.151.68]) by mails.dpdk.org (Postfix) with ESMTP id 663C34014E for ; Tue, 17 Aug 2021 22:05:23 +0200 (CEST) Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 17HGWHmA009291; Tue, 17 Aug 2021 13:05:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=proofpoint20171006; bh=B6UO+SScNlycp8Y+csji3/v+Mpq8Uz4VA31wpD90sYc=; b=MMbEnWR0LAbzuZSS2gZVydiociTEZAWt3XlndgXCrr253IzbtnvYnQVQhKLEpzF3WR2I TsXe2yUYqFtvg7oF1ENbyatMkPQdL06XYGAADhDjxTNM9WQj1pFrIPIwtp/+sraj/BNJ kunR9jJKzNRnnZordjjMu02YOIxzynCAsHCIQAU9sVeo19Ig3wjPx/JKW6awOmcvpyJr VIhQVft3pWHDBoh4fryLP8mezFAiWqJOIvmuFhMbXsrSx8Y067LjJcj9LoYVy3mwSvAz jFbuymdWDgcUwuf2unLC106884kTRIGrVCGUZjqWXZWJZmhiTQG/umltzWSGkHCJYtZE xg== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2045.outbound.protection.outlook.com [104.47.57.45]) by mx0a-002c1b01.pphosted.com with ESMTP id 3aggqd0ewj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Aug 2021 13:05:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NvT4mfzWqoP4ccklsoozGqjJPCUsaCSoI5xlJSQqXRBuDzFr8SugZjGO/K83yQgrIuCnsC4i6yBT62lvnhw5C5wpf8tqjYlolfH2gHIK9t3SLpKa2i9DMdVFB1NvffWLSBcuQbwzTfNFQfz8U49XtfhLrdoWmB4nmW8MxH0XQtiwv4rcEpNnz/Un1345A9xyZQllqRZtybdKgrJ6qLbvdT8LvGr2scUoUqEeGdaCxUCCdRobQ9MpWj2y9fxWWYXZxFgEUZkxmrYqxcgEhYaLO4yK0ByV7PiXEPHXRtn4ChxoeKk6JB4CoLJdsH9MiHTKPMzElipFoXNzRRiAF0jfAQ== 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=B6UO+SScNlycp8Y+csji3/v+Mpq8Uz4VA31wpD90sYc=; b=KvqN4zs1MkRmO3PauqN2z3tumPUemIYR3848cZeCb+05h9AEaFgF1LPKAgvEpeUKjuMZanuVa2Q651UA+85BE+EXnOnS49TBDWoC//dfJ5Mquqzpv9uI1j2oUBAiNSWKX6fpKoF5W1COKf7NPiiw4FLLVVTwciEd46B5Ytg0arq9fQgxJeqnR4lK5NtWyNbn2IWbyGWbpopnr+B3lbFEDmSD9zwmy3nLpBaOWRHci/DJJI0sf6jSbvignAPPY4uAjqoyiT+jngG9F07DgT/KMYKmt/GW/UX9HvaprowVCE92FtT61Qi39uCBOf+tK9/aSkLbGN5FylVvO0So4kiwqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none Received: from BL0PR02MB4580.namprd02.prod.outlook.com (2603:10b6:208:40::27) by BL0PR02MB4273.namprd02.prod.outlook.com (2603:10b6:208:41::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.22; Tue, 17 Aug 2021 20:05:20 +0000 Received: from BL0PR02MB4580.namprd02.prod.outlook.com ([fe80::1866:bff0:809:75bf]) by BL0PR02MB4580.namprd02.prod.outlook.com ([fe80::1866:bff0:809:75bf%7]) with mapi id 15.20.4415.024; Tue, 17 Aug 2021 20:05:20 +0000 From: John Levon To: "dev@dpdk.org" CC: "anatoly.burakov@intel.com" , "dmitry.kozliuk@gmail.com" , "thomas@monjalon.net" , "david.marchand@redhat.com" Thread-Topic: [PATCH] eal: allow hugetlbfs sub-directories Thread-Index: AQHXjRExAKNS6c62MUyyMrPcxWCmVat4LEEA Date: Tue, 17 Aug 2021 20:05:19 +0000 Message-ID: References: <1705686.Ar61aiJpx4@thomas> <20210809112434.383123-1-john.levon@nutanix.com> In-Reply-To: <20210809112434.383123-1-john.levon@nutanix.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nutanix.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7d098852-36f3-475a-b526-08d961ba5706 x-ms-traffictypediagnostic: BL0PR02MB4273: x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: B2u+iYUB/lQOPgXCHq6wNUTmFDvFeZh2zVyZbfVPtpFgaZ6LAaDOngQpOyxSKX5MTi3WxP/Mey/fbLuqmRMEwcSgrixFElwoC5CePXArAaIw7tR89XkMjs2WF2TJ/FOnhP3fXqhA4G7sr0bOzwWEl7jv8l/0Prx8qw1p9sNeZtNpvNxFzOhUn568BreHLmQA79MIIu9g5h1rszyHIOVpvVVc/EdvyMcncVsCGqLL+kcIu+FtGTXI0+8Hyliiza/NIMQHrkVyVcAZchBcwXuypDjc+fQUDbFNgXYFAl9lJsQxspk8DcStVX77IrqS43aOypaTV6BZOUxSXi9pnqAZfPZO8ocKc8kEnYDBpyVbcFfrUJ9CnfVmcMLhjfjdFaf0VKnMLOTkXagIRkJCEMEdDv6dl3sTMFa6ioD7G9QTyVUTlGCyVPOMUix7sCvjKtHcOICronMlPK+OAv2MgZlioEk7jFzTXlg4wGofdnzqHQxe43Q8T8Re5NMAPC+FnYB1yBaKIq9aFRod2EUW1iuyCDYgyeo+6gDSs+41ZUl2IxTmzDwJ91BUDM/plVjK2LbgIRWHU4eC+vUAUK3G3Zau5crdJImQwS7BbTluH1bGdvACSwiY27tKMdSsYrD9pdYRe6f/uOAQQJhHuP1LN4CGhc/I/jH6+S/khelZF+Xd9JE42qv8muTCxlLepNQFhl1JT7zRyCVV+aPTXUa+6K4FFHd4g9qcrUoqT0sA6GtbBvQ= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR02MB4580.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(39860400002)(136003)(376002)(346002)(396003)(6486002)(5660300002)(86362001)(54906003)(36756003)(316002)(2906002)(8676002)(71200400001)(6916009)(186003)(8936002)(83380400001)(30864003)(122000001)(66476007)(64756008)(478600001)(66556008)(38100700002)(4326008)(66446008)(26005)(6512007)(9686003)(76116006)(66946007)(91956017)(44832011)(38070700005)(6506007)(67856001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2BAAPapdyBzKUFcOwuofOxHqks2asLT5ZM2vqJ1FmhMBl2cyIKSm4EIdShqr?= =?us-ascii?Q?J+nT5L9QZ2Yb5rJmj9/qJnCdQp18ZXX54uojy4XOm/fO0NQ+6Gj2vJ7r0ts8?= =?us-ascii?Q?dvnaZWsdYnV+bODrtLYix4ch3jNOaza42ptyaXjpB+Uf496eFkDfWSYa9flu?= =?us-ascii?Q?ro0hS8oauoAXbaLfjYbwqQq8kxecgeZkQCy4vydufO3egVAc4YpQaPxo3Rg6?= =?us-ascii?Q?+9PXFpC43KQp+xbrpu28LXFQvA2idV9FraXdtvzJ20vclqxg8wxFpJn6cz0t?= =?us-ascii?Q?/nlY6dILDsrJMpR0qIJMetx8AQYL0DaPEoO/O0nYbIoZeHwzfWRMBWxWPbR2?= =?us-ascii?Q?Eqo2MjyXe6PLWpGOzmQ4ilKJZk9wl4PFVfwbv1nxVxp20MI3qyAy0rOq6csY?= =?us-ascii?Q?JrxsFhrPaNMptNPnVdM4Ncx524PDjU4NdVYSOWqaW2gXu5bloHnvYw74GJjz?= =?us-ascii?Q?8jAiALQCampIuvNoUOXOtCpBASAsIV+mpx31Gl1StT9L75fAY5TcvpO5Kzfq?= =?us-ascii?Q?z6RCXeDZemKTRP0QU1wkXUGbdjay3UTk027bn5xLuiT/PY+v51PmISwpY3D1?= =?us-ascii?Q?LvIdYxbfgHVULB97sWYXCLpsrKlLP1Jc6gy+utRJhRiF7QGbcnXgj5sxG5Md?= =?us-ascii?Q?zJ8OIY1ZsQJdBWKPK7KJ9kEm3m6px5J37H9rs4dA+URI/G6J1PbhDtuzqRTA?= =?us-ascii?Q?eyjuufsQzxazcEP9JZIgj8KEgAWvfYLfHOcjYcfauMxdO5L4C7jwxCNa9TX+?= =?us-ascii?Q?Gkl7LtsLoF/R/5V2zj/naFTGHNqWRbltS8dzpfPIaTwLSy52Sv+DutQp53c4?= =?us-ascii?Q?zhgx9pnaV5n2rHpHZRH3uKgxKtp+D1izi36+Zc3dPX8ai2nGPf1kWPuI7L2u?= =?us-ascii?Q?nbW1p1tuhzgj1U5VHP1H5Tn8ILv0CDabJEZqVhxZHMUBj1CHqrwlcLasqJ8V?= =?us-ascii?Q?le4e1ojmDNBPggJWYxrtvwKk2GZ94QlJuQRefldJxiUJSuVEfoZJ0k42rq6k?= =?us-ascii?Q?rpm0tp+YZHo8xkyfbXsgVh7yfUal7y3r+zhCCz6imhhJp3p3w8fG/ICVVAqU?= =?us-ascii?Q?ef6bQ4YjWq9xDYM97cDj6uLkru7Awi7pAIx4zBcB9HIL56a0ozMSKE6UkhWa?= =?us-ascii?Q?4PlaImrLJKU/gJDn5M6AyfLCQDED9l9cGRIgvLJ1xvdchg0C19r2kniTEyer?= =?us-ascii?Q?Am6KAXh7u18erhhSXD6HT4YaFWzU5kUaOm1B4Go4+8a2zNk2/24ehgNKIpwx?= =?us-ascii?Q?NrNZ+Bt8UY+UvJszG+DzKeGKwcg2wrRuMSw8Ijb1/fi2K5sGWFqWxPnR7Ee9?= =?us-ascii?Q?t8OHdDZ7JXok47HMzUtNHbxX?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-ID: <589DA7E7BD747D468B51A2C2743169EF@namprd02.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL0PR02MB4580.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d098852-36f3-475a-b526-08d961ba5706 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2021 20:05:19.9965 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: FW1xXZ0sWoVGDwI1fRUlVqb12o58EvsjYgITtyXjez4mr/TD5DMot0B9aPcg6BhGIjmq9oj+OdAKvYLZ8IAAiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4273 X-Proofpoint-GUID: 5xOsirXacnDao-8p21FFP8IFNWMfuYrI X-Proofpoint-ORIG-GUID: 5xOsirXacnDao-8p21FFP8IFNWMfuYrI 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-08-17_06,2021-08-17_02,2020-04-07_01 X-Proofpoint-Spam-Reason: safe Subject: Re: [dpdk-dev] [PATCH] eal: allow hugetlbfs sub-directories 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 Mon, Aug 09, 2021 at 12:24:34PM +0100, John Levon wrote: > get_hugepage_dir() was implemented in such a way that a --huge-dir > option had to exactly match the mountpoint, but there's no reason for > this restriction: DPDK might not be the only user of hugepages, and > shouldn't assume it owns an entire mountpoint. For example, if I have > /dev/hugepages/myapp, and /dev/hugepages/dpdk, I should be able to > specify: >=20 > --huge-dir=3D/dev/hugepages/dpdk/ >=20 > and have DPDK only use that sub-directory. >=20 > Fix the implementation to allow a sub-directory within a suitable > hugetlbfs mountpoint to be specified, preferring the closest match. >=20 > Signed-off-by: John Levon > --- > v2: prefer closer matches > v3: checkpatch fixes > v4: fix docs, added tests Anyone like to (re) review? thanks john >=20 > app/test/test_eal_flags.c | 116 ++++++++++++------ > doc/guides/linux_gsg/linux_eal_parameters.rst | 3 +- > lib/eal/linux/eal_hugepage_info.c | 83 +++++++++---- > 3 files changed, 138 insertions(+), 64 deletions(-) >=20 > diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c > index b4880ee802..1d18a0ba8f 100644 > --- a/app/test/test_eal_flags.c > +++ b/app/test/test_eal_flags.c > @@ -14,8 +14,9 @@ > #include > #include > #include > -#include > #include > +#include > +#include > #include > #include > =20 > @@ -800,6 +801,9 @@ static int > test_misc_flags(void) > { > char hugepath[PATH_MAX] =3D {0}; > + char hugepath_dir[PATH_MAX] =3D {0}; > + char hugepath_dir2[PATH_MAX] =3D {0}; > + char hugepath_dir3[PATH_MAX] =3D {0}; > #ifdef RTE_EXEC_ENV_FREEBSD > /* BSD target doesn't support prefixes at this point */ > const char * prefix =3D ""; > @@ -810,6 +814,7 @@ test_misc_flags(void) > FILE * hugedir_handle =3D NULL; > char line[PATH_MAX] =3D {0}; > unsigned i, isempty =3D 1; > + > if (get_current_prefix(tmp, sizeof(tmp)) =3D=3D NULL) { > printf("Error - unable to get current prefix!\n"); > return -1; > @@ -849,6 +854,20 @@ test_misc_flags(void) > } > #endif > =20 > + snprintf(hugepath_dir, sizeof(hugepath_dir), "%s/dpdk.missing", hugepat= h); > + snprintf(hugepath_dir2, sizeof(hugepath_dir2), "%s/dpdk.dir", hugepath)= ; > + > + if (mkdir(hugepath_dir2, 0700) !=3D 0 && errno !=3D EEXIST) { > + printf("Error - failed to mkdir(%s)\n", hugepath_dir2); > + return -1; > + } > + > + snprintf(hugepath_dir3, sizeof(hugepath_dir3), "%s/dpdk.dir/sub", hugep= ath); > + > + if (mkdir(hugepath_dir3, 0700) !=3D 0 && errno !=3D EEXIST) { > + printf("Error - failed to mkdir(%s)\n", hugepath_dir3); > + goto fail; > + } > =20 > /* check that some general flags don't prevent things from working. > * All cases, apart from the first, app should run. > @@ -881,60 +900,66 @@ test_misc_flags(void) > /* With invalid --huge-dir */ > const char *argv9[] =3D {prgname, "-m", DEFAULT_MEM_SIZE, > "--file-prefix=3Dhugedir", "--huge-dir", "invalid"}; > + /* With invalid --huge-dir sub-directory */ > + const char *argv10[] =3D {prgname, "-m", DEFAULT_MEM_SIZE, > + "--file-prefix=3Dhugedir", "--huge-dir", hugepath_dir}; > + /* With valid --huge-dir sub-directory */ > + const char *argv11[] =3D {prgname, "-m", DEFAULT_MEM_SIZE, > + "--file-prefix=3Dhugedir", "--huge-dir", hugepath_dir2}; > /* Secondary process with invalid --huge-dir (should run as flag has no > * effect on secondary processes) */ > - const char *argv10[] =3D {prgname, prefix, mp_flag, > + const char *argv12[] =3D {prgname, prefix, mp_flag, > "--huge-dir", "invalid"}; > =20 > /* try running with base-virtaddr param */ > - const char *argv11[] =3D {prgname, "--file-prefix=3Dvirtaddr", > + const char *argv13[] =3D {prgname, "--file-prefix=3Dvirtaddr", > "--base-virtaddr=3D0x12345678"}; > =20 > /* try running with --vfio-intr INTx flag */ > - const char *argv12[] =3D {prgname, "--file-prefix=3Dintr", > + const char *argv14[] =3D {prgname, "--file-prefix=3Dintr", > "--vfio-intr=3Dlegacy"}; > =20 > /* try running with --vfio-intr MSI flag */ > - const char *argv13[] =3D {prgname, "--file-prefix=3Dintr", > + const char *argv15[] =3D {prgname, "--file-prefix=3Dintr", > "--vfio-intr=3Dmsi"}; > =20 > /* try running with --vfio-intr MSI-X flag */ > - const char *argv14[] =3D {prgname, "--file-prefix=3Dintr", > + const char *argv16[] =3D {prgname, "--file-prefix=3Dintr", > "--vfio-intr=3Dmsix"}; > =20 > /* try running with --vfio-intr invalid flag */ > - const char *argv15[] =3D {prgname, "--file-prefix=3Dintr", > + const char *argv17[] =3D {prgname, "--file-prefix=3Dintr", > "--vfio-intr=3Dinvalid"}; > =20 > /* With process type as auto-detect */ > - const char * const argv16[] =3D {prgname, "--file-prefix=3Dauto", > + const char * const argv18[] =3D {prgname, "--file-prefix=3Dauto", > "--proc-type=3Dauto"}; > =20 > /* With process type as auto-detect with no-shconf */ > - const char * const argv17[] =3D {prgname, "--proc-type=3Dauto", > + const char * const argv19[] =3D {prgname, "--proc-type=3Dauto", > no_shconf, nosh_prefix, no_huge}; > =20 > /* With process type as --create-uio-dev flag */ > - const char * const argv18[] =3D {prgname, "--file-prefix=3Duiodev", > + const char * const argv20[] =3D {prgname, "--file-prefix=3Duiodev", > "--create-uio-dev"}; > =20 > /* run all tests also applicable to FreeBSD first */ > =20 > if (launch_proc(argv0) =3D=3D 0) { > printf("Error - process ran ok with invalid flag\n"); > - return -1; > + goto fail; > } > if (launch_proc(argv1) !=3D 0) { > printf("Error - process did not run ok with --no-pci flag\n"); > - return -1; > + goto fail; > } > if (launch_proc(argv2) !=3D 0) { > printf("Error - process did not run ok with -v flag\n"); > - return -1; > + goto fail; > } > if (launch_proc(argv6) !=3D 0) { > printf("Error - process did not run ok with --no-shconf flag\n"); > - return -1; > + goto fail; > } > =20 > #ifdef RTE_EXEC_ENV_FREEBSD > @@ -944,73 +969,88 @@ test_misc_flags(void) > =20 > if (launch_proc(argv3) !=3D 0) { > printf("Error - process did not run ok with --syslog flag\n"); > - return -1; > + goto fail; > } > if (launch_proc(argv4) =3D=3D 0) { > printf("Error - process run ok with empty --syslog flag\n"); > - return -1; > + goto fail; > } > if (launch_proc(argv5) =3D=3D 0) { > printf("Error - process run ok with invalid --syslog flag\n"); > - return -1; > + goto fail; > } > if (launch_proc(argv7) !=3D 0) { > printf("Error - process did not run ok with --huge-dir flag\n"); > - return -1; > + goto fail; > } > if (launch_proc(argv8) =3D=3D 0) { > printf("Error - process run ok with empty --huge-dir flag\n"); > - return -1; > + goto fail; > } > if (launch_proc(argv9) =3D=3D 0) { > printf("Error - process run ok with invalid --huge-dir flag\n"); > - return -1; > + goto fail; > } > - if (launch_proc(argv10) !=3D 0) { > - printf("Error - secondary process did not run ok with invalid --huge-d= ir flag\n"); > - return -1; > + if (launch_proc(argv10) =3D=3D 0) { > + printf("Error - process run ok with invalid --huge-dir sub-dir flag\n"= ); > + goto fail; > } > if (launch_proc(argv11) !=3D 0) { > - printf("Error - process did not run ok with --base-virtaddr parameter\= n"); > - return -1; > + printf("Error - process did not run ok with --huge-dir subdir flag\n")= ; > + goto fail; > } > if (launch_proc(argv12) !=3D 0) { > + printf("Error - secondary process did not run ok with invalid --huge-d= ir flag\n"); > + goto fail; > + } > + if (launch_proc(argv13) !=3D 0) { > + printf("Error - process did not run ok with --base-virtaddr parameter\= n"); > + goto fail; > + } > + if (launch_proc(argv14) !=3D 0) { > printf("Error - process did not run ok with " > "--vfio-intr INTx parameter\n"); > - return -1; > + goto fail; > } > - if (launch_proc(argv13) !=3D 0) { > + if (launch_proc(argv15) !=3D 0) { > printf("Error - process did not run ok with " > "--vfio-intr MSI parameter\n"); > - return -1; > + goto fail; > } > - if (launch_proc(argv14) !=3D 0) { > + if (launch_proc(argv16) !=3D 0) { > printf("Error - process did not run ok with " > "--vfio-intr MSI-X parameter\n"); > - return -1; > + goto fail; > } > - if (launch_proc(argv15) =3D=3D 0) { > + if (launch_proc(argv17) =3D=3D 0) { > printf("Error - process run ok with " > "--vfio-intr invalid parameter\n"); > - return -1; > + goto fail; > } > - if (launch_proc(argv16) !=3D 0) { > + if (launch_proc(argv18) !=3D 0) { > printf("Error - process did not run ok with " > "--proc-type as auto parameter\n"); > - return -1; > + goto fail; > } > - if (launch_proc(argv17) !=3D 0) { > + if (launch_proc(argv19) !=3D 0) { > printf("Error - process did not run ok with " > "--proc-type and --no-shconf parameter\n"); > - return -1; > + goto fail; > } > - if (launch_proc(argv18) !=3D 0) { > + if (launch_proc(argv20) !=3D 0) { > printf("Error - process did not run ok with " > "--create-uio-dev parameter\n"); > - return -1; > + goto fail; > } > =20 > + rmdir(hugepath_dir3); > + rmdir(hugepath_dir2); > return 0; > + > +fail: > + rmdir(hugepath_dir3); > + rmdir(hugepath_dir2); > + return -1; > } > =20 > static int > diff --git a/doc/guides/linux_gsg/linux_eal_parameters.rst b/doc/guides/l= inux_gsg/linux_eal_parameters.rst > index bd3977cb3d..74df2611b5 100644 > --- a/doc/guides/linux_gsg/linux_eal_parameters.rst > +++ b/doc/guides/linux_gsg/linux_eal_parameters.rst > @@ -81,7 +81,8 @@ Memory-related options > =20 > * ``--huge-dir `` > =20 > - Use specified hugetlbfs directory instead of autodetected ones. > + Use specified hugetlbfs directory instead of autodetected ones. This= can be > + a sub-directory within a hugetlbfs mountpoint. > =20 > * ``--huge-unlink`` > =20 > diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepa= ge_info.c > index d97792cade..9fb0e968db 100644 > --- a/lib/eal/linux/eal_hugepage_info.c > +++ b/lib/eal/linux/eal_hugepage_info.c > @@ -213,10 +213,19 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedi= r, int len) > const size_t pagesize_opt_len =3D sizeof(pagesize_opt) - 1; > const char split_tok =3D ' '; > char *splitstr[_FIELDNAME_MAX]; > + char found[PATH_MAX] =3D ""; > char buf[BUFSIZ]; > - int retval =3D -1; > const struct internal_config *internal_conf =3D > eal_get_internal_configuration(); > + struct stat st; > + > + /* > + * If the specified dir doesn't exist, we can't match it. > + */ > + if (internal_conf->hugepage_dir !=3D NULL && > + stat(internal_conf->hugepage_dir, &st) !=3D 0) { > + return -1; > + } > =20 > FILE *fd =3D fopen(proc_mounts, "r"); > if (fd =3D=3D NULL) > @@ -226,42 +235,66 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedi= r, int len) > default_size =3D get_default_hp_size(); > =20 > while (fgets(buf, sizeof(buf), fd)){ > + const char *pagesz_str; > + > if (rte_strsplit(buf, sizeof(buf), splitstr, _FIELDNAME_MAX, > split_tok) !=3D _FIELDNAME_MAX) { > RTE_LOG(ERR, EAL, "Error parsing %s\n", proc_mounts); > break; /* return NULL */ > } > =20 > - /* we have a specified --huge-dir option, only examine that dir */ > - if (internal_conf->hugepage_dir !=3D NULL && > - strcmp(splitstr[MOUNTPT], internal_conf->hugepage_dir) !=3D 0) > + if (strncmp(splitstr[FSTYPE], hugetlbfs_str, htlbfs_str_len) !=3D 0) > continue; > =20 > - if (strncmp(splitstr[FSTYPE], hugetlbfs_str, htlbfs_str_len) =3D=3D 0)= { > - const char *pagesz_str =3D strstr(splitstr[OPTIONS], pagesize_opt); > + pagesz_str =3D strstr(splitstr[OPTIONS], pagesize_opt); > =20 > - /* if no explicit page size, the default page size is compared */ > - if (pagesz_str =3D=3D NULL){ > - if (hugepage_sz =3D=3D default_size){ > - strlcpy(hugedir, splitstr[MOUNTPT], len); > - retval =3D 0; > - break; > - } > - } > - /* there is an explicit page size, so check it */ > - else { > - uint64_t pagesz =3D rte_str_to_size(&pagesz_str[pagesize_opt_len]); > - if (pagesz =3D=3D hugepage_sz) { > - strlcpy(hugedir, splitstr[MOUNTPT], len); > - retval =3D 0; > - break; > - } > - } > - } /* end if strncmp hugetlbfs */ > + /* if no explicit page size, the default page size is compared */ > + if (pagesz_str =3D=3D NULL) { > + if (hugepage_sz !=3D default_size) > + continue; > + } > + /* there is an explicit page size, so check it */ > + else { > + uint64_t pagesz =3D rte_str_to_size(&pagesz_str[pagesize_opt_len]); > + if (pagesz !=3D hugepage_sz) > + continue; > + } > + > + /* > + * If no --huge-dir option has been given, we're done. > + */ > + if (internal_conf->hugepage_dir =3D=3D NULL) { > + strlcpy(found, splitstr[MOUNTPT], len); > + break; > + } > + > + /* > + * Ignore any mount that doesn't contain the --huge-dir > + * directory. > + */ > + if (strncmp(internal_conf->hugepage_dir, splitstr[MOUNTPT], > + strlen(splitstr[MOUNTPT])) !=3D 0) { > + continue; > + } > + > + /* > + * We found a match, but only prefer it if it's a longer match > + * (so /mnt/1 is preferred over /mnt for matching /mnt/1/2)). > + */ > + if (strlen(splitstr[MOUNTPT]) > strlen(found)) > + strlcpy(found, splitstr[MOUNTPT], len); > } /* end while fgets */ > =20 > fclose(fd); > - return retval; > + > + if (found[0] !=3D '\0') { > + /* If needed, return the requested dir, not the mount point. */ > + strlcpy(hugedir, internal_conf->hugepage_dir !=3D NULL ? > + internal_conf->hugepage_dir : found, len); > + return 0; > + } > + > + return -1; > } > =20 > /*=