Skip to content
  • Rafael J. Wysocki's avatar
    ACPI / PNP: Reserve ACPI resources at the fs_initcall_sync stage · 0294112e
    Rafael J. Wysocki authored
    This effectively reverts the following three commits:
    
     7bc10388 ACPI / resources: free memory on error in add_region_before()
     0f1b414d ACPI / PNP: Avoid conflicting resource reservations
     b9a5e5e1 ACPI / init: Fix the ordering of acpi_reserve_resources()
    
    (commit b9a5e5e1 introduced regressions some of which, but not
    all, were addressed by commit 0f1b414d and commit 7bc10388
    was a fixup on top of the latter) and causes ACPI fixed hardware
    resources to be reserved at the fs_initcall_sync stage of system
    initialization.
    
    The story is as follows.  First, a boot regression was reported due
    to an apparent resource reservation ordering change after a commit
    that shouldn't lead to such changes.  Investigation led to the
    conclusion that the problem happened because acpi_reserve_resources()
    was executed at the device_initcall() stage of system initialization
    which wasn't strictly ordered with respect to driver initialization
    (and with respect to the initialization of the pcieport driver in
    particular), so a random change causing the device initcalls to be
    run in a different order might break things.
    
    The response to that was to attempt to run acpi_reserve_resources()
    as soon as we knew that ACPI would be in use (commit b9a5e5e1).
    However, that turned out to be too early, because it caused resource
    reservations made by the PNP system driver to fail on at least one
    system and that failure was addressed by commit 0f1b414d.
    
    That fix still turned out to be insufficient, though, because
    calling acpi_reserve_resources() before the fs_initcall stage of
    system initialization caused a boot regression to happen on the
    eCAFE EC-800-H20G/S netbook.  That meant that we only could call
    acpi_reserve_resources() at the fs_initcall initialization stage
    or later, but then we might just as well call it after the PNP
    initalization in which case commit 0f1b414d wouldn't be
    necessary any more.
    
    For this reason, the changes made by commit 0f1b414d are reverted
    (along with a memory leak fixup on top of that commit), the changes
    made by commit b9a5e5e1 that went too far are reverted too and
    acpi_reserve_resources() is changed into fs_initcall_sync, which
    will cause it to be executed after the PNP subsystem initialization
    (which is an fs_initcall) and before device initcalls (including
    the pcieport driver initialization) which should avoid the initial
    issue.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=100581
    Link: http://marc.info/?t=143092384600002&r=1&w=2
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=99831
    Link: http://marc.info/?t=143389402600001&r=1&w=2
    Fixes: b9a5e5e1
    
     "ACPI / init: Fix the ordering of acpi_reserve_resources()"
    Reported-by: default avatarRoland Dreier <roland@purestorage.com>
    Cc: All applicable <stable@vger.kernel.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    0294112e