Skip to content

Commit

Permalink
ACPICA: Executer: Add interpreter tracing mode for method tracing fac…
Browse files Browse the repository at this point in the history
…ility

ACPICA commit 07fffd02607685b655ed92ee15c160e6a810b60b

The acpi_debug_trace() is the mechanism known as ACPI method tracing that is
used by Linux as ACPICA debugging message reducer. This facility can be
controlled through Linux ACPI subsystem - /sys/module/acpi/parameters.
This facility requires CONFIG_ACPI_DEBUG to be enabled to see ACPICA trace
logs in the kernel dmesg output.

This patch enhances acpi_debug_trace() to make it not only a message reducer,
but a real tracer to trace AML interpreter execution. Note that in addition
to the AML tracer enabling, this patch also updates the facility with the
following enhancements:
1. Allow a full path to be specified by the acpi_debug_trace() API.
2. Allow any method rather than just the entrance of acpi_evaluate_object()
   to be traced.
3. All interpreter ACPI_LV_TRACE_POINT messages are collected for
   ACPI_EXECUTER layer.

The Makefile of drivers/acpi/acpica is also updated to include exdebug.o
and the duplicated stubs are removed after that.

Note that since this patch has enhanced the method tracing facility, Linux
need also be updated after applying this patch. Lv Zheng.

Link: acpica/acpica@07fffd02
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Lv Zheng authored and rafaeljw committed Jul 23, 2015
1 parent a616dc2 commit ab6c573
Show file tree
Hide file tree
Showing 12 changed files with 327 additions and 185 deletions.
2 changes: 2 additions & 0 deletions drivers/acpi/acpica/acdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg);

acpi_status acpi_db_sleep(char *object_arg);

void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg);

void acpi_db_display_locks(void);

void acpi_db_display_resources(char *object_arg);
Expand Down
2 changes: 0 additions & 2 deletions drivers/acpi/acpica/acglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,6 @@ ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]);

ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level);
ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer);
ACPI_GLOBAL(u32, acpi_gbl_trace_dbg_level);
ACPI_GLOBAL(u32, acpi_gbl_trace_dbg_layer);

/*****************************************************************************
*
Expand Down
18 changes: 18 additions & 0 deletions drivers/acpi/acpica/acinterp.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,24 @@ void
acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
u32 level, u32 index);

void
acpi_ex_start_trace_method(struct acpi_namespace_node *method_node,
union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state);

void
acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node,
union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state);

void
acpi_ex_start_trace_opcode(union acpi_parse_object *op,
struct acpi_walk_state *walk_state);

void
acpi_ex_stop_trace_opcode(union acpi_parse_object *op,
struct acpi_walk_state *walk_state);

/*
* exfield - ACPI AML (p-code) execution - field manipulation
*/
Expand Down
25 changes: 5 additions & 20 deletions drivers/acpi/acpica/dsdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#ifdef ACPI_DISASSEMBLER
#include "acdisasm.h"
#endif
#include "acinterp.h"

#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dsdebug")
Expand Down Expand Up @@ -128,7 +129,6 @@ acpi_ds_dump_method_stack(acpi_status status,
struct acpi_walk_state *next_walk_state;
struct acpi_namespace_node *previous_method = NULL;
union acpi_operand_object *method_desc;
char *pathname = NULL;

ACPI_FUNCTION_TRACE(ds_dump_method_stack);

Expand Down Expand Up @@ -173,25 +173,10 @@ acpi_ds_dump_method_stack(acpi_status status,

while (next_walk_state) {
method_desc = next_walk_state->method_desc;
if (method_desc && method_desc->method.node) {
pathname = acpi_ns_get_normalized_pathname((struct
acpi_namespace_node
*)
method_desc->
method.node,
TRUE);
}
if (pathname) {
ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
"End method [0x%p:%s] execution.\n",
method_desc->method.aml_start,
pathname));
ACPI_FREE(pathname);
pathname = NULL;
} else {
ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
"End method [0x%p] execution.\n",
method_desc->method.aml_start));
if (method_desc) {
acpi_ex_stop_trace_method((struct acpi_namespace_node *)
method_desc->method.node,
method_desc, walk_state);
}

ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
Expand Down
32 changes: 3 additions & 29 deletions drivers/acpi/acpica/dsmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,25 +327,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
char *pathname = NULL;

ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node);

if (!method_node) {
return_ACPI_STATUS(AE_NULL_ENTRY);
}

pathname = acpi_ns_get_normalized_pathname(method_node, TRUE);
if (pathname) {
ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
"Begin method [0x%p:%s] execution.\n",
obj_desc->method.aml_start, pathname));
ACPI_FREE(pathname);
} else {
ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
"Begin method [0x%p] execution.\n",
obj_desc->method.aml_start));
}
acpi_ex_start_trace_method(method_node, obj_desc, walk_state);

/* Prevent wraparound of thread count */

Expand Down Expand Up @@ -708,7 +697,6 @@ void
acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
struct acpi_walk_state *walk_state)
{
char *pathname = NULL;

ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state);

Expand Down Expand Up @@ -846,22 +834,8 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
}
}

if (method_desc->method.node) {
pathname = acpi_ns_get_normalized_pathname((struct
acpi_namespace_node
*)method_desc->
method.node, TRUE);
}
if (pathname) {
ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
"End method [0x%p:%s] execution.\n",
method_desc->method.aml_start, pathname));
ACPI_FREE(pathname);
} else {
ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
"End method [0x%p] execution.\n",
method_desc->method.aml_start));
}
acpi_ex_stop_trace_method((struct acpi_namespace_node *)method_desc->
method.node, method_desc, walk_state);

return_VOID;
}
Loading

0 comments on commit ab6c573

Please sign in to comment.