[RFC PATCH v3 28/28] ACPI/processor: serialize call to acpi_map/unmap_lsapic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a mutex to serialize call to acpi_map/unmap_lsapic.

Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxx>
---
 drivers/acpi/processor_driver.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 2346b81..9fc20b4 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -108,6 +108,7 @@ static struct acpi_driver acpi_processor_driver = {
 	.drv.pm = &acpi_processor_pm,
 };
 
+static DEFINE_MUTEX(acpi_processor_mutex);
 static DEFINE_PER_CPU(void *, processor_device_array);
 
 DEFINE_PER_CPU(struct acpi_processor *, processors);
@@ -668,7 +669,9 @@ static void acpi_processor_reset(struct acpi_device *device, struct acpi_process
 	acpi_processor_unlink(device, pr);
 	put_online_cpus();
 	arch_unregister_cpu(pr->id);
+	mutex_lock(&acpi_processor_mutex);
 	acpi_unmap_lsapic(pr->id);
+	mutex_unlock(&acpi_processor_mutex);
 	pr->id = -1;
 }
 
@@ -702,7 +705,9 @@ static int acpi_processor_pre_configure(struct acpi_device *device,
 	if (pr->id == -1) {
 		if (pr->apic_id == -1)
 			goto out;
+		mutex_lock(&acpi_processor_mutex);
 		result = acpi_map_lsapic(device->handle, pr->apic_id, &pr->id);
+		mutex_unlock(&acpi_processor_mutex);
 		if (result)
 			goto out;
 		BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
@@ -722,7 +727,9 @@ static int acpi_processor_pre_configure(struct acpi_device *device,
 	return 0;
 
 out_unmap:
+	mutex_lock(&acpi_processor_mutex);
 	acpi_unmap_lsapic(pr->id);
+	mutex_unlock(&acpi_processor_mutex);
 	pr->id = -1;
 out:
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux