From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbcD2R2C (ORCPT ); Fri, 29 Apr 2016 13:28:02 -0400 Received: from mail-bn1on0139.outbound.protection.outlook.com ([157.56.110.139]:14592 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751693AbcD2R2A convert rfc822-to-8bit (ORCPT ); Fri, 29 Apr 2016 13:28:00 -0400 X-Greylist: delayed 1924 seconds by postgrey-1.27 at vger.kernel.org; Fri, 29 Apr 2016 13:27:59 EDT From: Jake Oshins To: Vitaly Kuznetsov , "linux-pci@vger.kernel.org" CC: "devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" , KY Srinivasan , Haiyang Zhang , Bjorn Helgaas Subject: RE: [PATCH] PCI: hv: report resources release after stopping the bus Thread-Topic: [PATCH] PCI: hv: report resources release after stopping the bus Thread-Index: AQHRofr/7LOyOBCOzkGVij3I8gEAS5+hK7sQ Date: Fri, 29 Apr 2016 16:55:52 +0000 Message-ID: References: <1461922750-26053-1-git-send-email-vkuznets@redhat.com> In-Reply-To: <1461922750-26053-1-git-send-email-vkuznets@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2001:4898:80e8:5::563] x-ms-office365-filtering-correlation-id: 4850e282-a7d4-4be7-0814-08d3704f1fb4 x-microsoft-exchange-diagnostics: 1;SN2PR03MB1919;5:/0q6mcHyCLiQJMVRfPjW1xiTgCqiHBsUVVNv1thQ04HJoak+w9/fPikoEHtolm3iMbqOr6F0h5J0eW4N/PL70SviN6ytpbcWUjI+cLFmlcvx19iQM3cxIOiW0DbZ3QA2dXm7QecXIe2Nv5ogD3N6wA==;24:8gYv140QsnPMRvZIsa3JLd7UmGINv3X2uUIjQWL/ua7LB6ca2NRVMAxEdKVCBJ24wXfkhspXxvAYcwYmE4siqfWg+0gwjsjAYE7u+cp3wrI=;7:Y7lF+SpmJdz6IfGJ22ajlNDPHZrlbg+bJVsgEDXlAIf9nRzehElTQOyb+H4yNnmrRx/meI0zM0rdF9Ja4CkO07ox7kS1uP+VHwzBDwXQerlldCffswrKRnW9d1uMRojlKX4pp62Rht4vGDgZdjX2DT8WsfwE6ZFBWVcWnURf30A= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN2PR03MB1919; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(9101521072)(61425038)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(61426038)(61427038);SRVR:SN2PR03MB1919;BCL:0;PCL:0;RULEID:;SRVR:SN2PR03MB1919; x-forefront-prvs: 0927AA37C7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(377454003)(13464003)(87936001)(122556002)(5003600100002)(6116002)(102836003)(81166005)(92566002)(586003)(5001770100001)(19580405001)(54356999)(19580395003)(77096005)(1220700001)(50986999)(1096002)(76176999)(2900100001)(86362001)(2950100001)(5002640100001)(74316001)(5004730100002)(76576001)(5005710100001)(86612001)(11100500001)(10400500002)(10290500002)(33656002)(10090500001)(106116001)(189998001)(2501003)(4326007)(5008740100001)(3660700001)(5890100001)(9686002)(3280700002)(2906002)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN2PR03MB1919;H:DM2PR0301MB1232.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Apr 2016 16:55:52.3960 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB1919 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com] > Sent: Friday, April 29, 2016 2:39 AM > To: linux-pci@vger.kernel.org > Cc: devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; KY > Srinivasan ; Haiyang Zhang > ; Bjorn Helgaas ; Jake > Oshins > Subject: [PATCH] PCI: hv: report resources release after stopping the bus > > Kernel hang is observed when pci-hyperv module is release with device > drivers still attached. E.g. when I do 'rmmod pci_hyperv' with BCM5720 > device pass-through-ed (tg3 module) I see the following: > > NMI watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [rmmod:2104] > ... > Call Trace: > [] tg3_read_mem+0x87/0x100 [tg3] > [] ? 0xffffffffa063f000 > [] tg3_poll_fw+0x85/0x150 [tg3] > [] tg3_chip_reset+0x357/0x8c0 [tg3] > [] tg3_halt+0x3b/0x190 [tg3] > [] tg3_stop+0x171/0x230 [tg3] > ... > [] tg3_remove_one+0x90/0x140 [tg3] > [] pci_device_remove+0x39/0xc0 > [] __device_release_driver+0xa1/0x160 > [] device_release_driver+0x23/0x30 > [] pci_stop_bus_device+0x8a/0xa0 > [] pci_stop_root_bus+0x36/0x60 > [] hv_pci_remove+0x238/0x260 [pci_hyperv] > > The problem seems to be that we report local resources release before > stopping the bus and removing devices from it and device drivers may > try to perform some operations with these resources on shutdown. Move > resources release report after we do pci_stop_root_bus(). > > Signed-off-by: Vitaly Kuznetsov Acked-by: Jake Oshins > --- > drivers/pci/host/pci-hyperv.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c > index f2559b6..c17e792 100644 > --- a/drivers/pci/host/pci-hyperv.c > +++ b/drivers/pci/host/pci-hyperv.c > @@ -2268,11 +2268,6 @@ static int hv_pci_remove(struct hv_device *hdev) > > hbus = hv_get_drvdata(hdev); > > - ret = hv_send_resources_released(hdev); > - if (ret) > - dev_err(&hdev->device, > - "Couldn't send resources released packet(s)\n"); > - > memset(&pkt.teardown_packet, 0, sizeof(pkt.teardown_packet)); > init_completion(&comp_pkt.host_event); > pkt.teardown_packet.completion_func = hv_pci_generic_compl; > @@ -2295,6 +2290,11 @@ static int hv_pci_remove(struct hv_device *hdev) > pci_unlock_rescan_remove(); > } > > + ret = hv_send_resources_released(hdev); > + if (ret) > + dev_err(&hdev->device, > + "Couldn't send resources released packet(s)\n"); > + > vmbus_close(hdev->channel); > > /* Delete any children which might still exist. */ > -- > 2.5.5 This looks like the right fix to me. Thanks. -- Jake Oshins