From patchwork Sat Feb 1 03:51:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 3564501 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1EFBA9F2E9 for ; Sat, 1 Feb 2014 03:52:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BEA9720263 for ; Sat, 1 Feb 2014 03:51:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13CD720255 for ; Sat, 1 Feb 2014 03:51:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754474AbaBADvv (ORCPT ); Fri, 31 Jan 2014 22:51:51 -0500 Received: from mail-oa0-f41.google.com ([209.85.219.41]:48500 "EHLO mail-oa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754426AbaBADvu (ORCPT ); Fri, 31 Jan 2014 22:51:50 -0500 Received: by mail-oa0-f41.google.com with SMTP id j17so6212975oag.28 for ; Fri, 31 Jan 2014 19:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=gAHbfbCWeRPGhcNUk4XKSsiugjhs49mKJn8toc+x8qg=; b=GYus6mZtsju+xY4y+axAwpoRVk/iNihdAyLEXrKYMMoSKv50ySj4YnSVz8+UyyS+cc 5DcC0AdLnczlx1dr5R8/RUBsM+X5VeBcnSMMVuhG7IjFnP8apddvizaQtnDjp+jTvRUk 3jFotOB3bHC3mxRGiMGYA7zmCGKsSU9qj6/sLV3RRKdaKb67aaUrcb4zYvgINTZmkz32 sYSaSwQN17jNqKoxqyOZxHMpQkN+f5HAkckiR14IA8jdjnA3SO6+jKB+7Z7orpr8dqsj PPefjoAg1uGX+BnT/5CoKcT+HEXiOHJVDx7TfN79A69kl4fe0/R4rWoA1IPTmwGkcRZs HnUw== MIME-Version: 1.0 X-Received: by 10.60.45.206 with SMTP id p14mr19793924oem.21.1391226709938; Fri, 31 Jan 2014 19:51:49 -0800 (PST) Received: by 10.76.153.136 with HTTP; Fri, 31 Jan 2014 19:51:49 -0800 (PST) In-Reply-To: References: <20140130131236.GW18029@intel.com> <1418039.AWHqDGWMFa@vostro.rjw.lan> <20140131123606.GF18029@intel.com> <1426729.BFFFkbZrqa@vostro.rjw.lan> <20140131134925.GI18029@intel.com> Date: Fri, 31 Jan 2014 19:51:49 -0800 X-Google-Sender-Auth: aaDJGG6wdTIKb7mKe9binhD6xE0 Message-ID: Subject: Re: Commit ef83b0781a73f (PCI: Remove from bus_list and release resources in pci_release_dev()) broke TBT hotplug From: Yinghai Lu To: Mika Westerberg Cc: "Rafael J. Wysocki" , "linux-pci@vger.kernel.org" , Bjorn Helgaas , "Rafael J. Wysocki" Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jan 31, 2014 at 7:44 PM, Yinghai Lu wrote: > On Fri, Jan 31, 2014 at 5:49 AM, Mika Westerberg > wrote: >> On Fri, Jan 31, 2014 at 02:49:21PM +0100, Rafael J. Wysocki wrote: >>> > Jan 31 20:05:57 buildroot kern.debug kernel: [ 439.672933] pci_bus 0000:03: busn_res: [bus 03-3a] is released >>> >>> OK, so my guess wasn't right. We seem to call pci_release_dev for all of the >>> devices that go away after unplug. >>> >>> Do I think correctly that the below doesn't happen with the Yinghai's commit >>> reverted? >> >> Yes, with that commit reverted everything works fine. > > can you make it clear ? > > after my commit is reverted, the warning does not happen any more? > > Jan 31 20:06:11 buildroot kern.warn kernel: [ 453.616434] > ------------[ cut here ]------------ > Jan 31 20:06:11 buildroot kern.warn kernel: [ 453.618102] WARNING: > CPU: 1 PID: 956 at lib/kobject.c:244 kobject_add_internal+0x12d/ > 0x400() Hi, Mika, Can you try attached partial reverting? Thanks Yinghai diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 04796c0..dd91116 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1231,10 +1231,6 @@ static void pci_release_dev(struct device *dev) { struct pci_dev *pci_dev = to_pci_dev(dev); - down_write(&pci_bus_sem); - list_del(&pci_dev->bus_list); - up_write(&pci_bus_sem); - pci_free_resources(pci_dev); pci_release_capabilities(pci_dev); diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 4ff36bf..c8264c4 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -25,6 +25,10 @@ static void pci_destroy_dev(struct pci_dev *dev) device_del(&dev->dev); + down_write(&pci_bus_sem); + list_del(&dev->bus_list); + up_write(&pci_bus_sem); + put_device(&dev->dev); }