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 E1FFF45895 for ; Thu, 29 Aug 2024 10:53:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B53F7427D2; Thu, 29 Aug 2024 10:53:25 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id F097D427CF for ; Thu, 29 Aug 2024 10:53:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724921604; x=1756457604; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=3Mxr4RPAUdd2daaZ+KfTfPi0LTQkl60TypIm9Bx5k74=; b=MscrF5qI+SfOOL0l+S2hQN0PHESmwQFq94/iO2EnSCEsOn5PmnMiuEKi kLbAlkbi+yOBmEVDoViVvfm0STGBrLOehMC5ce0iVBN+eir0NO7hXGULm GwiECkFXAOp+Xw8S9vjP4NUEDghf/BBg15iW4xxPZtgNSqOoVsMBcYqxm BnLqZSQTHvtGrtSfUg6ldpUgFRYIkErX2mtrOmsIxYQLdSYF3LK0mPWtK md5IbTDlnUhPyYQ8RdI/2IEGc7xHeoDwtjZvtyVKIEoXHUVi/eFzbFjq3 D6Jj5kwxha/OICBrBlmspqFVwJGcWki5vd2OKCsOu6B0+iEsLYH3V9VU7 Q==; X-CSE-ConnectionGUID: vu/9qOcwTxGoZfYFl3o6xQ== X-CSE-MsgGUID: KdeJ8VwHQZuqDylrmRfkuA== X-IronPort-AV: E=McAfee;i="6700,10204,11178"; a="23074347" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23074347" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 01:53:23 -0700 X-CSE-ConnectionGUID: 4CcZjAvlQnyFleWfGa+KGQ== X-CSE-MsgGUID: QeCe8dDcS/eWpEmJuO5kZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63453687" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 29 Aug 2024 01:53:24 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 29 Aug 2024 01:53:22 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Thu, 29 Aug 2024 01:53:22 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 29 Aug 2024 01:53:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Wvc+y88zjO2xUfOpgdbQbqUwlHOvg+aNuZchrmDtBWJ0yG6Bfmx9hXcYIlDGjdycSuRXiomsuk0TIwzvUnMbIQvV/8TaFC0OfVCH3Ekxr65YE77pC1b8qzswiM5r6vKnqOLZZISNfDY8mUsvnSNXUzuuAxEW81MeUYRBJb3k9KO6FMUhiSoyEbkrFH77YLPQSU2W3zru34aBOYOD+zrIDR34k2Y80dMZW7frER7nGdPgRoVWr+EUnLEIeC3lksJtJlEPZVAVpO16cQaStHZ3KnZuE3z0GDGKElBM7VIzEsLCTGdZRmG5YRCkdl/tkn61hdnStGjhoFtY5pOK7P9aHg== 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=7h2+DQ7ix8OwV72fbtmrbspUdPYg2O+EskHSrnKwKdE=; b=HPPZrcFBiiObruGTqe9uWby+s+WGvdNPgSxrYGXkDhqMiPX0fJQjTQnwsH1SxWZ6WVuZrWg2HLi0EKgRXpAjzvhJ3hjKI3ebpn6O18GTbajROucY5n7qzJZaUW+41BQuVuSzHOvoJiwf0rxeojJCJMZSpucz8SuYQSzlAxSCkHkH4MMqDIZnzvGpFD3zhG2GKJpO8x7z9ZVbywHIaUYD45YSEnU2+8lU2kBTJZGNJhrWTLjIGlRnAL4vEYP2i3faMm/3vYuMXSfZNJ2PUpKrBk2s6fmjglRF2rL0giG9BVGxRoHVoWvSh2hVd24npx4hg4HyU4L7eYEgLkUZj8wp9Q== 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 PH0PR11MB5578.namprd11.prod.outlook.com (2603:10b6:510:e7::8) by DS0PR11MB8017.namprd11.prod.outlook.com (2603:10b6:8:115::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.20; Thu, 29 Aug 2024 08:53:14 +0000 Received: from PH0PR11MB5578.namprd11.prod.outlook.com ([fe80::ae6c:ad18:eae9:e7e5]) by PH0PR11MB5578.namprd11.prod.outlook.com ([fe80::ae6c:ad18:eae9:e7e5%4]) with mapi id 15.20.7897.021; Thu, 29 Aug 2024 08:53:13 +0000 From: Konrad Sztyber To: CC: Subject: [PATCH v2] bus/pci: don't open uio device in secondary process Date: Thu, 29 Aug 2024 10:53:06 +0200 Message-ID: <20240829085306.269546-1-konrad.sztyber@intel.com> X-Mailer: git-send-email 2.45.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: ZR2P278CA0044.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:47::6) To PH0PR11MB5578.namprd11.prod.outlook.com (2603:10b6:510:e7::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR11MB5578:EE_|DS0PR11MB8017:EE_ X-MS-Office365-Filtering-Correlation-Id: e95f61a8-1c29-4ef8-2c3a-08dcc8080438 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?88UrV6ZRRiD0iHPSp3TrF7hCjykyNpihOi1UccoEAY1NPiaP0aoy02gf2Jwg?= =?us-ascii?Q?2hsCUcj4myXEjdmM3HPlESZM9XqZNqGN5d2S/9MJObYDPeEyaHKYeIjTfQ2w?= =?us-ascii?Q?fveQk3Xzpi1rt/u+7xli7PhC7PckFC5AbcrSjwk5oAuqUZIoXWkXPusNeYLp?= =?us-ascii?Q?pTkuBb6JuKJlTuuO1gFFO/f7OoutEW2C9ppiPkuFAdy6CnnhDFlh5CQdx29X?= =?us-ascii?Q?HgxsGRTXGMIr7vdvpqngl0Kf3uc5uHEe9BiQkC+BMt5HX+B0ZuPVEMkcVXTV?= =?us-ascii?Q?qAK0O5vs49hnah59vP9IWjIMvTgv0WI8RTc94IUfxOvsVppl5HIB/FXnVbfv?= =?us-ascii?Q?xbOnVWt2xnrn8XvkuQlnvvbD7M0+EN6Bg/RZUGdSuHA9M+Ayh/iv80EQbcBD?= =?us-ascii?Q?KI6laBUEtqBDcV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xtTVngu?= =?us-ascii?Q?6TbssESEoVHr/DppnVNLm/H32NuN/eRX2md5O2++Zb+juw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5578.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?P2T28I/6RQ5SA7J7ZB6lxFmFCXt23Ndj9SMD5OJqSIOtSgtIfKA1TBs9Fw31?= =?us-ascii?Q?micZhTA1LkAVvfkBMIJ7yZeqAXMYKP5c2NCAzdCHvpx2CiQL3ZnfUNSlCafb?= =?us-ascii?Q?5AuFvMBrY3NQhV7gKsnNAaFuq5a8ATmX8xdOHCOVRmeeNzaM5sUAEhhlr6V7?= =?us-ascii?Q?7J7CMIGnqUN05ahfcN1iVPLbnIeZuRZPySD3nVfWrZRPtX8x8aZA7wJ7fsH5?= =?us-ascii?Q?Hdm14aGl2zaT8sN+0UT4gwwk0isLw/hq0lu6DyVMryNiFGtNOha7iYKIE1V8?= =?us-ascii?Q?oOXg+tNF3JWAkCGIn1WqY9ADWuAMlCnYG7npF9TIytcokFO9CMmmt2zmkyJA?= =?us-ascii?Q?Av1h6dRYCwdtVVeET5TKz3Aw69z1U2MnrWS6oLKT0gaQxpXTBdCoSwDOQKC4?= =?us-ascii?Q?awl5uDMhuGPQeKPBz1xwynIH+zHMegGqOd6EjkDEPjs6eiXyn81yAxMRi1Ql?= =?us-ascii?Q?/FPMoufeyno3O1B/qGPWi39MP2aBxm7TMMO/mYge9eK53gVERFV8nBBjHbmr?= =?us-ascii?Q?qLT6fZ+R08KotMEdvM1WKDhgjijYeDf5W0Y56xE9iAVfTJu7RIJ/a6jgJGr2?= =?us-ascii?Q?vVMYdiWgftFvIQ4/BPOImQ/P1cSAVZI1b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Dd0Bjq35t2nMap2IfKfZl3wBkfPEjRRzjn60CHCR2wHvhXFlyQ9U?= =?us-ascii?Q?Xda4rqAVJWpnam2sPugtJ9d8QqKwV4ZAkNDd3X74iOrstlxaxvMv+6nEjDWY?= =?us-ascii?Q?pQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: e95f61a8-1c29-4ef8-2c3a-08dcc8080438 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5578.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 08:53:13.7038 (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: DmtRfQ1UjkFTlKcw24ct2gbY4uJIAiVgSbyMyAPuZO3Xa8pyKigfgHjpPrNoW9nUUd26hCY92utRco1Rk4+DEGTAbx0GLA1qGxe+ySAI0Ac= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB8017 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org The uio_pci_generic driver clears the bus master bit when the device file is closed. So, when the secondary process terminates after probing a device, that device becomes unusable in the primary process. To avoid that, the device file is now opened only in the primary process. The commit that introduced this regression, 847d78fb9530 ("bus/pci: fix FD in secondary process"), only mentioned enabling access to config space from secondary process, which still works, as it doesn't rely on the device file. Fixes: 847d78fb9530 ("bus/pci: fix FD in secondary process") Cc: stable@dpdk.org Signed-off-by: Konrad Sztyber --- drivers/bus/pci/linux/pci_uio.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index 4c1d3327a9..5c4ba8098c 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -232,18 +232,6 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, loc->domain, loc->bus, loc->devid, loc->function); return 1; } - snprintf(devname, sizeof(devname), "/dev/uio%u", uio_num); - - /* save fd */ - fd = open(devname, O_RDWR); - if (fd < 0) { - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); - goto error; - } - - if (rte_intr_fd_set(dev->intr_handle, fd)) - goto error; - snprintf(cfgname, sizeof(cfgname), "/sys/class/uio/uio%u/device/config", uio_num); @@ -273,6 +261,21 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; + /* + * the uio_pci_generic driver clears the bus master enable bit when the device file is + * closed, so open it only in the primary process + */ + snprintf(devname, sizeof(devname), "/dev/uio%u", uio_num); + /* save fd */ + fd = open(devname, O_RDWR); + if (fd < 0) { + PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno)); + goto error; + } + + if (rte_intr_fd_set(dev->intr_handle, fd)) + goto error; + /* allocate the mapping details for secondary processes*/ *uio_res = rte_zmalloc("UIO_RES", sizeof(**uio_res), 0); if (*uio_res == NULL) { -- 2.45.0