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 AFDDD4589E; Fri, 30 Aug 2024 05:48:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71E8142E4C; Fri, 30 Aug 2024 05:48:56 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2080.outbound.protection.outlook.com [40.107.220.80]) by mails.dpdk.org (Postfix) with ESMTP id 6A73542E4B; Fri, 30 Aug 2024 05:48:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xbJMVNEPbD0YcFRVWGySy4DwfL0TjgcAyVFzWtq5gn9WGMdLLVuVKIaQP68Po8QYsrgrBpLZsBzuvKdiGw/Sx121S79DbLgqwu7V3liMLY+GBOZbP3XD2NGOidDXivh4hzlPgVsPw6hXYVAbEx4qAVghtHStdTK+h/kfMUJPYM8G4czOXRXkbN8wL357bQwg2XSR3R8MaxizN35G1rI+xBzRUCXjb11yn3HFaUTLZA8eC50CjVUo268JVHLab+SS6rVGcHMmmv9V7pzbHYA7zIBD2gZ5+ZyDULJXgz3y97qYC4OhetRkMPMq/LY8opdloXgZTf4Xme7b/QiyWKO5kg== 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=0PYZ0eogzT/LnwZyHfPaiUN8Aocx0D6L4WFJMsY5J2o=; b=jaU80T7i+H746/WQWT5AR1iIrhcQsEsmJYTfpcLOyIK4A/+1Xhsy/DB/Jq88agow+TsqFCFtEnnMg7nQNGg8uYWWBxxRyL8WYBxAfCXKHkiWcttGiTiUg7thokOmhboIZS+DmISDAt5tpledmlfWRFTyZ4Mlnvu515MPWEQPtV7Kz3bvaPrvCdCndLxId3FMMz/QmDfAtj758+fdC9Qoefu+49f49dQab30+yd/scheE3gDUYQp3R3oof5AlvL4SOnntX6XM5xu1dlvIaecd+GJwVixhEqwVxGiUe20M88+qSKaJgBiDg7C8dbqqiEV0z0nxfqPUnxPh3bRdn7SZVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=0PYZ0eogzT/LnwZyHfPaiUN8Aocx0D6L4WFJMsY5J2o=; b=sr/2Wtohe0YirH4zDlUDuK+tAl4NEPtGJ7RE/8QpkXuR0LbKaqOhaAjvM2jTVDJqQzAZALs0VZesb8q+06h1HFqqwiIZ+6dCEy3lddsCJFm1a02f0glZMPd9HBTragSMQybO6O32SgOp2ye/6g8Pyj5NeoIYvPBQ7FnKWo5wMa+xgPbFLBjZlumDlibVIyq3T+jyrEBrqAcOHicYDOMMFYaAUg2wLWmzElNHxaYTqD6YbWDSOiTtVcvHcSeA5sU8zZ07UD7j62NKdz8Pdty/DaxHJ/J2C9mla8mXxBBckZnWyCwwy5gCIdNK8S38vNJBxVNThzcFlrsdYu9rWCmp4w== Received: from IA0PR12MB8983.namprd12.prod.outlook.com (2603:10b6:208:490::17) by MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.20; Fri, 30 Aug 2024 03:48:51 +0000 Received: from IA0PR12MB8983.namprd12.prod.outlook.com ([fe80::68e7:8370:b169:fa0e]) by IA0PR12MB8983.namprd12.prod.outlook.com ([fe80::68e7:8370:b169:fa0e%6]) with mapi id 15.20.7918.019; Fri, 30 Aug 2024 03:48:51 +0000 From: Chenbo Xia To: Konrad Sztyber CC: "dev@dpdk.org" , Chaoyong He , "stable@dpdk.org" , Nipun Gupta , Zerun Fu , Anatoly Burakov , Peng Zhang , Long Wu Subject: Re: [PATCH v2] bus/pci: don't open uio device in secondary process Thread-Topic: [PATCH v2] bus/pci: don't open uio device in secondary process Thread-Index: AQHa+fGXRO/ZcK5iNk6b2l5Jv8jgAbI/KuqA Date: Fri, 30 Aug 2024 03:48:51 +0000 Message-ID: References: <20240828104002.226704-1-konrad.sztyber@intel.com> <20240829085724.270041-1-konrad.sztyber@intel.com> In-Reply-To: <20240829085724.270041-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=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: IA0PR12MB8983:EE_|MN2PR12MB4373:EE_ x-ms-office365-filtering-correlation-id: ff858ae8-c5dd-46ba-32a8-08dcc8a6a96b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?6ShXoSFcYaqDbncgaPEVX9IL/PyebjGK4ABT8Bm+c2afrL/aDflg+itccZa7?= =?us-ascii?Q?JaCzO2dPYBVeEc2d0PXtVM9GUcsvsRGfnh/h5MZ6YKkHmhQqe2Ciqq6RBOLO?= =?us-ascii?Q?fo464p7p9LIa08lkwwmzx0FNvOpX5jDU3ja335FbBudmeYmNCztI3mjlKBUB?= =?us-ascii?Q?CaigVkCry2A1+HNwTGBhD19rmrsWmoy+cnfoBjnNRGDo11T6S0TUgzk4UVqX?= =?us-ascii?Q?4yLo43YrI+9YV5L9kVr3uC4HmZkfQA1k9MYoYLNP+efzv6tPoRC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UbJK5EedlEHgvIx29l3J4AzoTxonv/Cjvy0Ev65iypo?= =?us-ascii?Q?DtiK9barBhgwduVOTJIop+JSuPoL3A9TnR29ydNIBFfh+AfsWvbhjybZlXdN?= =?us-ascii?Q?NKwxQQBHYeOD8DOvWGhcCsR6qAyoDqB1nv80PvjlJCiGso1A6R3yIwhesK4J?= =?us-ascii?Q?4gS6X7/fVWCBD9Q9gOfjG/0dryxu1ttVTRoyVljDiuG5cHX2fSgQknguKw84?= =?us-ascii?Q?hCEOaS3lMrPeW+TLWSPKwKgEEYHJbHExBuxB62l7w0n5arEHhw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:IA0PR12MB8983.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ihqoVZ+8e2RYOPuFDkxMOe2YjSLaAnzJQ412UIv+3cAI9V+BpXmAhBplu+KC?= =?us-ascii?Q?S+x7DCJ6M43ny98dgBf0fmdvWPIQ+qyQY9Bg0UBbr+vmLcGK7e17AH968PI5?= =?us-ascii?Q?bl9bsjAwqDCbHHTY9+h8SH70NWb9R8wNlKHGDTZWA6NZzpYCK1eB5KLbkUYK?= =?us-ascii?Q?Q3wp2jnJrAX506EQ2CkV89qpPrrjzAbQOFfs2NySQYWecDRw305hsyuSxzL2?= =?us-ascii?Q?41ZNjL2bYwC3U/dk9FJq8UglK+RMSVKtMshT62Dvim2WQazXxeqLrDhw9qkj?= =?us-ascii?Q?a9imZJj2Q7AxaFCoqGnePCF9iC5lg+rQXmuWak4BO4V46hmV+rs4r88Ip1Yk?= =?us-ascii?Q?w7J4jfxsZosXOyfWLjQ/OLA95KQKJjHlVgzwQ8qY+LlkmZ6WEIFoEjx/ELPl?= =?us-ascii?Q?ui3Tz9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nTE0tq6jY1FBJIklMGDEJdLYfo?= =?us-ascii?Q?GuluF4GlhtWGNjihJZtLUFCwM6C3HdQgSnzyv2uewPpQhXBUn2no3nzY+zSX?= =?us-ascii?Q?8wS7U54Kg9AKmzD/mKIjbI4VIWwr8yDDPSv1m8pQwVgYB51kHeBnOKj1Hn6k?= =?us-ascii?Q?PcsdgLSOB2wN1kla3rw4Bv6sfbv2pOWTQLvlwpLUeWw72n3GJGBT/2nX2/mC?= =?us-ascii?Q?lZl53hLg9Mu0qRwvtM/bMnUYEylH5emPIzxuvSqrj63XrpxpOIrF0kgTxavl?= =?us-ascii?Q?gxvNkTtT5qdiN5HGhp27W2lzwJdiSOaofo30VQXbwCyCwj0sF1vi5eSON0W8?= =?us-ascii?Q?KA=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-ID: <85C2B920472FB247A63D4FAE3917727E@namprd12.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: IA0PR12MB8983.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff858ae8-c5dd-46ba-32a8-08dcc8a6a96b X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Aug 2024 03:48:51.2189 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0YeFxjCTP33Bu6EZG1BvIgm7B+rFke7Pw9HMAK6fvlkCfJBJefyr3F/124TfRCIcsC9saFfgN/YbjiGR819m2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4373 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 Aug 29, 2024, at 16:57, Konrad Sztyber wrot= e: >=20 > External email: Use caution opening links or attachments >=20 >=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, 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. >=20 > Fixes: 847d78fb9530 ("bus/pci: fix FD in secondary process") > Cc: stable@dpdk.org >=20 > Signed-off-by: Konrad Sztyber > --- > drivers/bus/pci/linux/pci_uio.c | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) >=20 > 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 =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,21 @@ 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 >=20 Reviewed-by: Chenbo Xia