From patchwork Fri Jun 17 11:25:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 113000 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D298A0093; Fri, 17 Jun 2022 13:25:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 68FAE41148; Fri, 17 Jun 2022 13:25:22 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2049.outbound.protection.outlook.com [40.107.237.49]) by mails.dpdk.org (Postfix) with ESMTP id CF1CD40698 for ; Fri, 17 Jun 2022 13:25:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mU9lSQDYJHLjRm5ZYvrQ7f6CVBAM5f4PFmCgoMfYdRInHyUai09C7FUfTPf9Udi/XyTRl8bNp98vE5XLbUZqZqqT869ju5HH7dvoDOiA/YJTBEA9tw1FECknFoc897q0+og44zwPGXPSKs6eO3FWSubL/6Jcwjj9VFYvtA0kK5OUBYha2O0d0nL67VII2Rbrfa/oH7wMaFZ9apkcRQwwsPgZ4bpA1LMPQfTqArAeimAhEhP1WXBsxu20xtWpz11k7/2BiSiVWahQ0xJarm6LPp4yn9RvqbZRI6cLyKvIEQZHbkf0BVMtezC2NnZN2XDGdMrzvm2FT7CQyh/9oCirCQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4IxijkFbpYwZI+RXV+VFoqmnoirHivSYuA4FBc641Z4=; b=KJBp5XY8ZjzT2PBeSa+FE5hSwuDoovIfC1KcVEENRtByMce6XpOvHic+thT5CVqUNSuG5TFiOHOeJsG0jSLgrtPfDmpaDk2PBChAI121vk0zFD96VEDxlIp74rniKOz7lewPdu3mJ+NMrqidGzbu6onCmWICZyREVrx4tyGnTB38UksztNMXcBwRSnBkmviCvoCVjS5uzfCWkhJzYLH5NZqLMNUe5KiMZfmeoaauYqKBvCxpZ8m9juTmF6TgGEuis84D10Pl1nb5yp3QMadzY9hjWdScykD6cUsA2xltqK5UySy5gGXnGYdxym14HgvduC68ifpdOQVVmKlPbPJMvw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4IxijkFbpYwZI+RXV+VFoqmnoirHivSYuA4FBc641Z4=; b=SJIT7OLlVAoU6Cqb5LU0T82oevHibnWIoM8j6ysJ4QOOa/FXkZVaf5qk/uIyrBYvp2Vbvq+AuMZ7s1rwtdOMa/BkJdo6DvZxXIcND+3iX5TaJrzADdGbn83IOXiGUduTaROkuPUhdWqJcgSXHVdN4yQRFT9U6mW6CCtW+4PhXU1gkZuQatx4zR87zp5xdv3e8PZ8pZLBmr9Iug2NZrfSj7go2qdDIqcTFu+hHdjSM7oPDak1n7YkYJu9uxH1WiLmNcumgR8+m3exI8yZvWznuiS/+4jTV4w7neHVZDJycP0/SIPXVk6r3avJzH4BQfZPsJHUuTAx9S8oWxHSeFA4uQ== Received: from BN0PR08CA0026.namprd08.prod.outlook.com (2603:10b6:408:142::28) by MN2PR12MB2909.namprd12.prod.outlook.com (2603:10b6:208:103::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.16; Fri, 17 Jun 2022 11:25:18 +0000 Received: from BN8NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:408:142:cafe::4b) by BN0PR08CA0026.outlook.office365.com (2603:10b6:408:142::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14 via Frontend Transport; Fri, 17 Jun 2022 11:25:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT047.mail.protection.outlook.com (10.13.177.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Fri, 17 Jun 2022 11:25:17 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 17 Jun 2022 11:25:15 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 17 Jun 2022 04:25:15 -0700 Received: from nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Fri, 17 Jun 2022 04:25:14 -0700 From: Dmitry Kozlyuk To: Subject: [PATCH v2 1/4] usertools: add option to select hugetlbfs directory Date: Fri, 17 Jun 2022 14:25:05 +0300 Message-ID: <20220617112508.3823291-2-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220617112508.3823291-1-dkozlyuk@nvidia.com> References: <20220607234949.2311884-1-dkozlyuk@nvidia.com> <20220617112508.3823291-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bef2cfe9-9742-4152-a744-08da50540e98 X-MS-TrafficTypeDiagnostic: MN2PR12MB2909:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sGNUVHqYrKUs4rQtc6IB+S37R3+mVwmyozXblthiF7F1Nqv7XwLXlGEI9c2pVRWyOLMVEyGGZaUgfnS8FKohlAd69VQL0IOBNfaIRlcFducTFx5of0eya5niQOhlMZKbYnz/PPIHfLhytQ1T5quty+mYSGSUuLZVf3gvpeg0/9x+G09xSq+J2MJ9ABaKfh7yfJfe1L3/LyFark/J8GrKj9/AkI63x5wdyU1YDGm0QqRNwtN09pVCpJTOlh8KOh7vdSEWMfjFa99pjysGOaJwjhEA98Nh9ZNs3HrFzEAFe2V5i2CWICH4J/Hy7W8GKdyhZa2x6O1ZaeZTxGVLUD3+4HguTMRs51MGWWkXvIQOQfERfb1NWtgEcmDA/It/GAW+5KUTBckJc/jqw5uuTxs6rpoISV6cwxYenIeU/T/aH10JwXc+AeopQm0zhC2617vPWKjixpOEVHuSIUfTQb+h1P2G6GVuKDdLtadxw5IWkSMP+l1mMPnpYzt6ZS+QVtEXO5j797mSF/46hURiakX6gaZGLb1TCxGMHWCRq/SenFHNpKks1rzCMbkeiqllT9zDiMzFEBgPOBhUa36feP5HEYp4xbH4f61ViyPD9VySm6xyAtypZWT70I/SlRw8qfeMsUU4bv4VhHrMLR6L54+I2F7vYOTeZHH5aTMC+LCbYh0UzSLcXLhK80/ASsuz6JOW+EfChf1YPhPwH4SwnzaZqw== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(46966006)(40470700004)(36840700001)(47076005)(356005)(336012)(7696005)(6286002)(2906002)(36756003)(26005)(426003)(82310400005)(186003)(81166007)(83380400001)(36860700001)(1076003)(2616005)(86362001)(6916009)(40460700003)(8676002)(8936002)(70206006)(316002)(5660300002)(55016003)(498600001)(70586007)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 11:25:17.6988 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bef2cfe9-9742-4152-a744-08da50540e98 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2909 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 dpdk-hugepages.py had /dev/hugepages hardcoded as the mount point. It may be desirable to setup hugepage directory at another path, for example, when using hugepages of multiple sizes in different directories or when granting different permissions to mount points. Add --directory/-d option to the script. Signed-off-by: Dmitry Kozlyuk Acked-by: Bruce Richardson --- usertools/dpdk-hugepages.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py index 4fdb199744..8bab086a2f 100755 --- a/usertools/dpdk-hugepages.py +++ b/usertools/dpdk-hugepages.py @@ -228,6 +228,12 @@ def main(): '-u', action='store_true', help='unmount the system huge page directory') + parser.add_argument( + '--directory', + '-d', + metavar='DIR', + default=HUGE_MOUNT, + help='mount point') parser.add_argument( '--node', '-n', help='select numa node to reserve pages on') parser.add_argument( @@ -262,7 +268,7 @@ def main(): if args.clear: clear_pages() if args.unmount: - umount_huge(HUGE_MOUNT) + umount_huge(args.directory) if args.reserve: reserve_kb = get_memsize(args.reserve) @@ -273,7 +279,7 @@ def main(): reserve_pages( int(reserve_kb / pagesize_kb), pagesize_kb, node=args.node) if args.mount: - mount_huge(pagesize_kb, HUGE_MOUNT) + mount_huge(pagesize_kb, args.directory) if args.show: show_pages() print() From patchwork Fri Jun 17 11:25:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 113001 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1E5ECA0093; Fri, 17 Jun 2022 13:25:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 549514280E; Fri, 17 Jun 2022 13:25:23 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2057.outbound.protection.outlook.com [40.107.236.57]) by mails.dpdk.org (Postfix) with ESMTP id 3952240698 for ; Fri, 17 Jun 2022 13:25:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kyecKZOdFCO3yILxBlZd7zz0BGf4kXIZ3j7pIQwBCwYDXBOOYHlR+eqBKeCFBI0xPhoBo09r1U+mP/JJVV/7NhAwbaH7seZUyJ0tHuLezlLiRSEGW055X4j2o8whbuAUxQxWuox0QSLYH7p4YVPy58MQwVOqYz99A9JUzyVX7nhldKTpx40fZVg2zmRdywbKZ6w6HF+4Whh/vXZztuvMJo3bpTVVawoHsJUwPNncWEfTLCMySV1d6RK0Tiz6PwEqScPhnnwHLBTgXXx2RccVtmRGxPKxwUjSDiDdYNstwJ1lX11ZyzOWVNwcDqR/08PWt7zuv6ruZp+sDKJ8IXhgOQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XsPxSBudlIj7TQgeohcPkWmix+pKgrIZHqbW0ywiTFE=; b=dwL5abDJMEBsRvTtMqGhBVK52vDqtJxAfQc8R86d/LN9eCZt4c1aTJDCglrdZv71aKkf8W53QdU7OMu/TqxDWT92EMjJbTGrFtOM1jbh+YKVXoRjdOk8UqL2aTI/5c+olU+pwWm2bDfFnAe+rQ2idZaMNBlBKrikdrWrV4sVo7kg5zuseQsFyw1RyjJuhTXs4iml6kkOIwH9oaUkfytpqKueHqwVjmdrKxp8oG805HNpBzQ8ZHKtK17z+Fa4RwWS+m95HBjDmWyfWMO1hr9Zq/KQDqeEDEYj+ILYrY5qGwoFObNm2GmmgOrE8p1UNojw7vb4zabmolMzObYTMReeFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XsPxSBudlIj7TQgeohcPkWmix+pKgrIZHqbW0ywiTFE=; b=hchG5Brr19R2cQHAI6N7/WQ0u4qox0ADavHSWmff3lqXb7sfSiGGMh8FuKMH80s9ToZQOfs6Wc0XAkLiK+o8zT62NkAzf2oDogLvzOr3ncoCmvdnIvPJDpreGjuLya2PM8nh6lB7lNhzj63JkBN08U3nt0g9MFhldmm4nLy7NiwcOY4W7SxjyIf73TBcGg9AT6P0RgLb0pqkjBuFuHNkwV1e27kdLpOLlkxhxBKVJUaDPkDMvdpeJB490/hnGthk0oR32mOBmh8IFmr6eCJsJWE0OCMXtik3nKV+uaTKas5lKG+ZjbOig//Ad8zuFDSuY/HKGEvTljSeYYAKknMGcA== Received: from MW4PR04CA0242.namprd04.prod.outlook.com (2603:10b6:303:88::7) by DM4PR12MB5746.namprd12.prod.outlook.com (2603:10b6:8:5d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.18; Fri, 17 Jun 2022 11:25:18 +0000 Received: from CO1NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:303:88:cafe::a8) by MW4PR04CA0242.outlook.office365.com (2603:10b6:303:88::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14 via Frontend Transport; Fri, 17 Jun 2022 11:25:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.234) by CO1NAM11FT032.mail.protection.outlook.com (10.13.174.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Fri, 17 Jun 2022 11:25:17 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 17 Jun 2022 11:25:17 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 17 Jun 2022 04:25:16 -0700 Received: from nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Fri, 17 Jun 2022 04:25:15 -0700 From: Dmitry Kozlyuk To: Subject: [PATCH v2 2/4] usertools: add option to change mount point owner Date: Fri, 17 Jun 2022 14:25:06 +0300 Message-ID: <20220617112508.3823291-3-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220617112508.3823291-1-dkozlyuk@nvidia.com> References: <20220607234949.2311884-1-dkozlyuk@nvidia.com> <20220617112508.3823291-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff311096-e314-41fd-51fa-08da50540e8e X-MS-TrafficTypeDiagnostic: DM4PR12MB5746:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 47vsUHcIrogJKau3wNoKUwWvHgic5xyrPV21ApBkmqvi8oPNAW9amodUW3VfVeqF5IyJi/1GRiNDbqE6FFL4PhLJRjhC4MCiCSl8J4DAPtTfT6dT9WRGBjkB229ktMzsCsw1x04Uas/DewQ2MFn37JlXInf48+7lrYHX0sAaSka0hkvUqcz1wjNKcKa2xKaXBJj3utpu+g6F0UR3/K7yut4XAPWjPPQxeCOEQ58iZMjN5EpR5YThMx0QjjTz9uwq19OtapVd8ThDnR9cfYqM+vWUBtecfpTiqWH4MtlKjUq38r1KdnglQds+rEL4UXXK/BuO45YG43V9Yz090L0fNWRKPy+F1QpZaZADiryhQ86hOrwnWaUYgPF/42zq4UoN6RnD1h01ec71OrQfj7gCEgpL60zQEWqywiN85QO4PbVUYYuxOWdx5AcB/+3ziooniLN7aUpREM0AF5dzUlKOEsp791ggEDDjiWUxCvnOvwAg7+tyl+bdwSQU45fHiUX/4rfl9QEl8EFS62uR2WyCRR6xpofRKnhOHj4HfN8Z9AHDYQm5p8yX5+2yxB845LzfrGtqPvLKGkqkzPm5F5R5XjCOYDqACu5TRfKSLXu07jgz+szlasXOSO15H7DBp8h0EJdSOPT64noitsmQwkWx9uO/wE5ZTiamtG+0mdeqP1+OUqQXT9KH4gtxaLzqGg0d6p42ic3McqC7Uf7ln53ftg== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(40470700004)(36840700001)(46966006)(83380400001)(186003)(426003)(8676002)(336012)(40460700003)(7696005)(1076003)(55016003)(70586007)(70206006)(356005)(86362001)(8936002)(47076005)(6916009)(2616005)(498600001)(6666004)(82310400005)(5660300002)(81166007)(36756003)(36860700001)(26005)(6286002)(316002)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 11:25:17.6779 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff311096-e314-41fd-51fa-08da50540e8e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5746 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 Per mount(8), the previous owner and mode of the mount point become invisible as long as this filesystem remains mounted. Because dpdk-hugepages.py must be run as root, the new owner would be root. This is undesirable if the hugepage directory is being set up by the administrator for an unprivileged user. HugeTLB filesystem has options to set the mount point owner. Add --owner/-o option to apply this option when mounting. The benefit of performing this in dpdk-hugepages.py is that the user does not need to care about this detail of mount command operation. Signed-off-by: Dmitry Kozlyuk --- usertools/dpdk-hugepages.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py index 8bab086a2f..5120518bcb 100755 --- a/usertools/dpdk-hugepages.py +++ b/usertools/dpdk-hugepages.py @@ -170,7 +170,7 @@ def get_mountpoints(): return mounted -def mount_huge(pagesize, mountpoint): +def mount_huge(pagesize, mountpoint, owner): '''Mount the huge TLB file system''' if mountpoint in get_mountpoints(): print(mountpoint, "already mounted") @@ -178,6 +178,9 @@ def mount_huge(pagesize, mountpoint): cmd = "mount -t hugetlbfs" if pagesize: cmd += ' -o pagesize={}'.format(pagesize * 1024) + if owner: + uid, gid = owner.split(':', maxsplit=1) + cmd += ' -o uid={},gid={}'.format(uid, gid) cmd += ' nodev ' + mountpoint os.system(cmd) @@ -234,6 +237,11 @@ def main(): metavar='DIR', default=HUGE_MOUNT, help='mount point') + parser.add_argument( + '--owner', + '-o', + metavar='USER:GROUP', + help='change the mounted directory owner') parser.add_argument( '--node', '-n', help='select numa node to reserve pages on') parser.add_argument( @@ -279,7 +287,7 @@ def main(): reserve_pages( int(reserve_kb / pagesize_kb), pagesize_kb, node=args.node) if args.mount: - mount_huge(pagesize_kb, args.directory) + mount_huge(pagesize_kb, args.directory, args.owner) if args.show: show_pages() print() From patchwork Fri Jun 17 11:25:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 113002 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E6C89A0093; Fri, 17 Jun 2022 13:25:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A0414281E; Fri, 17 Jun 2022 13:25:26 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2056.outbound.protection.outlook.com [40.107.220.56]) by mails.dpdk.org (Postfix) with ESMTP id 6AD11415D7; Fri, 17 Jun 2022 13:25:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JtUZlDexnRIVUhAtVaCTzbsPzmlbeMbowCs9hT5TJ6RN8V+YMwU8M3yUrEy70BSpV7rm823gDuiSKBCBs3DjtWa5SHFDyYKtMRax/0uxpywarH6q3N1fWxWPNYnQ7dE8vM/yzyZK4DY/b93q/qu7bXgQZNjqb8MzCTqZEug9WPuPaswDh6U8YVk2lKeOSZyL4myNh+UgytxjIQYoV7260CgwOkFsKP9RSlJotVL97rC035598qs15Me0tfhEtt2qansx835dELoCu0rjLExp3TMbtyGh5DVFi2l7PsXrj8lEsmb10NVHujYLL6hOlj7c2ISPA0NlO6uPSP2cCDsVcw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KQbag4oLjCAdCMKynvco3BAzSkvOYSXPhM5JY++0a28=; b=LzfO8Az6mpfcFbmvKIrUDfJCtfxh8On+zbzGC59TEdTcLRULh2I764+ipiUAg9uPn+SnGcSfPhouem0UD+M2pF/wUEUVHdBF/i/7PyRhQvBUZkbTcIdHr81OjVdnaNTSnXX0b7MRaNMzxpLBPR4/GFzJZWPd30QN/Gr8Aiqb4vKZQnrnYj/8cbUZOQa3CmV+VLq1AOPcQh4Pa5KCM4Ut7Fhlo8M41z3xtk0FvYS1hYQ8301/UNSVzgXFYgeon3TXh0FLxWvRMiw6iQIIy0lR7qVQ3dgkVm1Hnto1jIkRf522Cm9la54Z5wKsNr7Q/wXBQSXBhRZdWHLSleS6RcMETg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KQbag4oLjCAdCMKynvco3BAzSkvOYSXPhM5JY++0a28=; b=BwddUK7VuVCxu7QDpzkfO5mySCZ+k9Qux45JOWMhhR/wAVvoZ7nkHs2tUUnhbyIGGXSE0mX8Xs47cTJFV4pyXI7m1xA4Nev3L3UXSf9z6tWh1NIpFsv/S9imaOkxA+YlIkn+Ey1E//OWB6z51flB4hQYEhaatH1LYPpXF6pLUtJxRtDc9dtnUnCc+pr+TFN3P2Z6Wpl/3lHG38lkg46kGrgVXFw6lW5HwZWQZhJ/unr/Oj5tybNlq+iaiAcwtFmWU14hwPb/cTdYdMdKSMLnwu6Gvs79tEcwH58Lc3vN9YPFTR/Cp9brQiR0szCayOzsNT1vEUDQPlQJIF5VtTaIFA== Received: from BN9PR03CA0503.namprd03.prod.outlook.com (2603:10b6:408:130::28) by BYAPR12MB2728.namprd12.prod.outlook.com (2603:10b6:a03:61::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Fri, 17 Jun 2022 11:25:20 +0000 Received: from BN8NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:408:130:cafe::40) by BN9PR03CA0503.outlook.office365.com (2603:10b6:408:130::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15 via Frontend Transport; Fri, 17 Jun 2022 11:25:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT004.mail.protection.outlook.com (10.13.176.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Fri, 17 Jun 2022 11:25:19 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 17 Jun 2022 11:25:18 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 17 Jun 2022 04:25:18 -0700 Received: from nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Fri, 17 Jun 2022 04:25:17 -0700 From: Dmitry Kozlyuk To: CC: , Anatoly Burakov Subject: [PATCH v2 3/4] doc: give specific instructions for running as non-root Date: Fri, 17 Jun 2022 14:25:07 +0300 Message-ID: <20220617112508.3823291-4-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220617112508.3823291-1-dkozlyuk@nvidia.com> References: <20220607234949.2311884-1-dkozlyuk@nvidia.com> <20220617112508.3823291-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dc2ef7d1-a0cf-432e-238f-08da50540faa X-MS-TrafficTypeDiagnostic: BYAPR12MB2728:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 75a8mHE/CsOo8jFqWPR1DsUQVo1w7ojt3c46qdTev38uFKqvnmKEUcq8WEXMBEAkYoHOf7dg9c/hiKqmV9egUTXEXOLa5RkercEoEam/cr5wLlsfuVEbyleg9awYVeS1Ai5jJ9vXQCqH1ZZ1hrLljanMPfxl6utBu97BEmFi2Vh+Z7qA1uW8ykOY9JXot8R8yAfetye0RdA7gAF3jQoObcH6rqBlqXpkWTi/Rtjkm0ogAlgFD0xCe6MW9dEMX24zKsFvo0S3hMVBpeYaHKSBCLJwdDv7PP+rHZZ+BB+DFsKPf/lv6LKazznkEqlQs/7WWFQLYFc6AfwKVudGzgT7+LPrDmRR4vovtpOioyjy/IekajzucAiiTa+kiKLoCWwK6f/lV55StHfK2vRC1Z7q/InUrowD/g5pM5OZQrKE0TtB4VIIA30Mx+z6xzCW4JzNUuVAm9s6ekIkpeI4m+zLn+euLv8hT6R/xHJONIwotX4Hr5m5cWul8qQe15SYCJEWeX2c54Zhwy2iwBCW4DNJzDfgrZELHFAnzO0XWijirMT9ODhV3V09A2L4m4d8uqWrbvEIi48ybppLAM2P338WnpLYNo24zk7/s4sVfnOKGTLaBBH3bxUrjl3Bjjm0n9W8XBXAObPA2IY/6UI8wll7w0pL/0r7G2Zw84w3Ka8JEiFxZ4kF0p/SehlFyWm9KFOzXWv42D9t91zlFyjwStN1UBusy1mZIC4x+6N1jXgYRRpOrcrR8OskVQ4Ar+/zkkERSiO92RI99D/pwsMlUpEARWq51yeaI4kO8uSK/wdVvmk13janx23GP5dH87+PRvbD1plVEYFrg8V+vNYV1hZXDg== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(36840700001)(46966006)(40470700004)(8936002)(6286002)(186003)(1076003)(426003)(5660300002)(40460700003)(6916009)(54906003)(498600001)(336012)(83380400001)(36756003)(2616005)(86362001)(36860700001)(82310400005)(6666004)(356005)(47076005)(70586007)(8676002)(70206006)(81166007)(26005)(55016003)(316002)(2906002)(4326008)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 11:25:19.4911 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc2ef7d1-a0cf-432e-238f-08da50540faa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2728 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 The guide to run DPDK applications as non-root in Linux did not provide specific instructions to configure the required access and did not explain why each bit is needed. The latter is important because running as non-root is one of the ways to tighten security and grant minimal permissions. Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk --- doc/guides/linux_gsg/enable_func.rst | 67 +++++++++++++++++-- .../prog_guide/env_abstraction_layer.rst | 2 + 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/doc/guides/linux_gsg/enable_func.rst b/doc/guides/linux_gsg/enable_func.rst index 1df3ab0255..2f908e8b70 100644 --- a/doc/guides/linux_gsg/enable_func.rst +++ b/doc/guides/linux_gsg/enable_func.rst @@ -13,13 +13,58 @@ Enabling Additional Functionality Running DPDK Applications Without Root Privileges ------------------------------------------------- -In order to run DPDK as non-root, the following Linux filesystem objects' -permissions should be adjusted to ensure that the Linux account being used to -run the DPDK application has access to them: +The following sections describe generic requirements and configuration +for running DPDK applications as non-root. +There may be additional requirements documented for some drivers. -* All directories which serve as hugepage mount points, for example, ``/dev/hugepages`` +Hugepages +~~~~~~~~~ -* If the HPET is to be used, ``/dev/hpet`` +Hugepages must be reserved as root before runing the application as non-root, +for example:: + + sudo dpdk-hugepages.py --reserve 1G + +If multi-process is not required, running with ``--in-memory`` +bypasses the need to access hugepage mount point and files within it. +Otherwise, hugepage directory must be made accessible +for writing to the unprivileged user. +A good way for managing multiple applications using hugepages +is to mount the filesystem with group permissions +and add a supplementary group to each application or container. + +One option is to use the script provided by this project:: + + export HUGEDIR=$HOME/huge-1G + mkdir -p $HUGEDIR + sudo dpdk-hugepages.py --mount --directory $HUGEDIR --owner `id -u`:`id -g` + +In production environment, the OS can manage mount points +(`systemd example `_). + +The ``hugetlb`` filesystem has additional options to guarantee or limit +the amount of memory that is possible to allocate using the mount point. +Refer to the `documentation `_. + +If the driver requires using physical addresses (PA), +the executable file must be granted additional capabilities: + +* ``SYS_ADMIN`` to read ``/proc/self/pagemaps`` +* ``IPC_LOCK`` to lock hugepages in memory + +.. code-block:: console + + setcap cap_ipc_lock,cap_sys_admin+ep + +If physical addresses are not accessible, +the following message will appear during EAL initialization:: + + EAL: rte_mem_virt2phy(): cannot open /proc/self/pagemap: Permission denied + +It is harmless in case PA are not needed. + +Resource Limits +~~~~~~~~~~~~~~~ When running as non-root user, there may be some additional resource limits that are imposed by the system. Specifically, the following resource limits may @@ -34,7 +79,15 @@ need to be adjusted in order to ensure normal DPDK operation: The above limits can usually be adjusted by editing ``/etc/security/limits.conf`` file, and rebooting. -Additionally, depending on which kernel driver is in use, the relevant +See `Hugepage Mapping `_ +secton to learn how these limits affect EAL. + +Device Control +~~~~~~~~~~~~~~ + +If the HPET is to be used, ``/dev/hpet`` permissions must be adjusted. + +Depending on which kernel driver is in use, the relevant resources also should be accessible by the user running the DPDK application. For ``vfio-pci`` kernel driver, the following Linux file system objects' @@ -64,6 +117,8 @@ system objects' permissions should be adjusted: /sys/class/uio/uio0/device/config /sys/class/uio/uio0/device/resource* +For ``virtio`` PMD in legacy mode, ``SYS_RAWIO`` capability is required +for ``iopl()`` call to enable access to PCI IO ports. Power Management and Power Saving Functionality ----------------------------------------------- diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst index 5f0748fba1..70fa099d30 100644 --- a/doc/guides/prog_guide/env_abstraction_layer.rst +++ b/doc/guides/prog_guide/env_abstraction_layer.rst @@ -228,6 +228,8 @@ Normally, these options do not need to be changed. can later be mapped into that preallocated VA space (if dynamic memory mode is enabled), and can optionally be mapped into it at startup. +.. _hugepage_mapping: + Hugepage Mapping ^^^^^^^^^^^^^^^^ From patchwork Fri Jun 17 11:25:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 113003 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0438FA0093; Fri, 17 Jun 2022 13:25:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C2DB442B6D; Fri, 17 Jun 2022 13:25:27 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2057.outbound.protection.outlook.com [40.107.100.57]) by mails.dpdk.org (Postfix) with ESMTP id 4042D42802; Fri, 17 Jun 2022 13:25:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DAiZKCLn82ilc+m3KXwVxEJEzwrUPSoYcy1rkGNo9ipPH4E+VVSCmxSp7ChMYAbXn9kkF4onDOI6R6F7gEZoHecRR9kfLlK8nFU01jpjDtut0r3H0KxpDVmCLvjx2F2QKRg7MzglYyA5KUhI9Z4bD34I26WkJhDe/ku6KnFO3YJzkDupgCnjhoNrzEhiyt7/GF2F+f4AWj3L/ECah4aGLdayy1V1uahI/CzPr62VFuoEJR/RobuRfLPZl1ne7t4133pdSIuSIWfIxpAhuHvAiKoNUzX5Wnu8zSkJR+8JHhv7EX7bZSDcTwIrFs2iq1Oo/5fULghx7nP3TwFwf0Mdcg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3PZsvV8UxwsCCg8Cj9IG54/SfJSnJ2wFglvspkVHfQs=; b=Jsp3Do3sgB9PZWrZB/urzSu3BPfnvj5Gw2IUM8QATSqWIAH2RVO5YIbNu+d9Zy6hcNz2ljJMmjHhzm+5VvDT6wcfe1YHUlcjAv1SJ66yenJ1Zgb4nJGpiOIT/GcthOJ9Ry+iu7u8c6ptMbQku9EtRt/PtonW15Jys7LygDF6SnJfjGD/FPnoM7jBSh5cyMgifVG0FVPUTTczpAV4qMmmJN3mUF0Pb4hV1hNpLOvOe74f69URQFUQiVRNN6FMuLDWraQAewjYJQhCNYujt4klkRaIrbagm90Yrt+UWaPvWKy5VgA6aIRp0gMzqXQdCA++YHsw2EbVm5DZj0t+iAaQUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3PZsvV8UxwsCCg8Cj9IG54/SfJSnJ2wFglvspkVHfQs=; b=JexhAxt2BlE1NwpDaCUC/PMWNZmdrI1l6xlI8O820ZObPFKjFWxnqaq2mUP3v13ypW4MxoGiO7ZLJ3GIkmmyPCvxQ/vgBwkp1d7Z5o3XFBiGFcErDiyynhIvt7/y0WKwKhL9w+RijEZ0xyrjKaDpKWcdDMJpkTk0kWXsnSBX1TC/NzOZ4kdJhqJmpG2qL4A+rwdvvqN80ImZ8/SmbZjtSeZzRUWzukB+zVriQbKAKyGsEzYNMCR4eXoawPb+0ifqp2ewfAsZiw3FoLaG/m59RoTvJzrMzFTjMLZE3RcXFqLMp3YKgIeN6kyvopcAta9A7XJe1rc6/FAcXYQgR7uc4Q== Received: from BN6PR16CA0021.namprd16.prod.outlook.com (2603:10b6:404:f5::31) by SN6PR12MB4751.namprd12.prod.outlook.com (2603:10b6:805:df::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.16; Fri, 17 Jun 2022 11:25:21 +0000 Received: from BN8NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:404:f5:cafe::50) by BN6PR16CA0021.outlook.office365.com (2603:10b6:404:f5::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14 via Frontend Transport; Fri, 17 Jun 2022 11:25:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT030.mail.protection.outlook.com (10.13.177.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Fri, 17 Jun 2022 11:25:21 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 17 Jun 2022 11:25:20 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 17 Jun 2022 04:25:19 -0700 Received: from nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Fri, 17 Jun 2022 04:25:18 -0700 From: Dmitry Kozlyuk To: CC: Subject: [PATCH v2 4/4] doc: update instructions for running as non-root for MLX5 Date: Fri, 17 Jun 2022 14:25:08 +0300 Message-ID: <20220617112508.3823291-5-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220617112508.3823291-1-dkozlyuk@nvidia.com> References: <20220607234949.2311884-1-dkozlyuk@nvidia.com> <20220617112508.3823291-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72421ff8-599b-4957-f6a3-08da50541091 X-MS-TrafficTypeDiagnostic: SN6PR12MB4751:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y/PyTlDJb10/iEc93ntiZnNttyYKZJOBBwN9S10JuchPBXXVFxtpsaBgH/eNItA83LWAjj78l8TFmDWNzRGoVlFrU6z84LMXFAn2jZP4Tfp9mzwmrfKgNhAfFlLHniaTOnvkGcgLJfBCR+6doPKTWFG/RWpCaDo0FoQXkKHrZ4qL7wudKrC4yB+I655D/WyvfPQend8DHEXtEn8bDhL78jftgxALkZRLHEiZA5urpgrX2MFIjMuC/VEEIrarkUEt/HC9lIw/x4kPh98kO/SwKh9bzf0yL9mmchCnZxpgcbHfL2MFzqa3GLtxUJUHTnwGCXeJfKdQeV6PUAvmRONiu7YyestMGcGqRkXWxRfSKkAJucwBUt8jbmk4KhUvCaW3/Df5qjUFlVVfGmtgauTNt370HzyL9VB6Lz1jM/4SG5oxhMg8U5DQIBb/ZJt8BqOUkxIffuS6gSDav4W7RYCW7fvrZhOmw4izRbgkGEM8I96Fw4GiZUBi9vCaCLrP9cmv85N6c1rK9uCyMhMTOD96xbPyVDS2hNKI4hJQM9qMim3w9n/TYWrIvJO74enV00pYp+M7uVPfQn+LdKuvSfmc4ubnJXVrGvL26m35Ab119hnIbvBXernPZ5YJvHyW2PUXQANN7h6hexSjWVPpdokchZurb+Cx/nMz83l4KoxIhrs+Bfmzpms3dLOy97myBGEZTEJmSXD0XmVyaD1YqwdABQ== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(40470700004)(46966006)(36840700001)(2616005)(82310400005)(1076003)(186003)(83380400001)(47076005)(336012)(426003)(86362001)(7696005)(26005)(6666004)(55016003)(6286002)(36860700001)(2906002)(8936002)(6916009)(5660300002)(36756003)(81166007)(498600001)(356005)(70586007)(4326008)(8676002)(450100002)(70206006)(316002)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 11:25:21.0260 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72421ff8-599b-4957-f6a3-08da50541091 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4751 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 Reference the common guide for generic setup. Remove excessive capabilities from the recommended list. Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk --- doc/guides/platform/mlx5.rst | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/doc/guides/platform/mlx5.rst b/doc/guides/platform/mlx5.rst index 64a4c5e76e..18d38f3488 100644 --- a/doc/guides/platform/mlx5.rst +++ b/doc/guides/platform/mlx5.rst @@ -404,25 +404,30 @@ The device can be bound again at this point. Run as Non-Root ^^^^^^^^^^^^^^^ -In order to run as a non-root user, -some capabilities must be granted to the application:: +Hugepage and resource limit setup are documented +in the :ref:`common Linux guide `. +This PMD can operate without access to physical addresses, +therefore it does not require ``SYS_ADMIN`` to access ``/proc/self/pagemaps``. +Note that this requirement may still come from other drivers. - setcap cap_sys_admin,cap_net_admin,cap_net_raw,cap_ipc_lock+ep +Below are additional capabilities that must be granted to the application +with the reasons for the need of each capability: -Below are the reasons for the need of each capability: +``NET_RAW`` + For raw Ethernet queue allocation through the kernel driver. -``cap_sys_admin`` - When using physical addresses (PA mode), with Linux >= 4.0, - for access to ``/proc/self/pagemap``. +``NET_ADMIN`` + For device configuration, like setting link status or MTU. -``cap_net_admin`` - For device configuration. +``SYS_RAWIO`` + For using group 1 and above (software steering) in Flow API. -``cap_net_raw`` - For raw ethernet queue allocation through kernel driver. +They can be manually granted for a specific executable file:: -``cap_ipc_lock`` - For DMA memory pinning. + setcap cap_net_raw,cap_net_admin,cap_sys_rawio+ep + +Alternatively, a service manager or a container runtime +may configure the capabilities for a process. Windows Environment