]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
ACPI / drivers: replace acpi_probe_lock spinlock with mutex
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tue, 16 Aug 2016 15:59:53 +0000 (16:59 +0100)
committerKamal Mostafa <kamal@canonical.com>
Thu, 15 Sep 2016 16:34:46 +0000 (09:34 -0700)
commit08de7d974e1b4f2e4b3e67c5115b7e9c19c96298
treeecfa35575da32ad69ff615d748e8d17802b3a3b9
parent7e2693fefc14ee6e84d0726a46160c771285cdbe
ACPI / drivers: replace acpi_probe_lock spinlock with mutex

BugLink: http://bugs.launchpad.net/bugs/1621113
commit 5331d9cab32ef640b4cd38a43b0858874fbb7168 upstream.

Commit e647b532275b ("ACPI: Add early device probing infrastructure")
introduced code that allows inserting driver specific
struct acpi_probe_entry probe entries into ACPI linker sections
(one per-subsystem, eg irqchip, clocksource) that are then walked
to retrieve the data and function hooks required to probe the
respective kernel components.

Probing for all entries in a section is triggered through
the __acpi_probe_device_table() function, that in turn, according
to the table ID a given probe entry reports parses the table
with the function retrieved from the respective section structures
(ie struct acpi_probe_entry). Owing to the current ACPI table
parsing implementation, the __acpi_probe_device_table() function
has to share global variables with the acpi_match_madt() function, so
in order to guarantee mutual exclusion locking is required
between the two functions.

Current kernel code implements the locking through the acpi_probe_lock
spinlock; this has the side effect of requiring all code called
within the lock (ie struct acpi_probe_entry.probe_{table/subtbl} hooks)
not to sleep.

However, kernel subsystems that make use of the early probing
infrastructure are relying on kernel APIs that may sleep (eg
irq_domain_alloc_fwnode(), among others) in the function calls
pointed at by struct acpi_probe_entry.{probe_table/subtbl} entries
(eg gic_v2_acpi_init()), which is a bug.

Since __acpi_probe_device_table() is called from context
that is allowed to sleep the acpi_probe_lock spinlock can be replaced
with a mutex; this fixes the issue whilst still guaranteeing
mutual exclusion.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Fixes: e647b532275b (ACPI: Add early device probing infrastructure)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
drivers/acpi/scan.c