mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, Lv Zheng <zetalog@gmail.com>,
	<linux-kernel@vger.kernel.org>,
	linux-acpi@vger.kernel.org, Bob Moore <robert.moore@intel.com>
Subject: [PATCH 07/42] ACPICA: exmutex: General cleanup, restructured some code
Date: Tue, 29 Dec 2015 13:54:28 +0800	[thread overview]
Message-ID: <798cc19435f035eb4d207ce465ee76b0d38c2ffc.1451367388.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1451367388.git.lv.zheng@intel.com>

From: Bob Moore <robert.moore@intel.com>

ACPICA commit c2a7d000b6be34313b1c50c8a718df16113f0f32

Should be no functional change.

Link: https://github.com/acpica/acpica/commit/c2a7d000
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/exmutex.c |   80 ++++++++++++++++++++++++++++++-----------
 1 file changed, 59 insertions(+), 21 deletions(-)

diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c
index a97f520..843c60a 100644
--- a/drivers/acpi/acpica/exmutex.c
+++ b/drivers/acpi/acpica/exmutex.c
@@ -185,8 +185,9 @@ acpi_ex_acquire_mutex_object(u16 timeout,
 	if (obj_desc == acpi_gbl_global_lock_mutex) {
 		status = acpi_ev_acquire_global_lock(timeout);
 	} else {
-		status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex,
-						   timeout);
+		status =
+		    acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex,
+					      timeout);
 	}
 
 	if (ACPI_FAILURE(status)) {
@@ -243,20 +244,30 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
 	}
 
 	/*
-	 * Current sync level must be less than or equal to the sync level of the
-	 * mutex. This mechanism provides some deadlock prevention
+	 * Current sync level must be less than or equal to the sync level
+	 * of the mutex. This mechanism provides some deadlock prevention.
 	 */
 	if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
 		ACPI_ERROR((AE_INFO,
-			    "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%u)",
+			    "Cannot acquire Mutex [%4.4s], "
+			    "current SyncLevel is too large (%u)",
 			    acpi_ut_get_node_name(obj_desc->mutex.node),
 			    walk_state->thread->current_sync_level));
 		return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
 	}
 
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "Acquiring: Mutex SyncLevel %u, Thread SyncLevel %u, "
+			  "Depth %u TID %p\n",
+			  obj_desc->mutex.sync_level,
+			  walk_state->thread->current_sync_level,
+			  obj_desc->mutex.acquisition_depth,
+			  walk_state->thread));
+
 	status = acpi_ex_acquire_mutex_object((u16)time_desc->integer.value,
 					      obj_desc,
 					      walk_state->thread->thread_id);
+
 	if (ACPI_SUCCESS(status) && obj_desc->mutex.acquisition_depth == 1) {
 
 		/* Save Thread object, original/current sync levels */
@@ -272,6 +283,12 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
 		acpi_ex_link_mutex(obj_desc, walk_state->thread);
 	}
 
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "Acquired: Mutex SyncLevel %u, Thread SyncLevel %u, Depth %u\n",
+			  obj_desc->mutex.sync_level,
+			  walk_state->thread->current_sync_level,
+			  obj_desc->mutex.acquisition_depth));
+
 	return_ACPI_STATUS(status);
 }
 
@@ -356,9 +373,9 @@ acpi_status
 acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
 		      struct acpi_walk_state *walk_state)
 {
-	acpi_status status = AE_OK;
 	u8 previous_sync_level;
 	struct acpi_thread_state *owner_thread;
+	acpi_status status = AE_OK;
 
 	ACPI_FUNCTION_TRACE(ex_release_mutex);
 
@@ -409,7 +426,8 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
 	 */
 	if (obj_desc->mutex.sync_level != owner_thread->current_sync_level) {
 		ACPI_ERROR((AE_INFO,
-			    "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %u current %u",
+			    "Cannot release Mutex [%4.4s], SyncLevel mismatch: "
+			    "mutex %u current %u",
 			    acpi_ut_get_node_name(obj_desc->mutex.node),
 			    obj_desc->mutex.sync_level,
 			    walk_state->thread->current_sync_level));
@@ -424,6 +442,15 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
 	previous_sync_level =
 	    owner_thread->acquired_mutex_list->mutex.original_sync_level;
 
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "Releasing: Object SyncLevel %u, Thread SyncLevel %u, "
+			  "Prev SyncLevel %u, Depth %u TID %p\n",
+			  obj_desc->mutex.sync_level,
+			  walk_state->thread->current_sync_level,
+			  previous_sync_level,
+			  obj_desc->mutex.acquisition_depth,
+			  walk_state->thread));
+
 	status = acpi_ex_release_mutex_object(obj_desc);
 	if (ACPI_FAILURE(status)) {
 		return_ACPI_STATUS(status);
@@ -436,6 +463,14 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
 		owner_thread->current_sync_level = previous_sync_level;
 	}
 
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "Released: Object SyncLevel %u, Thread SyncLevel, %u, "
+			  "Prev SyncLevel %u, Depth %u\n",
+			  obj_desc->mutex.sync_level,
+			  walk_state->thread->current_sync_level,
+			  previous_sync_level,
+			  obj_desc->mutex.acquisition_depth));
+
 	return_ACPI_STATUS(status);
 }
 
@@ -462,21 +497,17 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
 	union acpi_operand_object *next = thread->acquired_mutex_list;
 	union acpi_operand_object *obj_desc;
 
-	ACPI_FUNCTION_NAME(ex_release_all_mutexes);
+	ACPI_FUNCTION_TRACE(ex_release_all_mutexes);
 
 	/* Traverse the list of owned mutexes, releasing each one */
 
 	while (next) {
 		obj_desc = next;
-		next = obj_desc->mutex.next;
-
-		obj_desc->mutex.prev = NULL;
-		obj_desc->mutex.next = NULL;
-		obj_desc->mutex.acquisition_depth = 0;
-
 		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-				  "Force-releasing held mutex: %p\n",
-				  obj_desc));
+				  "Mutex [%4.4s] force-release, SyncLevel %u Depth %u\n",
+				  obj_desc->mutex.node->name.ascii,
+				  obj_desc->mutex.sync_level,
+				  obj_desc->mutex.acquisition_depth));
 
 		/* Release the mutex, special case for Global Lock */
 
@@ -489,14 +520,21 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
 			acpi_os_release_mutex(obj_desc->mutex.os_mutex);
 		}
 
-		/* Mark mutex unowned */
-
-		obj_desc->mutex.owner_thread = NULL;
-		obj_desc->mutex.thread_id = 0;
-
 		/* Update Thread sync_level (Last mutex is the important one) */
 
 		thread->current_sync_level =
 		    obj_desc->mutex.original_sync_level;
+
+		/* Mark mutex unowned */
+
+		next = obj_desc->mutex.next;
+
+		obj_desc->mutex.prev = NULL;
+		obj_desc->mutex.next = NULL;
+		obj_desc->mutex.acquisition_depth = 0;
+		obj_desc->mutex.owner_thread = NULL;
+		obj_desc->mutex.thread_id = 0;
 	}
+
+	return_VOID;
 }
-- 
1.7.10


  parent reply	other threads:[~2015-12-29  5:54 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-29  5:52 [PATCH 00/42] ACPICA: 20151218 Release Lv Zheng
2015-12-29  5:52 ` [PATCH 01/42] ACPICA: Linuxize: reduce divergences for 20151218 release Lv Zheng
2015-12-29  5:52 ` [PATCH 02/42] ACPICA: acpi_get_sleep_type_data: Reduce warnings Lv Zheng
2015-12-29  5:52 ` [PATCH 03/42] ACPICA: Namespace: Fix wrong error log Lv Zheng
2015-12-29  5:53 ` [PATCH 04/42] ACPICA: Debugger: reduce old external path format Lv Zheng
2015-12-29  5:53 ` [PATCH 05/42] ACPICA: Fix SyncLevel support interaction with method auto-serialization Lv Zheng
2015-12-29  5:54 ` [PATCH 06/42] ACPICA: Add "const" to some functions that return fixed strings Lv Zheng
2015-12-29  5:54 ` Lv Zheng [this message]
2015-12-29  5:54 ` [PATCH 08/42] ACPICA: Core: Major update for code formatting, no functional changes Lv Zheng
2015-12-29  5:54 ` [PATCH 09/42] ACPICA: Split interpreter tracing functions to a new file Lv Zheng
2015-12-29  5:54 ` [PATCH 10/42] ACPICA: acpiexec: Add support for AML files containing multiple tables Lv Zheng
2015-12-29  5:54 ` [PATCH 11/42] ACPICA: Disassembler/tools: Support for multiple ACPI tables in one file Lv Zheng
2015-12-29  5:55 ` [PATCH 12/42] ACPICA: iasl/acpiexec: Update input file handling and verification Lv Zheng
2015-12-29  5:55 ` [PATCH 13/42] ACPICA: Debugger: Remove some unecessary NULL checks Lv Zheng
2015-12-29  5:55 ` [PATCH 14/42] ACPICA: Revert "acpi_get_object_info: Add support for ACPI 5.0 _SUB method." Lv Zheng
2015-12-29  5:56 ` [PATCH 15/42] ACPICA: Add comment explaining _SUB removal Lv Zheng
2015-12-29  5:56 ` [PATCH 16/42] ACPICA: acpiexec/acpinames: Update for error checking macros Lv Zheng
2015-12-29  5:56 ` [PATCH 17/42] ACPICA: Concatenate operator: Add extensions to support all ACPI objects Lv Zheng
2015-12-29  5:57 ` [PATCH 18/42] ACPICA: Debug Object: Cleanup output Lv Zheng
2015-12-29  5:57 ` [PATCH 19/42] ACPICA: Debug object: Fix output for a NULL object Lv Zheng
2015-12-29  5:57 ` [PATCH 20/42] ACPICA: Update for output of the Debug Object Lv Zheng
2015-12-29  5:57 ` [PATCH 21/42] ACPICA: Namespace: Add scope information to the simple object repair mechanism Lv Zheng
2015-12-29  5:58 ` [PATCH 22/42] ACPICA: Namespace: Add String -> ObjectReference conversion support Lv Zheng
2015-12-29  5:58 ` [PATCH 23/42] ACPICA: getopt: Comment update, no functional change Lv Zheng
2015-12-29  5:59 ` [PATCH 24/42] ACPICA: Tools: Add spacing and missing options in acpibin tool Lv Zheng
2015-12-29  5:59 ` [PATCH 25/42] ACPICA: Add new exception code, AE_IO_ERROR Lv Zheng
2015-12-29  6:00 ` [PATCH 26/42] ACPICA: iasl/Disassembler: Support ASL ElseIf operator Lv Zheng
2015-12-29  6:00 ` [PATCH 27/42] ACPICA: Parser: Add constants for internal namepath function Lv Zheng
2015-12-29  6:00 ` [PATCH 28/42] ACPICA: Parser: Fix for SuperName method invocation Lv Zheng
2015-12-29  6:00 ` [PATCH 29/42] ACPICA: Update parameter type for ObjectType operator Lv Zheng
2015-12-29  6:00 ` [PATCH 30/42] ACPICA: Update internal #defines for ObjectType operator. No functional change Lv Zheng
2015-12-29  6:01 ` [PATCH 31/42] ACPICA: Update for CondRefOf and RefOf operators Lv Zheng
2015-12-29  6:01 ` [PATCH 32/42] ACPICA: Cleanup code related to the per-table module level improvement Lv Zheng
2015-12-29  6:02 ` [PATCH 33/42] ACPICA: Events: Deploys acpi_ev_find_region_handler() Lv Zheng
2015-12-29  6:02 ` [PATCH 34/42] ACPICA: Events: Uses common_notify for address space handlers Lv Zheng
2015-12-29  6:02 ` [PATCH 35/42] ACPICA: Utilities: Reorder initialization code Lv Zheng
2015-12-29  6:02 ` [PATCH 36/42] ACPICA: Events: Fix an issue that region object is re-attached to another scope when it is already attached Lv Zheng
2015-12-29  6:02 ` [PATCH 37/42] ACPICA: Events: Split acpi_ev_associate_reg_method() from region initialization code Lv Zheng
2015-12-29  6:03 ` [PATCH 38/42] ACPICA: Events: Enhance acpi_ev_execute_reg_method() to ensure no _REG evaluations can happen during OS early boot stages Lv Zheng
2015-12-29  6:03 ` [PATCH 39/42] ACPICA: Events: Introduce ACPI_REG_DISCONNECT invocation to acpi_ev_execute_reg_methods() Lv Zheng
2015-12-29  6:04 ` [PATCH 40/42] ACPICA: Add "root node" case to the ACPI name repair code Lv Zheng
2015-12-29  6:04 ` [PATCH 41/42] ACPICA: Add per-table execution of module-level code Lv Zheng
2015-12-29  6:04 ` [PATCH 42/42] ACPICA: Update version to 20151218 Lv Zheng
2016-01-01  3:04 ` [PATCH 00/42] ACPICA: 20151218 Release Rafael J. Wysocki
2016-01-01  3:24   ` Rafael J. Wysocki
2016-01-04  2:29   ` Zheng, Lv
2016-01-03  0:49 ` Rafael J. Wysocki
2016-01-03  6:45 ` David Lang
2016-01-04  2:27   ` Zheng, Lv
2016-01-04 13:16     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=798cc19435f035eb4d207ce465ee76b0d38c2ffc.1451367388.git.lv.zheng@intel.com \
    --to=lv.zheng@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robert.moore@intel.com \
    --cc=zetalog@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®