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 284E845891; Thu, 29 Aug 2024 07:53:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1BC5427AC; Thu, 29 Aug 2024 07:53:11 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2115.outbound.protection.outlook.com [40.107.95.115]) by mails.dpdk.org (Postfix) with ESMTP id 4D8DD402BE for ; Thu, 29 Aug 2024 07:53:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L75CnpLLkzlWCh9CXFjKthaEZBWaDQylMPE4Ed0EK6LpIyCUp5byZT2hFyp5jI+3pdcNlvzOKTJy17Ph5hHF6lTDkEgoTvBUbwRvFXownGHIaEYY0kRaQyZVLhrfmTUX+bfCX55Lny8Xi/9IptgOMyl1sXdh0FkSyU3yMgzKUoAFsPeDaxwkaEEInv8AtS+ZE21+2tByRc91rmyRba/UUIgoI4XdZUQp83HcbkloYc7DiUgoRwvixGKzXQtys67VUgVtgvu/L2hCZj1dADbjfNXesg4Zy/zJVF7UeSoBEj2JlfDgFEzX9/7VoEae9/LzwBxt+ls2m4SvCVz6Vm4G1Q== 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=PiqpjTwerLTe9S8RndXZmTYMniktt3m2MwfmQVzcIB0=; b=M9yc2aPoQqdZ4uVIoc1AWPONuUOuR+F0AZ6NH3lb32p1lth/uPXBIkSF6TED7HBRlJoWx03sgWSewtyEbZtGLt29SGHoFgo6T+i9CxBMKURNIOcTVaK3fm6QAngW5KIf0C7iJALJDq/9sfNc98xfpgBPB1pjzLVTXsHzGw8jYnHJymnnlT64+IeZQMzSLw28cta5X3j4yAedWI0l50HuzHbPtWpBnBh1QUWzvDiIZw2oD0QeSLvdC9wLgSnS/yIwNrVraJo0LF+PEJpsabxhTyRz01rJHY+TuRrj9dDv4DeY4BQpOrkkPM4lO1XPYGbtI2wRBqPS1++gkoLLFzZywA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PiqpjTwerLTe9S8RndXZmTYMniktt3m2MwfmQVzcIB0=; b=IFLhxWMm3EsUKSjb6cOFdvbAcBB+LUdMhteJU+Ob+HGrhIAtnDvHSJO86I3diTIJaJCs1r9iI6ZV6q7x0MYtRSZlNOasUM6A856nQ31vnJGtHxoVZgogaTByReolQsvsjatLD//ENoEKj9YUQzd3VUkixI79BGYVDQRah7t1KAM= Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by IA3PR13MB6952.namprd13.prod.outlook.com (2603:10b6:208:534::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Thu, 29 Aug 2024 05:53:06 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7897.021; Thu, 29 Aug 2024 05:53:06 +0000 From: Chaoyong He To: Konrad Sztyber , "dev@dpdk.org" CC: Chenbo Xia , Nipun Gupta , Long Wu , Zerun Fu Subject: RE: [PATCH] bus/pci: don't open uio device in secondary process Thread-Topic: [PATCH] bus/pci: don't open uio device in secondary process Thread-Index: AQHa+TaxDWTOEfzgL0ebIXoQ8WYID7I9u8Kg Date: Thu, 29 Aug 2024 05:53:05 +0000 Message-ID: References: <20240828104002.226704-1-konrad.sztyber@intel.com> In-Reply-To: <20240828104002.226704-1-konrad.sztyber@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR13MB5545:EE_|IA3PR13MB6952:EE_ x-ms-office365-filtering-correlation-id: bea4d557-f159-4467-d43f-08dcc7eeda69 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?i6unJWC9AXxy1VCwV5DKd8slMmeFhnKO2uK8BwLBtVV6h+lK/jLfEziKTll5?= =?us-ascii?Q?EQ3G9M4lFnbQD1q60yHCN5k530eN1qXgw0x4+JMMIQYXSijqlr/I4y3pzc1+?= =?us-ascii?Q?CeeYxn9mMsvIWPDge3acb1m7st9E9JSkvI0PZSkHmKBpE5dvqvEBnzdAfIC3?= =?us-ascii?Q?5e8piwDwKCf76FeNDNxNeQ+cqoU8oabTmGeHRqTiyzHS2YA6Tsw0dPFGJsLv?= =?us-ascii?Q?s7N5/6kOhFgZ+nyO7OUVVrteH2LfI0C8tkzwlAIWcOmXzZHNLEzf5Nap+0f8?= =?us-ascii?Q?F58nXS9TbiZL8tMYVOgkddl6UMNiYFUJ8g6Itv0akII7FJv3FibLU8SFC7qB?= =?us-ascii?Q?iQekxZK4DaQqZ/6mxKb2qnbg1lnyoVlgu0m23w/8D7JIfNXKfWepzFCfaEoh?= =?us-ascii?Q?DZlCN8aIZZNTY77DcL7spMkLC8PAQhJJfAirGfGW0M/7/haxjw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1dBrTBrD8NKRg+o1BZVNS2fCjdgafZe?= =?us-ascii?Q?XjgHS8ctXblaopQXB98jheXmIScQy6uH9udPoVsZ2fQs7/30+g=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?JfF4XSD8Mu8O2mHac7zK3XOYvkzXR7jSmBa5yXq8ECXMy9sahY/m2gXA1+CF?= =?us-ascii?Q?h9i96sD8gI+TZjMtYOMAPxlUm6577zuf8gcwK7E4nqf52Mzij6M1hEnpL0wX?= =?us-ascii?Q?/F/pbhHcMBw+mhnLjh9/m/F4p7HElkLMcxzU7ILvkHykD9ZNPzWC66e7404h?= =?us-ascii?Q?RcyyH5w8q5R0VpJaxukobKOOZsDyvsR8e+IQ2+3obP7q7oFuxy3+NLugKQWV?= =?us-ascii?Q?WLH7EB7xkW2x49p/qMuoFT2YvnrffqcSl3Hy3bIpMJ4C73kemYyuch2Wx3tH?= =?us-ascii?Q?ibWAle2JcAn5GP4TrrWNsV04J2B7M/RublrI48LHpRMpUCHSHxO1nQCSzEpU?= =?us-ascii?Q?3A3CBBbg6MpGZnnVHC6CsCLsaLLjDwWUxOjVNuC4u8+kO90hPkspNuZuypeF?= =?us-ascii?Q?+qDBlGf8TQDNiJre4eq9/7ryNjjz3a0irwJhavIkXSWUIgI6U8KKkfj2fWG7?= =?us-ascii?Q?VzN9CFAcJQIFOTfVkdmpTTwhCnjEhjMUFH8bENLEzJ/zhONI/Bdw0jBrHoAF?= =?us-ascii?Q?a1grBjKISdKEw9SVMifns04hWDm4LoSJJ24D6Bw3aFW9KLzsrhqzcCdLIx5f?= =?us-ascii?Q?tXqYQZZe1jwPBHVPjr8g4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ii?Q?4NLD9WNHGrTRHTZxtBjVt1gS5tbF+g0sB56ezoTOFmId8C7NQzsOYmCK9fCK?= =?us-ascii?Q?DYv2yurplWEVyZfNREqn6n7+50FV4AlnD8y/OW1m?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bea4d557-f159-4467-d43f-08dcc7eeda69 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2024 05:53:06.0161 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CRHqN6H0LxFoMH4W2qrVnl4tHLSLBKA6YxbqizjnXGTSjuMgEmEqqVCFAe/OQrqJGHh214pcumam5O2QfY7GVL9MnwZf8bai0XZnwlDWJyQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR13MB6952 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 >=20 > 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. >=20 > To avoid that, the device file is now opened only in the primary process.= The > commit that introduced this regression, 847d78fb95 > ("bus/pci: fix FD in secondary process"), only mentioned enabling access = to > config space from secondary process, which still works, as it doesn't rel= y on > the device file. Yes, we can still access the config space from secondary process. >=20 > Fixes: 847d78fb95 ("bus/pci: fix FD in secondary process") Maybe here also need a 'Cc: stable@dpdk.org' ? With this, It looks good to me, thanks. Acked-by: Chaoyong He >=20 > Signed-off-by: Konrad Sztyber > --- > drivers/bus/pci/linux/pci_uio.c | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_= uio.c > index 4c1d3327a9..432316afcc 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 =3D open(devname, O_RDWR); > - if (fd < 0) { > - PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errn= o)); > - 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); >=20 > @@ -273,6 +261,19 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, > if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) > return 0; >=20 > + /* the uio_pci_generic driver clears the bus master enable bit wh= en 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 =3D open(devname, O_RDWR); > + if (fd < 0) { > + PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errn= o)); > + goto error; > + } > + > + if (rte_intr_fd_set(dev->intr_handle, fd)) > + goto error; > + > /* allocate the mapping details for secondary processes*/ > *uio_res =3D rte_zmalloc("UIO_RES", sizeof(**uio_res), 0); > if (*uio_res =3D=3D NULL) { > -- > 2.45.0