From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (unknown [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 87AC1460A1; Fri, 17 Jan 2025 08:29:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D0BB42686; Fri, 17 Jan 2025 08:29:00 +0100 (CET) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012028.outbound.protection.outlook.com [52.101.66.28]) by mails.dpdk.org (Postfix) with ESMTP id B04D14029C for ; Fri, 17 Jan 2025 08:28:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dRvY+u+Yk9XlPEb+6SHJxgI59IN1eeCxPXESjxyNzuaPfWjYlFeAyZzaGDGN0eLJ9DChyAdiVufLDf+afE51BFz+bb2aAQ1M32kilfTjnjRYUD0N5D7NUfgrmt/ubcD03+DbpUzRB615PO0NYcrwURXrvtDI0YXeCsTdTClHZhnbLB+QyKD/5lop8bMfNZGozql29UdIYGpZKYlBaorV/pTYZ95MHBNyBloJBYISYp2xQ9V+/zyNq8vcVMAssio2Fv/bRxTA9QBL2FbIKQ9bjcc++UFmduZAW3BjfGq3lFdQTXJ7g3pAQbTb6BoL/QKg2e3YPQatlImVHfMH4J5T3A== 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=gUp3W8kFHp7Vt9z49K9B34ZzHcuqH0qoAOTY5aN1JCk=; b=nEijdxwnNjtFls5l2MiDKTU3xmVgNdClzFmnQS1h/6wpptzp5bJPVWdwHOEpQNVMJxW7XOCjyZuCXJo+WUugs+wdvs1rn0PQecETnEHDbOAh4NqCgx5TTryyHTV2BN8yZpRlDS+rVZMbrqwSSMY4rkAnHvP5kDa73jvdQIe6k/Omn60nDdtQ9dGy5/ptezSE/+rw94Mb1qxbmIm+t6NkpmM+rxoAK2h5zGcWTlC6LbBiAZV/O++j/pvJeJtc2IpHZeeOCOnFoJVJMP5E9DmYV+L4/jXnsPsh1F9VxiIExdvnOdkUP8ui6gkDOqk6sj3NbsgDkzQ85wAMZHANkXk9TA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia-sbell.com; dmarc=pass action=none header.from=nokia-sbell.com; dkim=pass header.d=nokia-sbell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia-sbell.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gUp3W8kFHp7Vt9z49K9B34ZzHcuqH0qoAOTY5aN1JCk=; b=obS6CxsHj5v+83Hn13DobKCsXYLx+jokFjYKk4YydxdoRmAIDx4cjmjAOS85/5kiBbd0PjSVUgd+u50gE0ukMeh+ZRMLYXbof4wNebLB5TznSXXrIg6FXyk8JkumoXo5oqagxnsGW7JPGnY0/5vYHn7hcgW8TopQymcKB/5YA73LB1WvUWwYbR/+VubpstO3bQG8MWOiUzuC/iRjqVbR1GLQz9Os26PdZLyVoUA5ki//DPfhUkQeX3LUb6ns5EKL/XkLuo5ac74kx+GUXVrHMHOYVDky0LbQAxNNW7KcZHbyL0kHAU0eH9U4R01lprbrJVEV/IgZMXDfvbpRQAA/jA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nokia-sbell.com; Received: from VI1PR07MB9898.eurprd07.prod.outlook.com (2603:10a6:800:119::6) by DB9PR07MB9293.eurprd07.prod.outlook.com (2603:10a6:10:459::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.14; Fri, 17 Jan 2025 07:28:55 +0000 Received: from VI1PR07MB9898.eurprd07.prod.outlook.com ([fe80::1928:4afb:4eee:1f21]) by VI1PR07MB9898.eurprd07.prod.outlook.com ([fe80::1928:4afb:4eee:1f21%6]) with mapi id 15.20.8356.010; Fri, 17 Jan 2025 07:28:55 +0000 From: Yang Ming To: Anatoly Burakov Cc: dev@dpdk.org, Yang Ming Subject: [PATCH] Skip vfio in the scenario of non-privileged mode Date: Fri, 17 Jan 2025 15:28:47 +0800 Message-Id: <20250117072847.2741-1-ming.1.yang@nokia-sbell.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0120.apcprd03.prod.outlook.com (2603:1096:4:91::24) To VI1PR07MB9898.eurprd07.prod.outlook.com (2603:10a6:800:119::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR07MB9898:EE_|DB9PR07MB9293:EE_ X-MS-Office365-Filtering-Correlation-Id: ed37b53d-0163-4f95-26ae-08dd36c89933 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?w4HXogfYHVIK2LgJEjgkX1I9kuHqVfrN+oRz4iGsDwwWVsOlBFXuSpAHOwdN?= =?us-ascii?Q?3P36HElHa95XDm8aj9FfUap2IDWmusm9T6kImtIWaaMzYiAJPaoZydCwVYfB?= =?us-ascii?Q?wHZpp7fw7K9bpVGNN4b2P/c8byNP7PDQeUg5RnnrP5ALaUJUTC9tflaHab/S?= =?us-ascii?Q?tNCGzbHo2vjN4eZf31Cnr4HCXyeEhia6KIKlCRatYuaLzm07FWjCKXW8jknD?= =?us-ascii?Q?t9wQg+898CZNz2O9ddFTl89ftZ1Xa0DYiMkgchgIXkOoIhUhyh4kh0LwyaE+?= =?us-ascii?Q?WhBzEABCHNDFHKOG7ZQRYelsqZ2N0xH87s+Lt5Y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us-ascii?Q?zCsW0cKqcELSXEz0PVhhY/Np4HdokMV+HCjhgRRni7FIv2lhbCLs6E2Q2Xzj?= =?us-ascii?Q?MBFzW69nPYfc88VXuF+YoS/FbjzkAg40crijdASgPA504CCecST+XLFRAhVS?= =?us-ascii?Q?/SoemSfIQLMRXLNF0/IdKie0r9BTxmUdiTCQ7tznwE99wGAMO/vRQiqbnnfY?= =?us-ascii?Q?eY3r4WCfyfQQ7HXxYeKEt5PHFafl?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR07MB9898.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?PeOOJNpfMbBVHRvhZvC62TSkg7CLQgM4enUXIjAl/lqv+l0GM+G2n0fuUvDz?= =?us-ascii?Q?co/VUziVLZhiVwUS/yw/tZzuqtK7HLQuWBHWosYrhhzGLZ5xVjspinjgYaty?= =?us-ascii?Q?AvT5xH9PB6PO6HwrB833HLqRZoi+ckNImRRdHhG/ZLnZZ14BodaBGCemM+qW?= =?us-ascii?Q?NaisAHBV2uJ35aJFChATi4EeEwQn9juDO35nWL/fAQds3hAFEPLRDHT/eFbj?= =?us-ascii?Q?aUP+JM+RyLkPctZbU3T2UHrt6wSUrxXTO4nfR2kR9lnZcwve0d7d3b0TJSqu?= =?us-ascii?Q?KjnuZDewXT9G078xIvxoL1ZYW0E/CGkhfKyVFHC1m48EQmqhgKPTexe/5JdJ?= =?us-ascii?Q?Q5O5CoCRk7JHl8VeDumDyDwil1XE0tonC2pLt3CrPdB3Wun46AjgrDpAnb2f?= =?us-ascii?Q?qCKQ6k9Uwr388KrTk5LqB23gTq2rYVpzF4fxfyHYcmTdiFvmUU8FKCVLzYBV?= =?us-ascii?Q?0gy2cTprMv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hKP6a?= =?us-ascii?Q?xJKlCapIKvDfsdoUKYtIz3mGVnCXcmVxnm/oRJZyjS59i0v98bnMlb1AoDPD?= =?us-ascii?Q?v8Sap8M7x/r8x94D/g26/bIHIG9bBiKQEj9Wa2BvH/We90fc2MqFE5ciGWI2?= =?us-ascii?Q?0kc+fXa9pzUP4aEJlKC11XT3i0WTWECt4t+aGsQR3MBBnJLx8COlDsqMGgLc?= =?us-ascii?Q?y25W+MGhkX/rOBk8gDqPNYoFNWqykUrAj3d5vsaVBFG4mGLMjU57s+hS5iG+?= =?us-ascii?Q?Nw=3D=3D?= X-OriginatorOrg: nokia-sbell.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed37b53d-0163-4f95-26ae-08dd36c89933 X-MS-Exchange-CrossTenant-AuthSource: VI1PR07MB9898.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2025 07:28:55.0844 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zvjiLqbNj5MEIWwZJiLtMu37gQfLYTovG8pWCTMFN03UIaxuCWyulKhGVHOGxXfOQkvPdxTTRwreItuGIhoSdQ87ZsJkVqLd6QxUaNmnTjc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB9293 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 detect vfio container according the existence of vfio module. But for container with non-privileged mode, there is possibility that no VFIO_DIR(/dev/vfio) mapping from host to container when host have both Intel NIC and Mellanox NIC but this conntainer only allocate VFs from Mellanox NIC. In this case, vfio kernel module has already been loaded from the host. This scenario will cause the error log occurs in DPDK primary process as below: 'EAL: cannot open VFIO container, error 2 (No such file or directory)' 'EAL: VFIO support could not be initialized' Because `rte_vfio_enable()` call `rte_vfio_get_container_fd()` to execute `vfio_container_fd = open(VFIO_CONTAINER_PATH, O_RDWR);` but VFIO_CONTAINER_PATH(/dev/vfio/vfio) doesn't exist in this container. This scenario will also lead to the delay of DPDK secondary process because `default_vfio_cfg->vfio_enabled = 0` and `default_vfio_cfg->vfio_container_fd = -1`, socket error will be set in DPDK primary process when it sync this info to the secondary process. This patch use to skip this kind of useless detection for this scenario. Signed-off-by: Yang Ming --- lib/eal/linux/eal_vfio.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c index 7132e24cba..1679d29263 100644 --- a/lib/eal/linux/eal_vfio.c +++ b/lib/eal/linux/eal_vfio.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -1083,6 +1084,7 @@ rte_vfio_enable(const char *modname) /* initialize group list */ int i, j; int vfio_available; + DIR *dir; const struct internal_config *internal_conf = eal_get_internal_configuration(); @@ -1119,6 +1121,15 @@ rte_vfio_enable(const char *modname) return 0; } + /* return 0 if VFIO directory not exist for container with non-privileged mode */ + dir = opendir(VFIO_DIR); + if (dir == NULL) { + EAL_LOG(DEBUG, + "VFIO directory not exist, skipping VFIO support..."); + return 0; + } + closedir(dir); + if (internal_conf->process_type == RTE_PROC_PRIMARY) { if (vfio_mp_sync_setup() == -1) { default_vfio_cfg->vfio_container_fd = -1; -- 2.34.1