Bug 76901 - ExpressCard hot-remove and hot-add not recognized by acpiphp
Summary: ExpressCard hot-remove and hot-add not recognized by acpiphp
Status: CLOSED PATCH_ALREADY_AVAILABLE
Alias: None
Product: ACPI
Classification: Unclassified
Component: Config-Hotplug (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Rafael J. Wysocki
URL: http://marc.info/?l=linux-pci&m=14007...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-26 03:16 UTC by Gavin Guo
Modified: 2015-07-21 19:33 UTC (History)
8 users (show)

See Also:
Kernel Version: 3.15-rc5
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
dmesg.log (99.31 KB, text/x-log)
2014-05-26 03:18 UTC, Gavin Guo
Details
The process of git-bisect for finding the first commit crashing the acpi hot-plugging. (2.76 KB, text/x-log)
2014-06-05 11:50 UTC, Gavin Guo
Details
Some debug to acpiphp (882 bytes, patch)
2014-06-06 08:14 UTC, Mika Westerberg
Details | Diff
dmesg with debug messages added (93.97 KB, text/x-log)
2014-06-07 23:50 UTC, Gavin Guo
Details
ACPI / hotplug / PCI: Add hotplug contexts to PCI host bridges (3.06 KB, patch)
2014-06-09 20:33 UTC, Rafael J. Wysocki
Details | Diff
dmesg of the acpiphp-debug-root-bridge-hotplug.patch (221.75 KB, text/x-log)
2014-06-10 02:21 UTC, Gavin Guo
Details
ACPI / hotplug / PCI: Add hotplug contexts to PCI host bridges (3.75 KB, patch)
2014-06-10 10:32 UTC, Rafael J. Wysocki
Details | Diff

Description Gavin Guo 2014-05-26 03:16:25 UTC
I found that the bug is a regression of the https://bugzilla.kernel.org/show_bug.cgi?id=57961 and reported that bug in http://marc.info/?l=linux-pci&m=140071437301666.
Comment 1 Gavin Guo 2014-05-26 03:18:00 UTC
Created attachment 137351 [details]
dmesg.log
Comment 2 Bjorn Helgaas 2014-06-03 23:14:56 UTC
Reassigning to ACPI/Config-hotplug, let me know if that's wrong.
Comment 3 Gavin Guo 2014-06-05 11:50:14 UTC
Created attachment 138231 [details]
The process of git-bisect for finding the first commit crashing the acpi hot-plugging.
Comment 4 Gavin Guo 2014-06-05 11:50:44 UTC
I've completed the bisect and found 2d8b1d566a5f4874f4d92361f5cdbb50baa396f8 is the first bad commit. The "git bisect log" is also attached.

commit 2d8b1d566a5f4874f4d92361f5cdbb50baa396f8
Author: Mika Westerberg <mika.westerberg@linux.intel.com>
Date: Sat Jul 13 20:09:59 2013 +0300

    ACPI / hotplug / PCI: Get rid of check_sub_bridges()

    Now that acpiphp_check_bridge() always enumerates devices behind the
    bridge, there is no need to do that for each sub-bridge anymore like
    it is done in the current ACPI-based PCI hotplug (ACPIPHP) code.

    Given this we don't need check_sub_bridges() anymore, so drop that
    function completely.

    This also simplifies the ACPIPHP code a bit.

    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

:040000 040000 1f3f81404e06c92c01d6848ed7a6c5bffdb5f878 4e7ca3e4af42738f90555640cafbb6e6522ceedf M drivers
Comment 5 Mika Westerberg 2014-06-05 13:43:43 UTC
Gavin, can you attach acpidump of the machine (or copy of /sys/firmware/acpi/tables/DSDT) as well?
Comment 6 Mika Westerberg 2014-06-05 14:57:35 UTC
Also can you reproduce this with CONFIG_DYNAMIC_DEBUG=y and "acpiphp.dyndbg=+p" in the kernel command line and attach the dmesg, so that we can see a bit more what is happening there. Thanks.
Comment 7 Mika Westerberg 2014-06-06 08:14:10 UTC
Created attachment 138361 [details]
Some debug to acpiphp

I attached a patch that logs a bit more, can you apply this and post the resulting dmesg?

Since you are seeing BUS_CHECK events only to the host bridge, I'm suspecting that we are not calling acpiphp_check_bridge() for that.
Comment 8 Gavin Guo 2014-06-07 23:49:33 UTC
The log is attached. 

How I tested the card:
Booting up without the card plugged then, plug and unplug twice.
Comment 9 Gavin Guo 2014-06-07 23:50:42 UTC
Created attachment 138471 [details]
dmesg with debug messages added
Comment 10 Mika Westerberg 2014-06-09 14:09:34 UTC
OK, so it looks like acpiphp_check_bridge() is never called for the host bridge and acpiphp_check_host_bridge() never does anything (since acpiphp_dev_to_bridge() returns NULL for host bridge).

Rafael, do you remember why we deal host bridges differently here? Shouldn't we enumerate everything behind the bridge if we get BUS_CHECK event even for the host bridge?
Comment 11 Rafael J. Wysocki 2014-06-09 17:55:58 UTC
This is a bug in acpiphp_check_host_bridge().
Comment 12 Rafael J. Wysocki 2014-06-09 20:23:27 UTC
Or rather in acpiphp_enumerate_slots().
Comment 13 Rafael J. Wysocki 2014-06-09 20:33:56 UTC
Created attachment 138651 [details]
ACPI / hotplug / PCI: Add hotplug contexts to PCI host bridges

Gavin, can you please try this patch (untested so far)?
Comment 14 Gavin Guo 2014-06-10 02:19:21 UTC
Rafael,

I've tested the patch it works fine on v3.15. The dmesg is also attached for your reference.

How I tested the patch:

Booting up with the PCI express card attached, then tested the hot-plug 3 times.
Comment 15 Gavin Guo 2014-06-10 02:21:01 UTC
Created attachment 138691 [details]
dmesg of the acpiphp-debug-root-bridge-hotplug.patch
Comment 16 Mika Westerberg 2014-06-10 09:39:46 UTC
Thanks Rafael for the quick fix!
Comment 17 Rafael J. Wysocki 2014-06-10 10:32:41 UTC
Created attachment 138851 [details]
ACPI / hotplug / PCI: Add hotplug contexts to PCI host bridges

Great, thanks for testing!

Can you also test this somewhat cleaner patch, please?
Comment 18 Gavin Guo 2014-06-10 13:46:37 UTC
Rafael & Mika,

I've tested the new cleaner patch, and it works fine. :-)

How I tested the patch:

Booting up with the PCI express card attached, then tested the hot-plug 3 times.
Comment 19 Rafael J. Wysocki 2014-06-10 14:05:46 UTC
Awesome, thanks!

I'm going to submit it to the mailing lists for inclusion into 3.16-rc.
Comment 20 Rafael J. Wysocki 2014-06-11 19:41:21 UTC
Patch: https://patchwork.kernel.org/patch/4332001/
Comment 21 Len Brown 2015-07-21 19:33:14 UTC
in Linux-3.16-rc1:

commit 882d18a702c66404fcb62b84748f719f9b47441c
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Tue Jun 10 22:46:35 2014 +0200

    ACPI / hotplug / PCI: Add hotplug contexts to PCI host bridges

Note You need to log in before you can comment on or make changes to this bug.