From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130048.outbound.protection.outlook.com [40.107.13.48]) by dpdk.org (Postfix) with ESMTP id 654421B1F9 for ; Tue, 8 Jan 2019 19:50:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CkZd+oqksUlh15zjtFHTlWBrO2iedPljG9dvgw4W5cY=; b=bYXDE1I/Yrjc4YNtjHCzm0lTbEnGDmhMJZejSg7dc//zxbbhGr4KHrB6HzxNnsrP5sw7XX5zk6KlCLKPdXyiUT+YCvViWcKtNXmWBpWi9o1u6SLBb3QHGSGk+QNeDbf5As6tDSQA95jCmwMQABuitApiRxWrOYQa92CD1tWNvdw= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4011.eurprd05.prod.outlook.com (52.134.68.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Tue, 8 Jan 2019 18:50:01 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::d43a:3775:8af7:29c6]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::d43a:3775:8af7:29c6%4]) with mapi id 15.20.1495.011; Tue, 8 Jan 2019 18:50:01 +0000 From: Yongseok Koh To: "Burakov, Anatoly" CC: "Stojaczyk, Dariusz" , Maxime Coquelin , dpdk stable Thread-Topic: [dpdk-stable] patch 'vfio: do not needlessly setup device in secondary process' has been queued to LTS release 17.11.5 Thread-Index: AQHUiDmHROujOx3x/UmVtfzsXfv406WG45sAgB7vsYCAACIrAA== Date: Tue, 8 Jan 2019 18:50:00 +0000 Message-ID: <8E58514F-0E21-4EBD-8800-38D7E9FD59AF@mellanox.com> References: <20181129231202.30436-1-yskoh@mellanox.com> <20181129231202.30436-127-yskoh@mellanox.com> <96077BDF-660B-4817-81AD-05A2C22A73E8@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-originating-ip: [69.181.245.183] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB4011; 6:QLe5k6N2VE+nGUKcuSW2LJA8nLNmmAXlonJ+PNv9PQwSWzBURBP2ZCIdG1mJnRIf6p3+itlrRz4zM5BXNjb5dRm5UfEI6td4TUMda5hJCuf2sCH3swDKWNZWM8DDr5LL9sqnqzAs4SahjNk8VFEIHFLbADkL2AVfgVzbUb2XXcAAfxCUoTd0T1qed96GO1ubPov3rb8PwXGxunonK3VMPO2ZW5vm64JmcsrdThw8IJweqEHQx1wTqCwI6dJneQwx4hAUDPQU/SBupwMBnW8VBS3kTntDfh4Emy635wHGjMVOe2ONKnlVr61ShoYtSaEp55r3sreg3FwTTN1mgKSoBAf19L8w/KJ+rvnnGHre01wEcc7PYJ2inWgrwDboOMxYnoljCJS1QO23cxaWO+iC0D1lMN42NS3VQ8cvh0VC+hUyoi23dHxBLCVa0XbPFTpt2L+j2Z63ftSvFIbggc5pSw==; 5:K7vZ7MeHG8AZp1T6GEolizg3xpfVdlsN9CNZWiVBmoA5wdyKyvKf4xLh6i0Pi8nMO5nA4MbBdunG8sLcLgR0dVSf2t4Olv2ISojEspOWTthP1AOL6I31eQIVkZP2oZBGQ9OmTzASVvUsseyW2rEG7Q+xhKCE82iT+TwelX5CrKpN3iYtbazwOPSiOCS+e1W3cBe3pkgmk0Ljwh+Gp4L/qA==; 7:G+xPMYbptPFCOc+cmXf1YwE1z0RzEtoac4uxuE6hZIh2RuRCj0Q5X7XDLXMaKao8u6h2qaxOn6swcz2PhGAslmU0d44fB3AACR6e2Rh6pGxusJkMioLwo8pPwGpWwVAHQ3uMNgAIgQ8fL00O3t20QA== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: f095f1e9-a9db-41ef-fe3d-08d6759a1829 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB4011; x-ms-traffictypediagnostic: DB3PR0502MB4011: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(93006095)(93001095)(10201501046)(3231475)(944501520)(4982022)(52105112)(3002001)(6055026)(6041310)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:DB3PR0502MB4011; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB4011; x-forefront-prvs: 0911D5CE78 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(396003)(366004)(39860400002)(346002)(28163001)(69234005)(13464003)(199004)(189003)(99286004)(4326008)(66066001)(476003)(25786009)(316002)(82746002)(33656002)(76176011)(6436002)(86362001)(256004)(305945005)(486006)(7736002)(6512007)(2906002)(229853002)(26005)(6506007)(53546011)(6486002)(102836004)(6306002)(5660300001)(966005)(81156014)(6916009)(97736004)(14454004)(68736007)(575784001)(81166006)(478600001)(4001150100001)(8936002)(45080400002)(71190400001)(11346002)(2616005)(83716004)(93886005)(6246003)(186003)(36756003)(53936002)(71200400001)(105586002)(106356001)(3846002)(6116002)(54906003)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4011; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: I4ThFLXLb9zN62v+6qJH8SU/pCd04OYWlDSrmfyqAeD1y45DNHroHbQMoLRC0qO9X4XjhHtPYn0kJGlO27cK+m6PPnAq/JCdyUvai1cc1Em7DTwRsC5vfI7HUCbkh/nzsvmy5qTT3+hNxOw8y/qLJ32I6L3XTpo0oXuzXWgXLu2xdN/8A390mwAwT0IoKVpIuOSE2+5oE8a92u6H7g4XUVXFZYgtmHvvoriKgClrUmaWh52to1RytODn9yA5HNfZ6dFpApq7kQ9kb5RXfConp0/xuVKG85pNtwjBDMr4DU69IgIF+z1x2RLWAjlafw6J spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f095f1e9-a9db-41ef-fe3d-08d6759a1829 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jan 2019 18:50:00.8351 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4011 Subject: Re: [dpdk-stable] patch 'vfio: do not needlessly setup device in secondary process' has been queued to LTS release 17.11.5 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jan 2019 18:50:03 -0000 Hi, The reason is because the upstream patch doesn't have Cc: stable@dpdk.org. Adding the tag is at author's discretion. If a patch doesn't have it, we regard the author doesn't want it to be included in stable releases. We still urge developers to carefully put the tag for bug fixes. In my experience, a fix having the tag sometimes had to be excluded. That is another type of mistake. >>From the next stable release cycle, we will not include such patches which have "fix" keyword or "Fixes:" tag but no Cc:stable tag at first. Instead, we will look into such fixes one by one. And we will ask for author's help if needed. This was the reason for my email and I was waiting for replies. As you say it is needed, it has been re-applied to stable/17.11 Thanks, Yongseok > On Jan 8, 2019, at 8:47 AM, Burakov, Anatoly = wrote: >=20 > Hi, >=20 > What's the reason for "mistakenly" merging this patch? This patch fixes a= real bug. Why revert? >=20 > Thanks, > Anatoly >=20 >=20 >> -----Original Message----- >> From: Yongseok Koh [mailto:yskoh@mellanox.com] >> Sent: Thursday, December 20, 2018 12:22 AM >> To: Stojaczyk, Dariusz >> Cc: Burakov, Anatoly ; Maxime Coquelin >> ; dpdk stable >> Subject: Re: [dpdk-stable] patch 'vfio: do not needlessly setup device i= n >> secondary process' has been queued to LTS release 17.11.5 >>=20 >> Hi, >>=20 >> This patch is being removed from stable/17.11 as it was mistakenly merge= d. >> Patches having 'fix' keyword in the title were merged even though those >> don't have "Cc: stable@dpdk.org" tag in the commit message. >>=20 >> If you think this patch is still needed for stable/17.11, please let me = know. >> Then I'll take it back. >>=20 >>=20 >> Thanks, >> Yongseok >>=20 >>=20 >>> On Nov 29, 2018, at 3:12 PM, Yongseok Koh >> wrote: >>>=20 >>> Hi, >>>=20 >>> FYI, your patch has been queued to LTS release 17.11.5 >>>=20 >>> Note it hasn't been pushed to >> https://emea01.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fdpd >> k.org%2Fbrowse%2Fdpdk- >> stable&data=3D02%7C01%7Cyskoh%40mellanox.com%7C984a5148ee3f4d >> 0911c508d65650a735%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7 >> C636791301732433081&sdata=3DxSYO3rfdcp080xZsdFughJwuHl10CW%2B6 >> njLe8SLNR5o%3D&reserved=3D0 yet. >>> It will be pushed if I get no objections before 12/01/18. So please >>> shout if anyone has objections. >>>=20 >>> Also note that after the patch there's a diff of the upstream commit >>> vs the patch applied to the branch. If the code is different (ie: not >>> only metadata diffs), due for example to a change in context or macro >> names, please double check it. >>>=20 >>> Thanks. >>>=20 >>> Yongseok >>>=20 >>> --- >>> From ff44ba8002e2db8c02eb769d547bfd7659af14e1 Mon Sep 17 00:00:00 >> 2001 >>> From: Darek Stojaczyk >>> Date: Wed, 21 Nov 2018 19:41:32 +0100 >>> Subject: [PATCH] vfio: do not needlessly setup device in secondary >>> process >>>=20 >>> [ upstream commit 047e3f9f2a4a4b73da86b707af8a32039ba1cad7 ] >>>=20 >>> Setting up a device that wasn't setup in the primary process will >>> possibly break the primary process. That's because the IPC message to >>> retrieve the group fd in the primary will also *open* that group if it >>> wasn't opened before. Even though the secondary process closes that fd >>> soon after as a part of its error handling path, the primary process >>> leaks it. >>>=20 >>> What's worse, opening that fd on the primary will increment the >>> process-local counter of opened groups. >>> If it was 0 before, then the group will never be added to the vfio >>> container, nor dpdk memory will be ever mapped. >>>=20 >>> This patch moves the proper error checks earlier in the code to fully >>> prevent setting up devices in secondary processes that weren't setup >>> in the primary process. >>>=20 >>> Fixes: 2f4adfad0a69 ("vfio: add multiprocess support") >>>=20 >>> Signed-off-by: Darek Stojaczyk >>> Acked-by: Anatoly Burakov >>> Reviewed-by: Maxime Coquelin >>> --- >>> drivers/bus/pci/linux/pci_vfio.c | 12 ++++++------ >>> 1 file changed, 6 insertions(+), 6 deletions(-) >>>=20 >>> diff --git a/drivers/bus/pci/linux/pci_vfio.c >>> b/drivers/bus/pci/linux/pci_vfio.c >>> index 745db260c..654897284 100644 >>> --- a/drivers/bus/pci/linux/pci_vfio.c >>> +++ b/drivers/bus/pci/linux/pci_vfio.c >>> @@ -580,11 +580,6 @@ pci_vfio_map_resource_secondary(struct >> rte_pci_device *dev) >>> snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT, >>> loc->domain, loc->bus, loc->devid, loc->function); >>>=20 >>> - ret =3D rte_vfio_setup_device(rte_pci_get_sysfs_path(), pci_addr, >>> - &vfio_dev_fd, &device_info); >>> - if (ret) >>> - return ret; >>> - >>> /* if we're in a secondary process, just find our tailq entry */ >>> TAILQ_FOREACH(vfio_res, vfio_res_list, next) { >>> if (rte_pci_addr_cmp(&vfio_res->pci_addr, >>> @@ -596,9 +591,14 @@ pci_vfio_map_resource_secondary(struct >> rte_pci_device *dev) >>> if (vfio_res =3D=3D NULL) { >>> RTE_LOG(ERR, EAL, " %s cannot find TAILQ entry for PCI >> device!\n", >>> pci_addr); >>> - goto err_vfio_dev_fd; >>> + return -1; >>> } >>>=20 >>> + ret =3D rte_vfio_setup_device(rte_pci_get_sysfs_path(), pci_addr, >>> + &vfio_dev_fd, &device_info); >>> + if (ret) >>> + return ret; >>> + >>> /* map BARs */ >>> maps =3D vfio_res->maps; >>>=20 >>> -- >>> 2.11.0 >>>=20 >>> --- >>> Diff of the applied patch vs upstream commit (please double-check if no= n- >> empty: >>> --- >>> --- - 2018-11-29 15:01:50.745484864 -0800 >>> +++ 0127-vfio-do-not-needlessly-setup-device-in-secondary-pro.patch >> 2018-11-29 15:01:45.335961000 -0800 >>> @@ -1,8 +1,10 @@ >>> -From 047e3f9f2a4a4b73da86b707af8a32039ba1cad7 Mon Sep 17 00:00:00 >>> 2001 >>> +From ff44ba8002e2db8c02eb769d547bfd7659af14e1 Mon Sep 17 00:00:00 >>> +2001 >>> From: Darek Stojaczyk >>> Date: Wed, 21 Nov 2018 19:41:32 +0100 >>> Subject: [PATCH] vfio: do not needlessly setup device in secondary >>> process >>>=20 >>> +[ upstream commit 047e3f9f2a4a4b73da86b707af8a32039ba1cad7 ] >>> + >>> Setting up a device that wasn't setup in the primary process will >>> possibly break the primary process. That's because the IPC message to >>> retrieve the group fd in the @@ -31,10 +33,10 @@ >>> 1 file changed, 6 insertions(+), 6 deletions(-) >>>=20 >>> diff --git a/drivers/bus/pci/linux/pci_vfio.c >>> b/drivers/bus/pci/linux/pci_vfio.c >>> -index ffd26f195..54a4c959e 100644 >>> +index 745db260c..654897284 100644 >>> --- a/drivers/bus/pci/linux/pci_vfio.c >>> +++ b/drivers/bus/pci/linux/pci_vfio.c >>> -@@ -794,11 +794,6 @@ pci_vfio_map_resource_secondary(struct >>> rte_pci_device *dev) >>> +@@ -580,11 +580,6 @@ pci_vfio_map_resource_secondary(struct >>> +rte_pci_device *dev) >>> snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT, >>> loc->domain, loc->bus, loc->devid, loc->function); >>>=20 >>> @@ -46,7 +48,7 @@ >>> /* if we're in a secondary process, just find our tailq entry */ >>> TAILQ_FOREACH(vfio_res, vfio_res_list, next) { >>> if (rte_pci_addr_cmp(&vfio_res->pci_addr, >>> -@@ -810,9 +805,14 @@ pci_vfio_map_resource_secondary(struct >>> rte_pci_device *dev) >>> +@@ -596,9 +591,14 @@ pci_vfio_map_resource_secondary(struct >>> +rte_pci_device *dev) >>> if (vfio_res =3D=3D NULL) { >>> RTE_LOG(ERR, EAL, " %s cannot find TAILQ entry for PCI >> device!\n", >>> pci_addr); >=20