linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Yinghai Lu <yinghai@kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: Commit ef83b0781a73f (PCI: Remove from bus_list and release resources in pci_release_dev()) broke TBT hotplug
Date: Fri, 31 Jan 2014 12:53:01 +0200	[thread overview]
Message-ID: <20140131105301.GD18029@intel.com> (raw)
In-Reply-To: <2622847.3aWjiMW5oK@vostro.rjw.lan>

On Fri, Jan 31, 2014 at 01:38:42AM +0100, Rafael J. Wysocki wrote:
> On Friday, January 31, 2014 12:59:06 AM Rafael J. Wysocki wrote:
> > On Thursday, January 30, 2014 03:39:02 PM Yinghai Lu wrote:
> > > On Thu, Jan 30, 2014 at 3:39 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > > > On Thursday, January 30, 2014 08:56:05 AM Yinghai Lu wrote:
> > > >>
> > > >> --047d7b5d2ea4eb937804f132eedf
> > > >> Content-Type: text/plain; charset=ISO-8859-1
> > > >>
> > > >> >> The latest mainline kernel "hangs" when Thunderbolt devices are
> > > >> >> hot-unplugged to the system. I can't see any oops but after hot-unplug I'm
> > > >> >> getting huge amounts of messages like:
> > > >> >>
> > > >> >> [  352.717001] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717011] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717021] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717032] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717041] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717051] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717061] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717070] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717083] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717094] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717104] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717113] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717124] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717133] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717143] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717153] pci 0000:02:00.0: PME# disabled
> > > >> >> [  352.717162] pci 0000:02:00.0: PME# disabled
> > > >> >
> > > >> > that mean pci_stop_dev() get called again and again ?
> > > >>
> > > >> please check if attached patch could help.
> > > >
> > > > Well, it looks like what happens is an endless loop in
> > > > acpiphp_glue.c:disable_slot().
> > > >
> > > > dev_in_slot() returns the first device in the list, so
> > > > pci_stop_and_remove_bus_device() is called for it, but it
> > > > doesn't remove the device from bus->devices any more, so
> > > > dev_in_slot() will return the same device next time and
> > > > so on forever.
> > > >
> > > ...
> > > >
> > > > So the above won't help in my opinion.
> > > >
> > > > I wonder, however, if this patch helps instead:
> > > >
> > > > https://patchwork.kernel.org/patch/3540701/
> > > >
> > > > I thought it would be 3.15 material, but it very well can go in earlier if
> > > > it happens to address this particular problem.
> > > 
> > > Agree, that should fix the problem.
> > > 
> > > but please use list_for_each_entry_safe_reverse
> > > instead.
> > 
> > OK, I will.
> 
> Mika, below is an updated patch to try.
> 
> ---
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Subject: ACPI / hotplug / PCI: Simplify disable_slot()
> 
> After recent PCI core changes related to the rescan/remove locking,
> the ACPIPHP's disable_slot() function is only called under the
> general PCI rescan/remove lock, so it doesn't have to use
> dev_in_slot() any more to avoid race conditions.  Make it simply
> walk the devices on the bus and drop the ones in the slot being
> disabled and drop dev_in_slot() which has no more users.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Thanks for the fix.

Unfortunately, it now crashes here after I re-plug the TBT chain (I have
both of your patches applied):

int sysfs_create_bin_file(struct kobject *kobj,
                          const struct bin_attribute *attr)
{
	BUG_ON(!kobj || !kobj->sd || !attr); <--

Since I don't have proper serial console to that machine, all I see is the
end of the backtrace :-(

Here is a hand copied backtrace from the screen:

pci_create_sysfs_dev_files()
pci_bus_add_device()
pci_bus_add_devices()
enable_slot()
acpiphp_check_bridge()
hotplug_event()
...

  parent reply	other threads:[~2014-01-31 10:45 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30 13:12 Commit ef83b0781a73f (PCI: Remove from bus_list and release resources in pci_release_dev()) broke TBT hotplug Mika Westerberg
2014-01-30 16:48 ` Yinghai Lu
2014-01-30 16:56   ` Yinghai Lu
2014-01-30 23:39     ` Rafael J. Wysocki
2014-01-30 23:39       ` Yinghai Lu
2014-01-30 23:59         ` Rafael J. Wysocki
2014-01-31  0:38           ` Rafael J. Wysocki
2014-01-31  1:39             ` Yinghai Lu
2014-01-31 10:53             ` Mika Westerberg [this message]
2014-01-31 11:52               ` Rafael J. Wysocki
2014-01-31 12:36                 ` Mika Westerberg
2014-01-31 13:49                   ` Rafael J. Wysocki
2014-01-31 13:49                     ` Mika Westerberg
2014-01-31 16:41                       ` Mika Westerberg
2014-02-01  3:44                       ` Yinghai Lu
2014-02-01  3:51                         ` Yinghai Lu
2014-02-01 14:35                           ` Rafael J. Wysocki
2014-01-31 14:05                     ` Rafael J. Wysocki
2014-01-31  0:39         ` Rafael J. Wysocki
2014-01-31  1:04           ` Rafael J. Wysocki
2014-01-31  1:38           ` Yinghai Lu
2014-01-30 23:58       ` Rafael J. Wysocki
2014-01-31 23:34 ` [PATCH] Revert "PCI: Remove from bus_list and release resources in pci_release_dev()" Rafael J. Wysocki
2014-02-01  1:56   ` Yinghai Lu
2014-02-01 14:38     ` Rafael J. Wysocki
2014-02-01 18:23       ` Linus Torvalds
2014-02-01 18:48       ` Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140131105301.GD18029@intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).