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 0A25445DB3; Wed, 27 Nov 2024 09:59:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D09204021E; Wed, 27 Nov 2024 09:59:57 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by mails.dpdk.org (Postfix) with ESMTP id 501B1400D6 for ; Wed, 27 Nov 2024 09:59:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732697997; x=1764233997; h=message-id:date:subject:to:references:from:in-reply-to: content-transfer-encoding:mime-version; bh=/eVzZfIbCFLqKMZbcfVQ8g3hK93A8Ft/llHiEgDjPJc=; b=SHygOkOYzfpT0ficE0PWARe4ek1U2S1icxbYVwrotxRwC9R24YqnV8Sp LVGjvmPuFcvKOXvPcsHhbUhQeaO1PsKLQwTQtuun3noRBYX5sNYQhHk7S lNQ17Z0G45SjqVL4js7QHTCNRuF0mPX/ezBaACW165J+TrO2NBpgUkdPz dJqlqrJ+z8m1csUVJ9UyexNcxsCWMi1017fVnaxaxfdNoYqktGCxIYsYW g+M/Yct/+Xtx0aNs0wZMKYzg2oNVWC+T18EtCrjvI77Maq/rEcFmZIbgM xOAJRc8aRffXWbf056q4rEMjYcKn0/CCBSp/hENNP8BQREQIE8g5dwNEo A==; X-CSE-ConnectionGUID: ePlhxrq/RJOAPakPKAJo5A== X-CSE-MsgGUID: UgU/UGWfQ6m3cJnCphLo0w== X-IronPort-AV: E=McAfee;i="6700,10204,11268"; a="32746596" X-IronPort-AV: E=Sophos;i="6.12,189,1728975600"; d="scan'208";a="32746596" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2024 00:59:56 -0800 X-CSE-ConnectionGUID: /H+ZxmJcS7S5qYrDkMPSSg== X-CSE-MsgGUID: AexxxOvWSFuc/MdqsB/ZmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,189,1728975600"; d="scan'208";a="96949808" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 27 Nov 2024 00:59:55 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 27 Nov 2024 00:59:54 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 27 Nov 2024 00:59:54 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 27 Nov 2024 00:59:54 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ejixdWFKpe4QmGR0mNGv0foXCE2yoUQxsKk1s0pNZY1TxLLPuZMsdhsuDbBNxHkIUgyHCqLe4nkbnW2CqlSxLE9hhxDHQTzsWN5bOtu59l/hFpi3gRlDKhZt271M/87VSJSImS6ibR6c2IUJOOT6s/n+GGQr10/Tmg45n/8vFAG0YZlnQTRETXPN8JqxmvijEoh/JrXjWt0wKJnIDCxPIPMCFD7+fxbBwqhGPEXijzYJeAQ6e1/UiknJvH9eTb6fYmcy7jm+uGGyj1M/5FrFyCF4/wh9G15Qzl/SF9xO23jQa4QyqNJBG35ZBZuOc7xIBMGYi45tm21dMKtbK+3w7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=GcwHP/5FBL2rBnXQReHNGGFI0OX5k7CaUIy5xTxLZ1s=; b=VGfkUswaQkF8GKkWDhxncGvHfZpR5n9jKPq8B2VMXhW0zDg5x2Qk6DMBi4jPs9LV/TTYhtCZoleerNqbl1MoRUFlNY3+SJRmPsR8+40R65XkiiDDJ+NSZs28I2Y61aGaKAH2H6AzeVriEUUNBX592WanbxpzwQlg8uI/NVtn5LxHEqe+g+cSC0SBj+82XyP53LJFlX3tYFG5a1Tlr6+FDGH9fAgR17wUXlX3fUpaOjFQlh2mHfHJAq4ZiRr3dSW/WyRqovNeiYG6VKA3wjI1/MMJ1RPK6ia3UnU3orPxp2AgmzGSrsVXT81vuymoWmKznXbE4XxC1CA6e/7BpqDtuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) by PH7PR11MB6449.namprd11.prod.outlook.com (2603:10b6:510:1f7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.21; Wed, 27 Nov 2024 08:59:51 +0000 Received: from DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::21e4:2d98:c498:2d7a]) by DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::21e4:2d98:c498:2d7a%3]) with mapi id 15.20.8207.010; Wed, 27 Nov 2024 08:59:51 +0000 Message-ID: <313c5cfa-677c-49a0-a9e9-f95e163f8560@intel.com> Date: Wed, 27 Nov 2024 09:59:47 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/1] usertools/devbind: allow changing UID/GID for VFIO To: Robin Jarry , References: <4cd0282dabfa59e715028ecf255468529655b487.1725285449.git.anatoly.burakov@intel.com> <3dba72cacdb5bc71e743dd84cd44e5dcde77aee7.1732633351.git.anatoly.burakov@intel.com> Content-Language: en-US From: "Burakov, Anatoly" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DUZPR01CA0041.eurprd01.prod.exchangelabs.com (2603:10a6:10:468::19) To DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6502:EE_|PH7PR11MB6449:EE_ X-MS-Office365-Filtering-Correlation-Id: 530d8728-665c-4197-cd0f-08dd0ec1da77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?B?dDY0MHBBd3oxVG9Mbi81MHZQbGZhSUx4WTFhV0V1R2lsR3d0My9iUmZKYjBj?= =?utf-8?B?UTFURHNMQy9DOHUxU2tXdGJ3Y1NLMFdRRHZNWEJHWWFiY2hrc2p2UnhpT1Vn?= =?utf-8?B?dEJ2V0Q2dGpLRWdiUlU0TWwrYitBTnZ1Rk5EaTNUMnVMVnF3TXVZbG5EbWtp?= =?utf-8?B?MEt5M3JUbU9SNVZVcTdXM3R0TGJtYVF2OHpjSGhScncvTTczKy8vcEQ4Y0dI?= =?utf-8?B?TmlPdnl0MnN0NFhlUW1zNW9PMWxTaFRVMlBPQURhaFNzUmc0L2owdnQ3dWdy?= =?utf-8?B?WmV4c1RmWmF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VBmZWVp?= =?utf-8?B?KzBmYUFaaU9ENkthQnFscHRCdXhGN2xDZnVHNy9vOTBxazVtREdrMkNhM3BJ?= =?utf-8?B?clJDRnlkR0hTMDlVWjlHQTFvZmxuMFo1M1RxcUpFbnM4aUNXZ2ZRSUVpTFpI?= =?utf-8?B?WmRiNXM3eFBJTWx2WmxiYWd4Sk9KYXhZdVdpQnFWbkpWM09Wa3dRdUdzbFRG?= =?utf-8?B?d1BCTVlnYlBwYlJHWVRtd3F6ajBYdjkrYjJOMUV1MmhQZEhEVkk0OHNTSkRL?= =?utf-8?B?aHVWTi9wZzEydGV5c015TjJNR0dIRkpNbjMrc0VpNVZqNmRNL21qZnRJWGhJ?= =?utf-8?B?b0ZvNWZEV3RiakF0YytLZUlMdXFXL0w4UXBOaVk2OUZoa09RQ3lPWnVOQW1k?= =?utf-8?B?VHEySDVlSk5BNWpOSnA2dzY1SU1ZZUJadzkrLzFCcDNsVEN5bWVLTDhRejhT?= =?utf-8?B?c0VKc0NUMk8wRGlqZkJoRVF1bTlZblIvcTJsTU8relM3eDFhLzRaUUlIVGpJ?= =?utf-8?B?Nmk5QlFQNTh0bXRWN3M0MVJQL1doQWpSMkNaOGZJa2FYbGlkM3Q1TVdwR0pP?= =?utf-8?B?dWN4RWhkNG5JcXNmMmh0QXY2ay9UVjgxTlJ6dDZ6MDdlb2tWY2ZzSE9OUCtD?= =?utf-8?B?U2VNV0JhNGJmaFNuamhydz09?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB6502.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Z0taNmlXbHNuMElwZXdwTnphL0NlWjFCaEthWkRJYUxjUFZHNEFvNFQxRVI5?= =?utf-8?B?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VjA4eEV1Rmo4VDlWdHFX?= =?utf-8?B?UC9DQ3lPZnd0VkE3WDZBVEc0TVFGT3kzUWE4d2Q3RGdrZGtNL1FPdEM3L29U?= =?utf-8?B?SERQVzZsY25zWlNjZEk4blM2RTc5NmMxZ1ozVnRJT2hPanpSZUpnc2ozSk1N?= =?utf-8?B?eXBPRFpyeUJMWE1hQWppQmxudmJDbkk0TStpNFpRMXhpL2tISHcwWm9KSmFG?= =?utf-8?B?Syt0ajVnN29xbXNoNUYvVFFEUWhaTmg1MjVWd2NBOW5lWnFYNlVmKy9YY2RX?= =?utf-8?B?dWZwQm44Ym9tVVdRSGxYbDJDcWtZcmRLbWxIZnNjZHZFUlRIWHRtYUg1SjYv?= =?utf-8?B?YUE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 530d8728-665c-4197-cd0f-08dd0ec1da77 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6502.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 08:59:51.4589 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IEa4IVmyswgjXabtOY6XeH7VDApMJsfRe9XP5wxfi6QBguzMHeoAUmbAmQnrcJU2VuJ3JNceGSQxUyorOmuhjUaiU+GPQbRbkB3F7B/wxaM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6449 X-OriginatorOrg: intel.com 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 On 11/26/2024 5:15 PM, Robin Jarry wrote: > Hi Anatoly, > > Anatoly Burakov, Nov 26, 2024 at 16:02: >> Currently, when binding a device to VFIO, the UID/GID for the device will >> always stay as system default (`root`). Yet, when running DPDK as non- >> root >> user, one has to change the UID/GID of the device to match the user's >> UID/GID to use the device. >> >> This patch adds an option to `dpdk-devbind.py` to change the UID/GID of >> the device when binding it to VFIO. >> >> Signed-off-by: Anatoly Burakov >> --- >> >> Notes: >>     v1 -> v2: >>     - Replaced hard exit with an error printout > > Sorry I had missed that particular detail. > > I don't think this should only print a warning. Otherwise, the user has > no way to detect if the operation failed. Sure, I'll change it back. >>  from glob import glob >>  from os.path import exists, basename >> @@ -108,6 +110,8 @@ >>  status_flag = False >>  force_flag = False >>  noiommu_flag = False >> +vfio_uid = "" >> +vfio_gid = "" > > These are supposed to be integers. Initialize them to -1. Actually, the pwd.getpwnam() accepts strings not integers, but yeah, technically these are supposed to be integers. I'll change that. > >>  args = [] >> >> >> @@ -463,6 +467,22 @@ def bind_one(dev_id, driver, force): >>                       % (dev_id, filename, err)) >> >> >> +def own_one(dev_id, uid, gid): >> +    """Set the IOMMU group ownership for a device""" >> +    # find IOMMU group for a particular device >> +    iommu_grp_base_path = os.path.join("/sys/bus/pci/devices", >> dev_id, "iommu_group") >> +    try: >> +        iommu_grp = os.path.basename(os.readlink(iommu_grp_base_path)) >> +        # we found IOMMU group, now find the device >> +        dev_path = os.path.join("/dev/vfio", iommu_grp) >> +        # set the ownership >> +        _uid = pwd.getpwnam(uid).pw_uid if uid else -1 >> +        _gid = grp.getgrnam(gid).gr_gid if gid else -1 > > The validity of these values should be checked when parsing command line > arguments. Sure, I'll move this check somewhere close to init. > >> +        os.chown(dev_path, _uid, _gid) >> +    except OSError as err: >> +        print(f"Error: failed to read IOMMU group for {dev_id}: {err}") > > Remove the try/except block and let the error bubble up the stack. This > probably does not require a dedicated function. Moreover, the name > own_one() is ambiguous. We do the same thing for other errors (e.g. in bind_one) so I'm not sure if we want to let it bubble up the stack - we don't catch any exceptions anywhere up the stack. Current implementation, however deficient from error handling point of view, is consistent with the rest of the script. >>      # For kernels < 3.15 when binding devices to a generic driver >>      # (i.e. one that doesn't have a PCI ID table) using new_id, some >> devices >> @@ -697,6 +720,8 @@ def parse_args(): >>      global force_flag >>      global noiommu_flag >>      global args >> +    global vfio_uid >> +    global vfio_gid >> >>      parser = argparse.ArgumentParser( >>          description='Utility to bind and unbind devices from Linux >> kernel', >> @@ -746,6 +771,12 @@ def parse_args(): >>          '--noiommu-mode', >>          action='store_true', >>          help="If IOMMU is not available, enable no IOMMU mode for >> VFIO drivers") >> +    parser.add_argument( >> +        "-U", "--uid", help="For VFIO, specify the UID to set IOMMU >> group ownership" > > In order to fail early if an invalid user name is passed, add these two > lines: > >           type=lambda u: pwd.getpwnam(u).pw_uid, >           default=-1, > Guido doesn't like lambdas :D -- Thanks, Anatoly