All of lore.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <len.brown@intel.com>
To: linux-acpi@vger.kernel.org
Cc: Robert Moore <robert.moore@intel.com>,
	Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>,
	Len Brown <len.brown@intel.com>
Subject: [PATCH 50/65] ACPICA: Eliminate control method 2-pass parse/execute.
Date: Fri, 24 Nov 2006 02:19:00 -0500	[thread overview]
Message-ID: <11643528111088-git-send-email-len.brown@intel.com> (raw)
Message-ID: <debc56bf59819095a2e54a41c2a25d6475a6e761.1164352294.git.len.brown@intel.com> (raw)
In-Reply-To: <11643528091601-git-send-email-len.brown@intel.com>
In-Reply-To: <410c2f0190f74c35505beda6ff3f2da7819f8bac.1164352285.git.len.brown@intel.com>

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

Completed an AML interpreter performance enhancement for control method
execution. Previously a 2-pass parse/execution, control methods are now
completely parsed and executed in single pass. This improves overall
interpreter performance by ~25%, reduces code size, and reduces CPU stack use.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/acpi/dispatcher/dsmethod.c |   50 +--------------
 drivers/acpi/parser/psloop.c       |    2 +-
 drivers/acpi/parser/psxface.c      |  114 ++++++++++++------------------------
 3 files changed, 42 insertions(+), 124 deletions(-)

diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index cf888ad..aa60dca 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -327,7 +327,7 @@ acpi_ds_call_control_method(struct acpi_
 	ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state);
 
 	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-			  "Execute method %p, currentstate=%p\n",
+			  "Calling method %p, currentstate=%p\n",
 			  this_walk_state->prev_op, this_walk_state));
 
 	/*
@@ -351,49 +351,7 @@ acpi_ds_call_control_method(struct acpi_
 		return_ACPI_STATUS(status);
 	}
 
-	/*
-	 * 1) Parse the method. All "normal" methods are parsed for each execution.
-	 * Internal methods (_OSI, etc.) do not require parsing.
-	 */
-	if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
-
-		/* Create a new walk state for the parse */
-
-		next_walk_state =
-		    acpi_ds_create_walk_state(obj_desc->method.owner_id, op,
-					      obj_desc, NULL);
-		if (!next_walk_state) {
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		/* Create and init a parse tree root */
-
-		op = acpi_ps_create_scope_op();
-		if (!op) {
-			status = AE_NO_MEMORY;
-			goto cleanup;
-		}
-
-		status = acpi_ds_init_aml_walk(next_walk_state, op, method_node,
-					       obj_desc->method.aml_start,
-					       obj_desc->method.aml_length,
-					       NULL, 1);
-		if (ACPI_FAILURE(status)) {
-			acpi_ps_delete_parse_tree(op);
-			goto cleanup;
-		}
-
-		/* Begin AML parse (deletes next_walk_state) */
-
-		status = acpi_ps_parse_aml(next_walk_state);
-		acpi_ps_delete_parse_tree(op);
-		if (ACPI_FAILURE(status)) {
-			goto cleanup;
-		}
-	}
-
-	/* 2) Begin method execution. Create a new walk state */
+	/* Begin method parse/execution. Create a new walk state */
 
 	next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id,
 						    NULL, obj_desc, thread);
@@ -445,8 +403,8 @@ acpi_ds_call_control_method(struct acpi_
 	this_walk_state->num_operands = 0;
 
 	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-			  "Starting nested execution, newstate=%p\n",
-			  next_walk_state));
+			  "**** Begin nested execution of [%4.4s] **** WalkState=%p\n",
+			  method_node->name.ascii, next_walk_state));
 
 	/* Invoke an internal method if necessary */
 
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
index a83be52..881687c 100644
--- a/drivers/acpi/parser/psloop.c
+++ b/drivers/acpi/parser/psloop.c
@@ -226,7 +226,7 @@ acpi_ps_build_named_op(struct acpi_walk_
 		return_ACPI_STATUS(status);
 	}
 
-	if (!op) {
+	if (!*op) {
 		return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
 	}
 
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index 5d996c1..9069c69 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -54,8 +54,6 @@ static void acpi_ps_start_trace(struct a
 
 static void acpi_ps_stop_trace(struct acpi_evaluate_info *info);
 
-static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info);
-
 static void
 acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action);
 
@@ -215,6 +213,8 @@ static void acpi_ps_stop_trace(struct ac
 acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
 {
 	acpi_status status;
+	union acpi_parse_object *op;
+	struct acpi_walk_state *walk_state;
 
 	ACPI_FUNCTION_TRACE(ps_execute_method);
 
@@ -234,8 +234,7 @@ acpi_status acpi_ps_execute_method(struc
 	}
 
 	/*
-	 * The caller "owns" the parameters, so give each one an extra
-	 * reference
+	 * The caller "owns" the parameters, so give each one an extra reference
 	 */
 	acpi_ps_update_parameter_list(info, REF_INCREMENT);
 
@@ -244,30 +243,50 @@ acpi_status acpi_ps_execute_method(struc
 	acpi_ps_start_trace(info);
 
 	/*
-	 * 1) Perform the first pass parse of the method to enter any
-	 *    named objects that it creates into the namespace
+	 * Execute the method. Performs parse simultaneously
 	 */
 	ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-			  "**** Begin Method Parse **** Entry=%p obj=%p\n",
-			  info->resolved_node, info->obj_desc));
+			  "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
+			  info->resolved_node->name.ascii, info->resolved_node,
+			  info->obj_desc));
 
-	info->pass_number = 1;
-	status = acpi_ps_execute_pass(info);
-	if (ACPI_FAILURE(status)) {
+	/* Create and init a Root Node */
+
+	op = acpi_ps_create_scope_op();
+	if (!op) {
+		status = AE_NO_MEMORY;
 		goto cleanup;
 	}
 
-	/*
-	 * 2) Execute the method. Performs second pass parse simultaneously
-	 */
-	ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-			  "**** Begin Method Execution **** Entry=%p obj=%p\n",
-			  info->resolved_node, info->obj_desc));
+	/* Create and initialize a new walk state */
 
 	info->pass_number = 3;
-	status = acpi_ps_execute_pass(info);
+	walk_state =
+	    acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
+				      NULL, NULL);
+	if (!walk_state) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
+
+	status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node,
+				       info->obj_desc->method.aml_start,
+				       info->obj_desc->method.aml_length, info,
+				       info->pass_number);
+	if (ACPI_FAILURE(status)) {
+		acpi_ds_delete_walk_state(walk_state);
+		goto cleanup;
+	}
+
+	/* Parse the AML */
+
+	status = acpi_ps_parse_aml(walk_state);
+
+	/* walk_state was deleted by parse_aml */
 
       cleanup:
+	acpi_ps_delete_parse_tree(op);
+
 	/* End optional tracing */
 
 	acpi_ps_stop_trace(info);
@@ -330,62 +349,3 @@ acpi_ps_update_parameter_list(struct acp
 		}
 	}
 }
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ps_execute_pass
- *
- * PARAMETERS:  Info            - See struct acpi_evaluate_info
- *                                (Used: pass_number, Node, and obj_desc)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Single AML pass: Parse or Execute a control method
- *
- ******************************************************************************/
-
-static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info)
-{
-	acpi_status status;
-	union acpi_parse_object *op;
-	struct acpi_walk_state *walk_state;
-
-	ACPI_FUNCTION_TRACE(ps_execute_pass);
-
-	/* Create and init a Root Node */
-
-	op = acpi_ps_create_scope_op();
-	if (!op) {
-		return_ACPI_STATUS(AE_NO_MEMORY);
-	}
-
-	/* Create and initialize a new walk state */
-
-	walk_state =
-	    acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
-				      NULL, NULL);
-	if (!walk_state) {
-		status = AE_NO_MEMORY;
-		goto cleanup;
-	}
-
-	status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node,
-				       info->obj_desc->method.aml_start,
-				       info->obj_desc->method.aml_length,
-				       info->pass_number == 1 ? NULL : info,
-				       info->pass_number);
-	if (ACPI_FAILURE(status)) {
-		acpi_ds_delete_walk_state(walk_state);
-		goto cleanup;
-	}
-
-	/* Parse the AML */
-
-	status = acpi_ps_parse_aml(walk_state);
-
-	/* Walk state was deleted by parse_aml */
-
-      cleanup:
-	acpi_ps_delete_parse_tree(op);
-	return_ACPI_STATUS(status);
-}
-- 
1.4.4.1

  parent reply	other threads:[~2006-11-24  7:16 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-24  7:18 contents of the acpica branch Len Brown
2006-11-24  7:18 ` [PATCH 1/65] ACPICA: Update function header Len Brown
2006-11-24  7:18   ` Len Brown
2006-11-24  7:18   ` [PATCH 2/65] ACPICA: Handle mis-matched package length Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 3/65] ACPICA: Handle case NumElements > Package length Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 4/65] ACPICA: Delete recursive feature of ACPI Global Lock Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 5/65] ACPICA: Release global lock from interrupt handler Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 6/65] ACPICA: Cast acpi_thread_id to UINT32 for debug output only Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 7/65] ACPICA: fix for object premature deletion Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 8/65] ACPICA: Temporary fix for BankValue parameter Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 9/65] ACPICA: Update version to 20060721 Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 10/65] ACPICA: Update debug output Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 12/65] ACPICA: misc fixes for new Table Manager: Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 13/65] ACPICA: Update comments for individual table fields Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 14/65] ACPICA: Fix for FADT conversion in 64-bit mode Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 15/65] ACPICA: Lint changes Len Brown
2006-11-24  7:18     ` Len Brown
     [not found]       ` <1164352776767-git-send-email-len.brown@intel.com>
2006-11-24  7:18   ` [PATCH 17/65] ACPICA: Add support for DMAR table Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 18/65] ACPICA: Add acpi_gpe_count global to track the number of GPE events Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 19/65] ACPICA: Disable all wake GPEs after first one recieved Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 20/65] ACPICA: Fix unalignment in acpi_ut_repair_name Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 21/65] ACPICA: Store GPE number instead of bitmask Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 22/65] ACPICA: Split acpi_format_exception into two parts Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 23/65] ACPICA: Update version to 20060831 Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 24/65] ACPICA: Cleanup of FADT verification function Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 25/65] ACPICA: Create tbfadt.c to hold all FADT-related functions Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 26/65] ACPICA: Re-implement interpreters' "serialized mode" Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 27/65] ACPICA: Delete stale FADT functions outside tbfadt.c Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 28/65] ACPICA: Update comments in tbfadt.c Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 29/65] ACPICA: add ASF comment Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 30/65] ACPICA: re-factor table init routines for benefit of iASL Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 31/65] ACPICA: Allow type ANY to be the target of the Scope operator Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 32/65] ACPICA: IsResourceTemplate now returns ACPI_STATUS Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 33/65] ACPICA: Add declarations for ASF! sub-tables Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 34/65] ACPICA: FADT verification is now table driven Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 35/65] ACPICA: Report error if method creates 2 objects with the same name Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 36/65] ACPICA: New common routine for creating and verifying a local FADT Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 37/65] ACPICA: Fix memory leak in table load error path Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 38/65] ACPICA: Fix trace output name and whitespace Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 39/65] ACPICA: Update version to 20060912 Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 40/65] ACPICA: Add full table name to disassembler output Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 41/65] ACPICA: Fix for Global Lock semaphore Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 42/65] ACPICA: Remove obsolete Flags parameter Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 43/65] ACPICA: Use faster ByIndex interface to get FACS Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 44/65] ACPICA: On AML mutex force-release, set depth to zero (was 1) Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 45/65] ACPICA: Update interpreter error paths to always report the error Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 46/65] ACPICA: Fix for possible memory leak and fault Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 47/65] ACPICA: Add new subsystem state bit that is set after SubsystemInitialize is called Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 48/65] ACPICA: Update version to 20060927 Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:18   ` [PATCH 49/65] ACPICA: Restructured module into multiple functions Len Brown
2006-11-24  7:18     ` Len Brown
2006-11-24  7:19   ` Len Brown [this message]
2006-11-24  7:19     ` [PATCH 50/65] ACPICA: Eliminate control method 2-pass parse/execute Len Brown
2006-11-24  7:19   ` [PATCH 51/65] ACPICA: Fix race condition with AcpiWalkNamespace Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 52/65] ACPICA: _CID support for PCI Root Bridge detection Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 53/65] ACPICA: Use manifest constants for parse pass number Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 54/65] ACPICA: Update comments Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 55/65] ACPICA: Abort downward walk on temporary node detection Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 56/65] ACPICA: Fixes for parameter validation Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 57/65] ACPICA: Update version to 20061011 Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 58/65] ACPICA: Update debug output routines for data structure changes Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 59/65] ACPICA: Miscellaneous table manager updates and optimizations Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 60/65] ACPICA: Fixes for load() operator Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 61/65] ACPICA: Ensure that all structures in acobject.h are aligned, via #pragma Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 62/65] ACPICA: Add ACPI_MAX macro Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 63/65] ACPICA: Fail AcpiEnable if ACPI tables not loaded Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 64/65] ACPICA: Add include of actables.h Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24  7:19   ` [PATCH 65/65] ACPICA: version update Len Brown
2006-11-24  7:19     ` Len Brown
2006-11-24 20:32 ` contents of the acpica branch Rafael J. Wysocki
2006-11-24 22:25   ` Rafael J. Wysocki
2006-11-27  2:12     ` Len Brown

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=11643528111088-git-send-email-len.brown@intel.com \
    --to=len.brown@intel.com \
    --cc=alexey.y.starikovskiy@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=robert.moore@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.