Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754444AbcKJHbp (ORCPT ); Thu, 10 Nov 2016 02:31:45 -0500 Received: from mail-dm3nam03on0109.outbound.protection.outlook.com ([104.47.41.109]:59904 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753532AbcKJHbo (ORCPT ); Thu, 10 Nov 2016 02:31:44 -0500 X-Greylist: delayed 707 seconds by postgrey-1.27 at vger.kernel.org; Thu, 10 Nov 2016 02:31:44 EST From: Dexuan Cui To: Bjorn Helgaas , "linux-pci@vger.kernel.org" , "devel@linuxdriverproject.org" CC: "gregkh@linuxfoundation.org" , KY Srinivasan , Haiyang Zhang , "Stephen Hemminger" , Jake Oshins , "Hadden Hoppert" , Vitaly Kuznetsov , "jasowang@redhat.com" , "apw@canonical.com" , "olaf@aepfle.de" , "linux-kernel@vger.kernel.org" Subject: [PATCH 0/3] PCI: hv: clean-up and 2 fixes to the hot-remove case Thread-Topic: [PATCH 0/3] PCI: hv: clean-up and 2 fixes to the hot-remove case Thread-Index: AdI7Ikv59a/qvf2QR6ixj6Z7HlniIg== Date: Thu, 10 Nov 2016 07:16:22 +0000 Message-ID: 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=decui@microsoft.com; x-originating-ip: [2404:f801:9000:19::66c] x-ms-office365-filtering-correlation-id: 15bde7f0-3cd7-4c37-9870-08d4093979a3 x-microsoft-exchange-diagnostics: 1;MWHPR03MB2495;7:uO8nOLW9A87E0yBTnp/SeePlx1+WOJURXin4fRBeXZ3ZlI/J5fU3/X5Td6i4wCGfDwkXzJluy2f5BZB1GBxC03Ze5LdKseyKwCBq68bvpwBPz+rwfQxLvjVkv6HdxFjI9znXJG7okDAzmMc7z5AXV0V74JI8mYKGlFP2DmTADmyDWDmUIqUVoPHcy6Iw9d5UpNPUkq4rIGoU5FBDNMoQlFezWo+l4nC+CkUyIilnot1r3dznV3zW9KuFPy/uKkWQiQm2fsIGi0vMUNdntlM7XqNF/jtKV5mX05hrYyLUE3iXDaXKXlQVraDeYb8V7zn6x0NkUZ7JHRyWiWtJvnoGC7Npo5V8yfSpFvt1j8khx06O1PGcCO0pcMq6wOIip1Yq x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:MWHPR03MB2495; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6045074)(6060229)(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(61426038)(61427038)(6046074)(6061226);SRVR:MWHPR03MB2495;BCL:0;PCL:0;RULEID:;SRVR:MWHPR03MB2495; x-forefront-prvs: 01221E3973 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(189002)(199003)(33656002)(77096005)(86612001)(2501003)(9686002)(92566002)(2900100001)(8936002)(7736002)(74316002)(2906002)(6116002)(101416001)(8990500004)(586003)(102836003)(10090500001)(50986999)(76576001)(99286002)(10290500002)(5005710100001)(54356999)(105586002)(106356001)(4326007)(305945005)(5001770100001)(97736004)(3660700001)(5660300001)(87936001)(7846002)(7696004)(122556002)(2201001)(189998001)(68736007)(86362001)(3280700002)(8676002)(81166006)(81156014);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR03MB2495;H:MWHPR03MB2669.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2016 07:16:22.2741 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2495 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uAA7Vrik021435 Content-Length: 967 Lines: 25 PATCH 1 is just a clean-up. There should be no functional change. PATCH 2 and 3 are for device hot-remove case. Currently the driver will stop working or even cause panic, if we do hot add/remove quickly a few times. With the 2 patches, everything works reliably in my tests now. There can be still a potential issue with hot-remove when we unload the driver at the same time. That would require more work of proper synchronization among the 3 paths: the .probe/.remove, the channel callback, and the offloaded hv_pci_devices_present()/hv_eject_device_work(). But for now, PATCH 2 and 3 do improve the situation a lot. Dexuan Cui (3): PCI: hv: use the correct buffer size in new_pcichild_device() PCI: hv: fix hv_pci_remove() for hot-remove PCI: hv: delete the device earlier from hbus->children for hot-remove drivers/pci/host/pci-hyperv.c | 67 ++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 27 deletions(-) -- 2.7.4