diff options
author | Bob Moore <robert.moore@intel.com> | 2014-03-24 02:49:13 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-03-26 11:25:59 -0400 |
commit | d18255795bf98b3f25dbc5334b8a615943c3dcca (patch) | |
tree | 8911d93a80fb03e95cb0d6eee793b085af09152b /drivers/acpi | |
parent | 21bd7e610ef75ef26387ed4667801080b5b7220a (diff) |
ACPICA: Ignore sync_level for methods that have been auto-serialized.
Cannot use a sync_level for methods that have been serialized at load-time
or runtime because this may interfere with any existing use of sync_levels
within the ASL code. So, we simply ignore the sync_level for these methods,
thus preserving any existing sync_level priorities. Note, the use of
sync_levels is actually rather rare within BIOS ASL code.
References: http://www.spinics.net/lists/linux-acpi/msg49496.html
Reported-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Reported-by: Sabrina Dubroka <sd@queasysnail.net>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/acobject.h | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsmethod.c | 24 |
2 files changed, 21 insertions, 6 deletions
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 1a4d61805ebc..22fb6449d3d6 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -193,7 +193,8 @@ struct acpi_object_method { | |||
193 | #define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ | 193 | #define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ |
194 | #define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ | 194 | #define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ |
195 | #define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ | 195 | #define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ |
196 | #define ACPI_METHOD_MODIFIED_NAMESPACE 0x10 /* Method modified the namespace */ | 196 | #define ACPI_METHOD_IGNORE_SYNC_LEVEL 0x10 /* Method was auto-serialized at table load time */ |
197 | #define ACPI_METHOD_MODIFIED_NAMESPACE 0x20 /* Method modified the namespace */ | ||
197 | 198 | ||
198 | /****************************************************************************** | 199 | /****************************************************************************** |
199 | * | 200 | * |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 73764c7d1c5d..3c7f7378b94d 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
@@ -175,8 +175,15 @@ acpi_ds_detect_named_opcodes(struct acpi_walk_state *walk_state, | |||
175 | * At this point, we know we have a Named object opcode. | 175 | * At this point, we know we have a Named object opcode. |
176 | * Mark the method as serialized. Later code will create a mutex for | 176 | * Mark the method as serialized. Later code will create a mutex for |
177 | * this method to enforce serialization. | 177 | * this method to enforce serialization. |
178 | * | ||
179 | * Note, ACPI_METHOD_IGNORE_SYNC_LEVEL flag means that we will ignore the | ||
180 | * Sync Level mechanism for this method, even though it is now serialized. | ||
181 | * Otherwise, there can be conflicts with existing ASL code that actually | ||
182 | * uses sync levels. | ||
178 | */ | 183 | */ |
179 | walk_state->method_desc->method.info_flags |= ACPI_METHOD_SERIALIZED; | 184 | walk_state->method_desc->method.sync_level = 0; |
185 | walk_state->method_desc->method.info_flags |= | ||
186 | (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL); | ||
180 | 187 | ||
181 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 188 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
182 | "Method serialized [%4.4s] %p - [%s] (%4.4X)\n", | 189 | "Method serialized [%4.4s] %p - [%s] (%4.4X)\n", |
@@ -349,13 +356,19 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
349 | /* | 356 | /* |
350 | * The current_sync_level (per-thread) must be less than or equal to | 357 | * The current_sync_level (per-thread) must be less than or equal to |
351 | * the sync level of the method. This mechanism provides some | 358 | * the sync level of the method. This mechanism provides some |
352 | * deadlock prevention | 359 | * deadlock prevention. |
360 | * | ||
361 | * If the method was auto-serialized, we just ignore the sync level | ||
362 | * mechanism, because auto-serialization of methods can interfere | ||
363 | * with ASL code that actually uses sync levels. | ||
353 | * | 364 | * |
354 | * Top-level method invocation has no walk state at this point | 365 | * Top-level method invocation has no walk state at this point |
355 | */ | 366 | */ |
356 | if (walk_state && | 367 | if (walk_state && |
357 | (walk_state->thread->current_sync_level > | 368 | (!(obj_desc->method. |
358 | obj_desc->method.mutex->mutex.sync_level)) { | 369 | info_flags & ACPI_METHOD_IGNORE_SYNC_LEVEL)) |
370 | && (walk_state->thread->current_sync_level > | ||
371 | obj_desc->method.mutex->mutex.sync_level)) { | ||
359 | ACPI_ERROR((AE_INFO, | 372 | ACPI_ERROR((AE_INFO, |
360 | "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", | 373 | "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", |
361 | acpi_ut_get_node_name(method_node), | 374 | acpi_ut_get_node_name(method_node), |
@@ -800,7 +813,8 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
800 | method_desc->method.info_flags &= | 813 | method_desc->method.info_flags &= |
801 | ~ACPI_METHOD_SERIALIZED_PENDING; | 814 | ~ACPI_METHOD_SERIALIZED_PENDING; |
802 | method_desc->method.info_flags |= | 815 | method_desc->method.info_flags |= |
803 | ACPI_METHOD_SERIALIZED; | 816 | (ACPI_METHOD_SERIALIZED | |
817 | ACPI_METHOD_IGNORE_SYNC_LEVEL); | ||
804 | method_desc->method.sync_level = 0; | 818 | method_desc->method.sync_level = 0; |
805 | } | 819 | } |
806 | 820 | ||