ACPICA: 20150717 Release
Subsystems (3)
cover ACPICA: 20150717 Release
The 20150717 ACPICA kernel-resident subsystem updates are linuxized based on the linux-pm/linux-next branch.
The patchset has passed the following build/boot tests. Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + allyes + CONFIG_ACPI=y
3. i386 + default + COFNIG_ACPI=n
4. i386 + allyes + CONFIG_ACPI=n
5. x86_64 + default + COFNIG_ACPI=y
6. x86_64 + allyes + CONFIG_ACPI=y
7. x86_64 + default + COFNIG_ACPI=n
8. x86_64 + allyes + CONFIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. x86_64 + default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
All hardware drivers related to the machines of i386/x86_64 All "drivers/acpi" configurations
All "drivers/platform" drivers
All other drivers that link the APIs provided by ACPICA subsystem
The divergences checking result:
Before applying (20150619 Release):
539 lines
After applying (20150717 Release):
518 lines
Note that the reduction is due to:
1. The FACS related divergences are not counted;
2. Some debugger related divergences are merged in this release as the configurability of the debugger code has improved.
Bob Moore (6):
ACPICA: iASL: Add new warnings for method local_x and arg_x
variables.
ACPICA: Cleanup use of all non-ANSI local C library functions.
ACPICA: Cleanup use of NEGATIVE and POSITIVE defines.
ACPICA: iASL: Add support for TCPA Server Table.
ACPICA: iASL/Disassembler: Add prototype verbose mode.
ACPICA: Update version to 20150717.
Lv Zheng (15):
ACPICA: Parser: Reduce parser/namespace divergences for tracer
support.
ACPICA: Parser: Cleanup aml_offset in struct acpi_walk_state.
ACPICA: Parser: Cleanup aml_offset in union acpi_operand_object.
ACPICA: Dispatcher: Cleanup union acpi_operand_object's AML address
assignments.
ACPICA: Executer: Add back pointing reference of method operand.
ACPICA: Namespace: Add function to directly return normalized full
path.
ACPICA: Dispatcher: Move stack traversal code to dispatcher.
ACPICA: Dispatcher: Add trace support for interpreter.
ACPICA: Executer: Add interpreter tracing mode for method tracing
facility.
ACPICA: Executer: Add OSL trace hook support.
ACPICA: Executer: Add option to bypass opcode tracing.
ACPICA: Parser: Remove redundant opcode execution debugging output.
ACPICA: MSVC: Fix inclusion order issue of <crtdbg.h>.
ACPICA: Debugger: Reduce structure size for debugger.
ACPICA: Debugger: Move debugger specific APIs to debugger component.
Markus Elfring (1):
ACPICA: Remove extraneous check for null walk_state.
drivers/acpi/acpica/Makefile | 2 + drivers/acpi/acpica/acdebug.h | 19 ++ drivers/acpi/acpica/acdispat.h | 8 + drivers/acpi/acpica/acglobal.h | 3 +- drivers/acpi/acpica/acinterp.h | 22 +++ drivers/acpi/acpica/aclocal.h | 11 +- drivers/acpi/acpica/acmacros.h | 9 + drivers/acpi/acpica/acnamesp.h | 13 +- drivers/acpi/acpica/acobject.h | 1 + drivers/acpi/acpica/acparser.h | 4 +- drivers/acpi/acpica/acstruct.h | 2 +- drivers/acpi/acpica/acutils.h | 23 ++- drivers/acpi/acpica/dsargs.c | 4 +- drivers/acpi/acpica/dsdebug.c | 231 +++++++++++++++++++++++ drivers/acpi/acpica/dsmethod.c | 35 ++-- drivers/acpi/acpica/dswload.c | 2 +- drivers/acpi/acpica/dswload2.c | 2 +- drivers/acpi/acpica/excreate.c | 1 + drivers/acpi/acpica/exdebug.c | 324 ++++++++++++++++++++++++++++++++ drivers/acpi/acpica/exdump.c | 5 +- drivers/acpi/acpica/nsnames.c | 275 +++++++++++++++------------ drivers/acpi/acpica/nsparse.c | 42 ++--- drivers/acpi/acpica/nsutils.c | 2 +- drivers/acpi/acpica/nsxfname.c | 8 +- drivers/acpi/acpica/psargs.c | 26 +-- drivers/acpi/acpica/psloop.c | 18 +- drivers/acpi/acpica/psobject.c | 17 +- drivers/acpi/acpica/psparse.c | 14 +- drivers/acpi/acpica/psutils.c | 8 +- drivers/acpi/acpica/psxface.c | 123 +----------- drivers/acpi/acpica/rscreate.c | 3 +- drivers/acpi/acpica/utdebug.c | 31 +++- drivers/acpi/acpica/utdelete.c | 3 + drivers/acpi/acpica/utinit.c | 2 - drivers/acpi/acpica/utmisc.c | 2 +- drivers/acpi/acpica/utnonansi.c | 380 ++++++++++++++++++++++++++++++++++++++ drivers/acpi/acpica/utstring.c | 342 ---------------------------------- include/acpi/acoutput.h | 21 ++- include/acpi/acpiosxf.h | 6 + include/acpi/acpixf.h | 13 +- include/acpi/actbl2.h | 17 +- include/acpi/actypes.h | 11 +- include/acpi/platform/acenvex.h | 3 + include/acpi/platform/acmsvcex.h | 54 ++++++ include/acpi/platform/acwinex.h | 49 +++++ 45 files changed, 1491 insertions(+), 700 deletions(-) create mode 100644 drivers/acpi/acpica/dsdebug.c create mode 100644 drivers/acpi/acpica/utnonansi.c create mode 100644 include/acpi/platform/acmsvcex.h create mode 100644 include/acpi/platform/acwinex.h
Signature · 1 line
1.7.10
PATCH 1/22 ACPICA: Parser: Reduce parser/namespace divergences for tracer support.
This patch reduces divergences in parser/namespace components so that the follow-up linuxized ACPICA upstream commits can be directly merged. Including the fix to an indent issue reported and fixed by Zhouyi Zhou.
--- drivers/acpi/acpica/nsnames.c | 2 +- drivers/acpi/acpica/nsparse.c | 6 +++--- drivers/acpi/acpica/psloop.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/acpi/acpica/nsnames.c +1 -1
@@ -108,7 +108,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,if (index !=0 ) {ACPI_ERROR ((AE_INFO ,"Could not construct external pathname; index=%u, size=%u, Path=%s" , - (u32 ) index, (u32 ) size, &name_buffer[size])); + (u32 )index, (u32 )size, &name_buffer[size]));return (AE_BAD_PARAMETER ); }
drivers/acpi/acpica/nsparse.c +3 -3
@@ -70,7 +70,7 @@ acpi_ns_one_complete_parse(u32 pass_number, {union acpi_parse_object *parse_root;acpi_status status; -u32 aml_length; +u32 aml_length;u8 *aml_start;struct acpi_walk_state *walk_state;struct acpi_table_header *table;
@@ -110,11 +110,11 @@ acpi_ns_one_complete_parse(u32 pass_number,if (table->length <sizeof (struct acpi_table_header )) { status =AE_BAD_HEADER ; }else { - aml_start = (u8 *) table +sizeof (struct acpi_table_header ); + aml_start = (u8 *)table +sizeof (struct acpi_table_header ); aml_length = table->length -sizeof (struct acpi_table_header ); status =acpi_ds_init_aml_walk (walk_state, parse_root,NULL , aml_start, aml_length,NULL , - (u8 ) pass_number); + (u8 )pass_number); }/* Found OSDT table, enable the namespace override feature */
drivers/acpi/acpica/psloop.c +4 -4
@@ -126,9 +126,9 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && !walk_state->arg_count) { walk_state->aml_offset = - (u32 )ACPI_PTR_DIFF (walk_state->parser_state.aml, - walk_state->parser_state. - aml_start); + (u32 )ACPI_PTR_DIFF (walk_state->parser_state.aml, + walk_state->parser_state. + aml_start); status = acpi_ps_get_next_arg(walk_state,
@@ -499,7 +499,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)if (walk_state->op_info) {ACPI_DEBUG_PRINT ((ACPI_DB_PARSE ,"Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n" , - (u32 ) op->common.aml_opcode, + (u32 )op->common.aml_opcode, walk_state->op_info->name, op, parser_state->aml, op->common.aml_offset));
Signature · 1 line
1.7.10
PATCH 2/22 ACPICA: Parser: Cleanup aml_offset in struct acpi_walk_state.
In reply to Lv ZhengACPICA commit d254405814495058276c0c2f9d96794d15a6c91c
This patch converts aml_offset in struct acpi_walk_state to AML address.
AML offset is actually only used by the debugger, using AML address is more direct and efficient during the parsing stage so that we don't need to calculate it during the parsing stage.
On the other hand, we can see several issues in the current parser logic around the aml_offset:
1. union acpi_operand_object.Common.aml_offset is redundantly assigned in acpi_ps_parse_loop().
2. aml_offset is not an indication of the offset from the table header but the offset from the entry of a list of objects. Sometimes, it indicates an entry for a Method/Package/Buffer, which makes it difficult to be reversely calculated to a table header offset.
3. When being used with method tracers (for example, Linux function trace), it's better to have AML address logged instead of the AML offset because the address is the only attribute that can uniquely identify the opcode.
This patch is required to solve the above issues. Lv Zheng.
--- drivers/acpi/acpica/acstruct.h | 2 +- drivers/acpi/acpica/dsmethod.c | 9 +++++++-- drivers/acpi/acpica/psloop.c | 15 +++++++++------ drivers/acpi/acpica/psobject.c | 15 +++++++++------ 4 files changed, 26 insertions(+), 15 deletions(-)
drivers/acpi/acpica/acstruct.h +1 -1
@@ -85,7 +85,7 @@ struct acpi_walk_state {u8 namespace_override;/* Override existing objects */ u8 result_size;/* Total elements for the result stack */ u8 result_count;/* Current number of occupied elements of result stack */ -u32 aml_offset; +u8 *aml;u32 arg_types;u32 method_breakpoint;/* For single stepping */ u32 user_breakpoint;/* User AML breakpoint */
drivers/acpi/acpica/dsmethod.c +7 -2
@@ -214,6 +214,8 @@ acpi_ds_detect_named_opcodes(struct acpi_walk_state *walk_state,acpi_status acpi_ds_method_error (acpi_status status,struct acpi_walk_state * walk_state) { +u32 aml_offset; +ACPI_FUNCTION_ENTRY ();/* Ignore AE_OK and control exception codes */
@@ -234,13 +236,16 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state * walk_state)* Handler can map the exception code to anything it wants, including * AE_OK, in which case the executing method will not be aborted. */ + aml_offset = (u32 )ACPI_PTR_DIFF (walk_state->aml, + walk_state->parser_state. + aml_start); + status =acpi_gbl_exception_handler (status, walk_state->method_node ? walk_state->method_node-> name.integer :0 , walk_state->opcode, - walk_state->aml_offset, -NULL ); + aml_offset,NULL );acpi_ex_enter_interpreter (); }
drivers/acpi/acpica/psloop.c +9 -6
@@ -125,10 +125,7 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,*/ while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && !walk_state->arg_count) { - walk_state->aml_offset = - (u32 )ACPI_PTR_DIFF (walk_state->parser_state.aml, - walk_state->parser_state. - aml_start); + walk_state->aml = walk_state->parser_state.aml; status = acpi_ps_get_next_arg(walk_state,
@@ -140,7 +137,10 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state, }if (arg) { - arg->common.aml_offset = walk_state->aml_offset; + arg->common.aml_offset = + (u32 )ACPI_PTR_DIFF (walk_state->aml, + walk_state->parser_state. + aml_start);acpi_ps_append_arg (op, arg); }
@@ -494,7 +494,10 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)continue ; } - op->common.aml_offset = walk_state->aml_offset; + op->common.aml_offset = + (u32 )ACPI_PTR_DIFF (walk_state->aml, + walk_state->parser_state. + aml_start);if (walk_state->op_info) { ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
drivers/acpi/acpica/psobject.c +9 -6
@@ -66,12 +66,11 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state);static acpi_status acpi_ps_get_aml_opcode (struct acpi_walk_state *walk_state) { +u32 aml_offset;ACPI_FUNCTION_TRACE_PTR (ps_get_aml_opcode, walk_state); - walk_state->aml_offset = - (u32 )ACPI_PTR_DIFF (walk_state->parser_state.aml, - walk_state->parser_state.aml_start); + walk_state->aml = walk_state->parser_state.aml; walk_state->opcode =acpi_ps_peek_opcode (&(walk_state->parser_state));/*
@@ -98,10 +97,14 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)/* The opcode is unrecognized. Complain and skip unknown opcodes */ if (walk_state->pass_number ==2 ) { + aml_offset = (u32 )ACPI_PTR_DIFF (walk_state->aml, + walk_state-> + parser_state.aml_start); +ACPI_ERROR ((AE_INFO ,"Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring" , walk_state->opcode, - (u32)(walk_state->aml_offset + + (u32)(aml_offset +sizeof (struct acpi_table_header )))); ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16),
@@ -115,14 +118,14 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)acpi_os_printf ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n" , walk_state->opcode, - (u32)(walk_state->aml_offset + + (u32)(aml_offset +sizeof (struct acpi_table_header )));/* Dump the context surrounding the invalid opcode */ acpi_ut_dump_buffer (((u8 *)walk_state->parser_state. aml -16 ),48 ,DB_BYTE_DISPLAY , - (walk_state->aml_offset + + (aml_offset +sizeof (struct acpi_table_header ) -16 ));acpi_os_printf (" */\n" );
Signature · 1 line
1.7.10
PATCH 3/22 ACPICA: Parser: Cleanup aml_offset in union acpi_operand_object.
In reply to Lv ZhengACPICA commit 61b360074fde2bb8282722579410f5d1fb12f84d
This patch converts aml_offset in union acpi_operand_object to AML address.
AML offset is actually only used by the debugger, using AML address is more direct and efficient during the parsing stage so that we don't need to calculate the offset during the parsing stage and will not have difficulities in converting it into other offset attributes.
Sometimes, aml_offset is not an indication of the offset from the table header but the offset from the entry of a list of terms, which requires additional efforts to convert it into an offset from the table header. By using AML address directly, there is no such difficulty.
Thus this patch also deletes a logic in disassembler that is trying to convert the aml_offset from
"offset from the start address of Method/Package/Buffer"
into the
"offset from the start address of the ACPI table"
(Sample code deletion can be seen in acpi_dm_deferred_parse(), but the function is not in the Linux kernel). Lv Zheng.
--- drivers/acpi/acpica/aclocal.h | 2 +- drivers/acpi/acpica/psargs.c | 7 +++---- drivers/acpi/acpica/psloop.c | 15 ++++----------- 3 files changed, 8 insertions(+), 16 deletions(-)
drivers/acpi/acpica/aclocal.h +1 -1
@@ -726,7 +726,7 @@ union acpi_parse_value {u8 descriptor_type;/* To differentiate various internal objs */ \u8 flags;/* Type of Op */ \u16 aml_opcode;/* AML opcode */ \ -u32 aml_offset;/* Offset of declaration in AML */ \ +u8 *aml;/* Address of declaration in AML */ \union acpi_parse_object *next;/* Next op */ \struct acpi_namespace_node *node;/* For use by interpreter */ \union acpi_parse_value value;/* Value or args associated with the opcode */ \
drivers/acpi/acpica/psargs.c +3 -4
@@ -484,7 +484,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,static union acpi_parse_object *acpi_ps_get_next_field (struct acpi_parse_state *parser_state) { -u32 aml_offset; +u8 *aml;union acpi_parse_object *field;union acpi_parse_object *arg =NULL ;u16 opcode;
@@ -498,8 +498,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_stateACPI_FUNCTION_TRACE (ps_get_next_field); - aml_offset = - (u32 )ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start); + aml = parser_state->aml;/* Determine field type */
@@ -541,7 +540,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_statereturn_PTR (NULL ); } - field->common.aml_offset = aml_offset; + field->common.aml = aml;/* Decode the field type */
drivers/acpi/acpica/psloop.c +4 -11
@@ -137,10 +137,7 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state, }if (arg) { - arg->common.aml_offset = - (u32 )ACPI_PTR_DIFF (walk_state->aml, - walk_state->parser_state. - aml_start); + arg->common.aml = walk_state->aml;acpi_ps_append_arg (op, arg); }
@@ -494,18 +491,14 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)continue ; } - op->common.aml_offset = - (u32 )ACPI_PTR_DIFF (walk_state->aml, - walk_state->parser_state. - aml_start); + op->common.aml = walk_state->aml;if (walk_state->op_info) {ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n" , +"Opcode %4.4X [%s] Op %p Aml %p\n" , (u32 )op->common.aml_opcode, walk_state->op_info->name, op, - parser_state->aml, - op->common.aml_offset)); + op->common.aml)); } }
Signature · 1 line
1.7.10
PATCH 4/22 ACPICA: Dispatcher: Cleanup union acpi_operand_object's AML address assignments.
In reply to Lv ZhengACPICA commit afb52611dbe7403551f93504d3798534f5c343f4
This patch cleans up the code of assigning the AML address to the union acpi_operand_object.
The idea behind this cleanup is:
The AML address of the union acpi_operand_object should always be determined at the point where the object is encountered. It should be started from the first byte of the object. For example, the opcode of the object, the name string of the user_term object, or the first byte of the packaged object (where a pkg_length is prefixed). So it's not cleaner to have it assigned here and there in the entire ACPICA source tree.
There are some special cases for the internal opcodes, before cleaning up the internal opcodes, we should also determine the rules for the AML addresses of the internal opcodes:
1. INT_NAMEPATH_OP: the address of the first byte for the name_string.
2. INT_METHODCALL_OP: the address of the first byte for the name_string.
3. INT_BYTELIST_OP: the address of the first byte for the byte_data list.
4. INT_EVAL_SUBTREE_OP: the address of the first byte for the Region/Package/Buffer/bank_field/Field arguments.
5. INT_NAMEDFIELD_OP: the address to the name_seg.
6. INT_RESERVEDFIELD_OP: the address to the 0x00 prefix.
7. INT_ACCESSFIELD_OP: the address to the 0x01 prefix.
8. INT_CONNECTION_OP: the address to the 0x02 prefix.
9: INT_EXTACCESSFIELD_OP: the address to the 0x03 prefix. 10.INT_RETURN_VALUE_OP: the address of the replaced operand. 11.computational_data: the address to the
Byte/Word/Dword/Qword/string_prefix.
Before cleaning up the internal root scope of the aml_walk, turning it into the term_list, we need to remember the aml_start address as the "Aml" attribute for the union acpi_operand_object created by acpi_ps_create_scope_op().
Finally, we can delete some redundant AML address assignment in psloop.c.
--- drivers/acpi/acpica/acparser.h | 4 ++-- drivers/acpi/acpica/dsargs.c | 4 ++-- drivers/acpi/acpica/dsmethod.c | 2 +- drivers/acpi/acpica/dswload.c | 2 +- drivers/acpi/acpica/dswload2.c | 2 +- drivers/acpi/acpica/nsparse.c | 40 +++++++++++++++++++--------------------- drivers/acpi/acpica/psargs.c | 21 ++++++++++++--------- drivers/acpi/acpica/psloop.c | 3 --- drivers/acpi/acpica/psobject.c | 2 +- drivers/acpi/acpica/psparse.c | 12 ++++++++---- drivers/acpi/acpica/psutils.c | 8 +++++--- drivers/acpi/acpica/psxface.c | 2 +- 12 files changed, 53 insertions(+), 49 deletions(-)
drivers/acpi/acpica/acparser.h +2 -2
@@ -225,11 +225,11 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *root);/* * psutils - parser utilities */ -union acpi_parse_object *acpi_ps_create_scope_op (void ); +union acpi_parse_object *acpi_ps_create_scope_op (u8 *aml);void acpi_ps_init_op (union acpi_parse_object *op,u16 opcode); -union acpi_parse_object *acpi_ps_alloc_op (u16 opcode); +union acpi_parse_object *acpi_ps_alloc_op (u16 opcode,u8 *aml);void acpi_ps_free_op (union acpi_parse_object *op);
drivers/acpi/acpica/dsargs.c +2 -2
@@ -86,7 +86,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node,/* Allocate a new parser op to be the root of the parsed tree */ - op =acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP ); + op =acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP , aml_start);if (!op) {return_ACPI_STATUS (AE_NO_MEMORY ); }
@@ -129,7 +129,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node,/* Evaluate the deferred arguments */ - op =acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP ); + op =acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP , aml_start);if (!op) {return_ACPI_STATUS (AE_NO_MEMORY ); }
drivers/acpi/acpica/dsmethod.c +1 -1
@@ -103,7 +103,7 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,/* Create/Init a root op for the method parse tree */ - op =acpi_ps_alloc_op (AML_METHOD_OP ); + op =acpi_ps_alloc_op (AML_METHOD_OP , obj_desc->method.aml_start);if (!op) {return_ACPI_STATUS (AE_NO_MEMORY ); }
drivers/acpi/acpica/dswload.c +1 -1
@@ -388,7 +388,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,/* Create a new op */ - op =acpi_ps_alloc_op (walk_state->opcode); + op =acpi_ps_alloc_op (walk_state->opcode, walk_state->aml);if (!op) {return_ACPI_STATUS (AE_NO_MEMORY ); }
drivers/acpi/acpica/dswload2.c +1 -1
@@ -335,7 +335,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,/* Create a new op */ - op =acpi_ps_alloc_op (walk_state->opcode); + op =acpi_ps_alloc_op (walk_state->opcode, walk_state->aml);if (!op) {return_ACPI_STATUS (AE_NO_MEMORY ); }
drivers/acpi/acpica/nsparse.c +19 -21
@@ -78,6 +78,20 @@ acpi_ns_one_complete_parse(u32 pass_number,ACPI_FUNCTION_TRACE (ns_one_complete_parse); + status =acpi_get_table_by_index (table_index, &table); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + +/* Table must consist of at least a complete header */ + +if (table->length <sizeof (struct acpi_table_header )) { +return_ACPI_STATUS (AE_BAD_HEADER ); + } + + aml_start = (u8 *)table +sizeof (struct acpi_table_header ); + aml_length = table->length -sizeof (struct acpi_table_header ); + status =acpi_tb_get_owner_id (table_index, &owner_id);if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);
@@ -85,7 +99,7 @@ acpi_ns_one_complete_parse(u32 pass_number,/* Create and init a Root Node */ - parse_root =acpi_ps_create_scope_op (); + parse_root =acpi_ps_create_scope_op (aml_start);if (!parse_root) {return_ACPI_STATUS (AE_NO_MEMORY ); }
@@ -98,23 +112,12 @@ acpi_ns_one_complete_parse(u32 pass_number,return_ACPI_STATUS (AE_NO_MEMORY ); } - status =acpi_get_table_by_index (table_index, &table); + status =acpi_ds_init_aml_walk (walk_state, parse_root,NULL , + aml_start, aml_length,NULL , + (u8 )pass_number);if (ACPI_FAILURE (status)) {acpi_ds_delete_walk_state (walk_state); -acpi_ps_free_op (parse_root); -return_ACPI_STATUS (status); - } - -/* Table must consist of at least a complete header */ - -if (table->length <sizeof (struct acpi_table_header )) { - status =AE_BAD_HEADER ; - }else { - aml_start = (u8 *)table +sizeof (struct acpi_table_header ); - aml_length = table->length -sizeof (struct acpi_table_header ); - status =acpi_ds_init_aml_walk (walk_state, parse_root,NULL , - aml_start, aml_length,NULL , - (u8 )pass_number); + goto cleanup; }/* Found OSDT table, enable the namespace override feature */
@@ -124,11 +127,6 @@ acpi_ns_one_complete_parse(u32 pass_number, walk_state->namespace_override = TRUE; } -if (ACPI_FAILURE (status)) { -acpi_ds_delete_walk_state (walk_state); - goto cleanup; - } -/* start_node is the default location to load the table */ if (start_node && start_node != acpi_gbl_root_node) {
drivers/acpi/acpica/psargs.c +12 -9
@@ -287,7 +287,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,"Control Method - %p Desc %p Path=%p\n" , node, method_desc, path)); - name_op =acpi_ps_alloc_op (AML_INT_NAMEPATH_OP ); + name_op =acpi_ps_alloc_op (AML_INT_NAMEPATH_OP , start);if (!name_op) {return_ACPI_STATUS (AE_NO_MEMORY ); }
@@ -535,13 +535,11 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* Allocate a new field op */ - field =acpi_ps_alloc_op (opcode); + field =acpi_ps_alloc_op (opcode, aml);if (!field) {return_PTR (NULL ); } - field->common.aml = aml; -/* Decode the field type */ switch (opcode) {
@@ -603,6 +601,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state* Argument for Connection operator can be either a Buffer * (resource descriptor), or a name_string. */ + aml = parser_state->aml;if (ACPI_GET8 (parser_state->aml) ==AML_BUFFER_OP ) { parser_state->aml++;
@@ -615,7 +614,8 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* Non-empty list */ - arg =acpi_ps_alloc_op (AML_INT_BYTELIST_OP ); + arg = +acpi_ps_alloc_op (AML_INT_BYTELIST_OP , aml);if (!arg) {acpi_ps_free_op (field);return_PTR (NULL );
@@ -664,7 +664,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state parser_state->aml = pkg_end; }else { - arg =acpi_ps_alloc_op (AML_INT_NAMEPATH_OP ); + arg =acpi_ps_alloc_op (AML_INT_NAMEPATH_OP , aml);if (!arg) {acpi_ps_free_op (field);return_PTR (NULL );
@@ -729,7 +729,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,/* Constants, strings, and namestrings are all the same size */ - arg =acpi_ps_alloc_op (AML_BYTE_OP ); + arg =acpi_ps_alloc_op (AML_BYTE_OP , parser_state->aml);if (!arg) {return_ACPI_STATUS (AE_NO_MEMORY ); }
@@ -776,7 +776,8 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,/* Non-empty list */ - arg =acpi_ps_alloc_op (AML_INT_BYTELIST_OP ); + arg =acpi_ps_alloc_op (AML_INT_BYTELIST_OP , + parser_state->aml);if (!arg) {return_ACPI_STATUS (AE_NO_MEMORY ); }
@@ -806,7 +807,9 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,/* null_name or name_string */ - arg =acpi_ps_alloc_op (AML_INT_NAMEPATH_OP ); + arg = +acpi_ps_alloc_op (AML_INT_NAMEPATH_OP , + parser_state->aml);if (!arg) {return_ACPI_STATUS (AE_NO_MEMORY ); }
drivers/acpi/acpica/psloop.c +0 -3
@@ -137,7 +137,6 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state, }if (arg) { - arg->common.aml = walk_state->aml;acpi_ps_append_arg (op, arg); }
@@ -491,8 +490,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)continue ; } - op->common.aml = walk_state->aml; -if (walk_state->op_info) { ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Opcode %4.4X [%s] Op %p Aml %p\n",
drivers/acpi/acpica/psobject.c +1 -1
@@ -297,7 +297,7 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state,/* Create Op structure and append to parent's argument list */ walk_state->op_info =acpi_ps_get_opcode_info (walk_state->opcode); - op =acpi_ps_alloc_op (walk_state->opcode); + op =acpi_ps_alloc_op (walk_state->opcode, aml_op_start);if (!op) {return_ACPI_STATUS (AE_NO_MEMORY ); }
drivers/acpi/acpica/psparse.c +8 -4
@@ -185,7 +185,8 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,* op must be replaced by a placeholder return op */ replacement_op = -acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP ); +acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP , + op->common.aml);if (!replacement_op) { status =AE_NO_MEMORY ; }
@@ -209,7 +210,8 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, || (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) { replacement_op = -acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP ); +acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP , + op->common.aml);if (!replacement_op) { status =AE_NO_MEMORY ; }
@@ -224,7 +226,8 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, AML_VAR_PACKAGE_OP)) { replacement_op =acpi_ps_alloc_op (op->common. - aml_opcode); + aml_opcode, + op->common.aml);if (!replacement_op) { status =AE_NO_MEMORY ; }else {
@@ -240,7 +243,8 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,default : replacement_op = -acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP ); +acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP , + op->common.aml);if (!replacement_op) { status =AE_NO_MEMORY ; }
drivers/acpi/acpica/psutils.c +5 -3
@@ -60,11 +60,11 @@ ACPI_MODULE_NAME("psutils")* DESCRIPTION: Create a Scope and associated namepath op with the root name * ******************************************************************************/ -union acpi_parse_object *acpi_ps_create_scope_op (void ) +union acpi_parse_object *acpi_ps_create_scope_op (u8 *aml) {union acpi_parse_object *scope_op; - scope_op =acpi_ps_alloc_op (AML_SCOPE_OP ); + scope_op =acpi_ps_alloc_op (AML_SCOPE_OP , aml);if (!scope_op) {return (NULL ); }
@@ -103,6 +103,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)* FUNCTION: acpi_ps_alloc_op * * PARAMETERS: opcode - Opcode that will be stored in the new Op +* aml - Address of the opcode * * RETURN: Pointer to the new Op, null on failure *
@@ -112,7 +113,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)* ******************************************************************************/ -union acpi_parse_object *acpi_ps_alloc_op (u16 opcode) +union acpi_parse_object *acpi_ps_alloc_op (u16 opcode,u8 *aml) {union acpi_parse_object *op;const struct acpi_opcode_info *op_info;
@@ -149,6 +150,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)if (op) {acpi_ps_init_op (op, opcode); + op->common.aml = aml; op->common.flags = flags; }
drivers/acpi/acpica/psxface.c +1 -1
@@ -256,7 +256,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)/* Create and init a Root Node */ - op =acpi_ps_create_scope_op (); + op =acpi_ps_create_scope_op (info->obj_desc->method.aml_start);if (!op) { status =AE_NO_MEMORY ; goto cleanup;
Signature · 1 line
1.7.10
PATCH 5/22 ACPICA: Executer: Add back pointing reference of method operand.
In reply to Lv ZhengACPICA commit 9dcd124e914e87495fbd1786d9484b962e0823e0
This patch adds back pointing reference of the namespace node for a method operand. The namespace node then can be used in acpi_ds_terminate_control_method() to obtain method full path to be used by tracing facilities. Lv Zheng.
--- drivers/acpi/acpica/acobject.h | 1 + drivers/acpi/acpica/excreate.c | 1 + drivers/acpi/acpica/utdelete.c | 3 +++ 3 files changed, 5 insertions(+)
drivers/acpi/acpica/acobject.h +1 -0
@@ -176,6 +176,7 @@ struct acpi_object_method {u8 param_count;u8 sync_level;union acpi_operand_object *mutex; +union acpi_operand_object *node;u8 *aml_start;union {acpi_internal_method implementation;
drivers/acpi/acpica/excreate.c +1 -0
@@ -486,6 +486,7 @@ acpi_ex_create_method(u8 * aml_start, obj_desc->method.aml_start = aml_start; obj_desc->method.aml_length = aml_length; + obj_desc->method.node = operand[0 ];/* * Disassemble the method flags. Split off the arg_count, Serialized
drivers/acpi/acpica/utdelete.c +3 -0
@@ -209,6 +209,9 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)acpi_ut_delete_object_desc (object->method.mutex); object->method.mutex =NULL ; } +if (object->method.node) { + object->method.node =NULL ; + }break ;case ACPI_TYPE_REGION :
Signature · 1 line
1.7.10
PATCH 6/22 ACPICA: Namespace: Add function to directly return normalized full path.
In reply to Lv ZhengACPICA commit 6e0229bb156d71675f2e07dc7960adb7ec0a60ea
This patch adds functions to return normalized full path instead of "external path". The external path contains trailing "_" for each name segment while the normalized full path doesn't contain the trailing "_".
Currently this function is used by the method tracing users to specify a none trailing "_" attached name path. Lv Zheng.
Note that we need to validate and switch all Linux kernel acpi_get_name() users to use the new name type before removing the old name type from ACPICA.
--- drivers/acpi/acpica/acnamesp.h | 13 +- drivers/acpi/acpica/exdump.c | 5 +- drivers/acpi/acpica/nsnames.c | 275 +++++++++++++++++++++++----------------- drivers/acpi/acpica/nsutils.c | 2 +- drivers/acpi/acpica/nsxfname.c | 8 +- drivers/acpi/acpica/rscreate.c | 3 +- drivers/acpi/acpica/utmisc.c | 2 +- include/acpi/actypes.h | 3 +- 8 files changed, 178 insertions(+), 133 deletions(-)
drivers/acpi/acpica/acnamesp.h +8 -5
@@ -272,17 +272,20 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,*/ u32 acpi_ns_opens_scope (acpi_object_type type); -acpi_status -acpi_ns_build_external_path (struct acpi_namespace_node *node, -acpi_size size,char *name_buffer); -char *acpi_ns_get_external_pathname (struct acpi_namespace_node *node); +u32 +acpi_ns_build_normalized_path (struct acpi_namespace_node *node, +char *full_path,u32 path_size,u8 no_trailing); + +char *acpi_ns_get_normalized_pathname (struct acpi_namespace_node *node, +u8 no_trailing); +char *acpi_ns_name_of_current_scope (struct acpi_walk_state *walk_state);acpi_status acpi_ns_handle_to_pathname (acpi_handle target_handle, -struct acpi_buffer *buffer); +struct acpi_buffer *buffer,u8 no_trailing);u8 acpi_ns_pattern_match (struct acpi_namespace_node *obj_node,char *search_for);
drivers/acpi/acpica/exdump.c +2 -3
@@ -995,9 +995,8 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)if (obj_desc->reference.class ==ACPI_REFCLASS_NAME ) {acpi_os_printf (" %p " , obj_desc->reference.node); - status = -acpi_ns_handle_to_pathname (obj_desc->reference.node, - &ret_buf); + status =acpi_ns_handle_to_pathname (obj_desc->reference.node, + &ret_buf, FALSE);if (ACPI_FAILURE (status)) {acpi_os_printf (" Could not convert name to pathname\n" ); }else {
drivers/acpi/acpica/nsnames.c +156 -119
330 lines not on this page · raw message
drivers/acpi/acpica/nsutils.c +1 -1
@@ -83,7 +83,7 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node, buffer.length =ACPI_ALLOCATE_LOCAL_BUFFER ; - status =acpi_ns_handle_to_pathname (node, &buffer); + status =acpi_ns_handle_to_pathname (node, &buffer, FALSE);if (ACPI_SUCCESS (status)) {if (message) {acpi_os_printf ("%s " , message);
drivers/acpi/acpica/nsxfname.c +6 -2
@@ -172,11 +172,15 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)return (status); } -if (name_type ==ACPI_FULL_PATHNAME ) { +if (name_type ==ACPI_FULL_PATHNAME || + name_type ==ACPI_FULL_PATHNAME_NO_TRAILING ) {/* Get the full pathname (From the namespace root) */ - status =acpi_ns_handle_to_pathname (handle, buffer); + status =acpi_ns_handle_to_pathname (handle, buffer, + name_type == +ACPI_FULL_PATHNAME ? FALSE : + TRUE);return (status); }
drivers/acpi/acpica/rscreate.c +2 -1
@@ -348,7 +348,8 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, status =acpi_ns_handle_to_pathname ((acpi_handle ) node, - &path_buffer); + &path_buffer, + FALSE);/* +1 to include null terminator */
drivers/acpi/acpica/utmisc.c +1 -1
@@ -376,7 +376,7 @@ acpi_ut_display_init_pathname(u8 type,/* Get the full pathname to the node */ buffer.length =ACPI_ALLOCATE_LOCAL_BUFFER ; - status =acpi_ns_handle_to_pathname (obj_handle, &buffer); + status =acpi_ns_handle_to_pathname (obj_handle, &buffer, FALSE);if (ACPI_FAILURE (status)) {return ; }
include/acpi/actypes.h +2 -1
@@ -985,7 +985,8 @@ struct acpi_buffer {*/ #define ACPI_FULL_PATHNAME 0#define ACPI_SINGLE_NAME 1 -#define ACPI_NAME_TYPE_MAX 1 +#define ACPI_FULL_PATHNAME_NO_TRAILING 2 +#define ACPI_NAME_TYPE_MAX 2/* * Predefined Namespace items
Signature · 1 line
1.7.10
PATCH 7/22 ACPICA: Dispatcher: Move stack traversal code to dispatcher.
In reply to Lv ZhengACPICA commit c8275e243b58fd4adfc0362bd704af41ed14bc75
This patch moves parts of acpi_dm_dump_method_info() to the dispatcher component.
This patch also makes the new function dependent on ACPI_DEBUG_OUTPUT compile-stage definition so that it can be used by the trace facility.
acpi_dm_dump_method_info() traverses method stack when an exception is encountered. Such traversal is needed to support method tracing for the exceptions. When an exception is encountered, the end indications of the aborted methods should be logged in order not to break the user space analysis tool. Lv Zheng.
--- drivers/acpi/acpica/Makefile | 1 + drivers/acpi/acpica/acdispat.h | 8 ++ drivers/acpi/acpica/dsdebug.c | 222 ++++++++++++++++++++++++++++++++++++++++ drivers/acpi/acpica/dsmethod.c | 7 +- 4 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 drivers/acpi/acpica/dsdebug.c
drivers/acpi/acpica/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-y += acpi.o acpi-y := \ dsargs.o \ dscontrol.o \ + dsdebug.o \ dsfield.o \ dsinit.o \ dsmethod.o \
drivers/acpi/acpica/acdispat.h +8 -0
@@ -354,4 +354,12 @@ acpi_status acpi_ds_result_push(union acpi_operand_object *object, struct acpi_walk_state *walk_state); +/* +* dsdebug - parser debugging routines +*/ +void +acpi_ds_dump_method_stack (acpi_status status, +struct acpi_walk_state *walk_state, +union acpi_parse_object *op); +#endif /* _ACDISPAT_H_ */
drivers/acpi/acpica/dsdebug.c new file +222 -0
222 lines not on this page · raw message
drivers/acpi/acpica/dsmethod.c +4 -3
@@ -251,14 +251,15 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state * walk_state)acpi_ds_clear_implicit_return (walk_state); -#ifdef ACPI_DISASSEMBLER if (ACPI_FAILURE (status)) { +acpi_ds_dump_method_stack (status, walk_state, walk_state->op);/* Display method locals/args if disassembler is present */ -acpi_dm_dump_method_info (status, walk_state, walk_state->op); - } +#ifdef ACPI_DISASSEMBLER +acpi_dm_dump_method_info (status, walk_state);#endif + }return (status); }
Signature · 1 line
1.7.10
PATCH 8/22 ACPICA: Dispatcher: Add trace support for interpreter.
In reply to Lv ZhengACPICA commit 71299ec8b49054daace0df50268e8e055654ca37
This patch adds trace point at the following point:
1. Begin/end of a control method execution;
2. Begin/end of an opcode execution.
The trace point feature can be enabled by defining ACPI_DEBUG_OUTPUT and specifying a debug level that includes ACPI_LV_TRACDE_POINT and the debug layers that include ACPI_PARSER and ACPI_DISPACTCHER.
In order to make aml_op_name of union acpi_parse_object usable for tracer, it is enabled for ACPI_DEBUG_OUTPUT in this patch. Lv Zheng.
--- drivers/acpi/acpica/aclocal.h | 2 +- drivers/acpi/acpica/dsdebug.c | 24 ++++++++++++++++++++++++ drivers/acpi/acpica/dsmethod.c | 31 +++++++++++++++++++++++++++++++ drivers/acpi/acpica/psloop.c | 15 +++++++++++++++ drivers/acpi/acpica/psparse.c | 4 ++++ include/acpi/acoutput.h | 4 +++- 6 files changed, 78 insertions(+), 2 deletions(-)
drivers/acpi/acpica/aclocal.h +1 -1
@@ -715,7 +715,7 @@ union acpi_parse_value {union acpi_parse_object *arg;/* arguments and contained ops */ }; -#ifdef ACPI_DISASSEMBLER +#if defined(ACPI_DISASSEMBLER ) || defined(ACPI_DEBUG_OUTPUT )#define ACPI_DISASM_ONLY_MEMBERS (a) a;#else #define ACPI_DISASM_ONLY_MEMBERS (a)
drivers/acpi/acpica/dsdebug.c +24 -0
@@ -127,6 +127,8 @@ acpi_ds_dump_method_stack(acpi_status status,struct acpi_thread_state *thread;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);
@@ -170,6 +172,28 @@ acpi_ds_dump_method_stack(acpi_status status,/* Walk list of linked walk states */ 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)); + } + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, " Method [%4.4s] executing: ", acpi_ut_get_node_name(next_walk_state->
drivers/acpi/acpica/dsmethod.c +31 -0
@@ -327,6 +327,7 @@ 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);
@@ -334,6 +335,18 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *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)); + } +/* Prevent wraparound of thread count */ if (obj_desc->method.thread_count ==ACPI_UINT8_MAX ) {
@@ -695,6 +708,7 @@ 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);
@@ -832,5 +846,22 @@ 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)); + } + return_VOID; }
drivers/acpi/acpica/psloop.c +15 -0
@@ -497,6 +497,21 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->op_info->name, op, op->common.aml)); } + +if (walk_state->op_info) { +ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT , +"Begin opcode: %s[0x%p] Class=0x%02x, Type=0x%02x, Flags=0x%04x.\n" , + op->common.aml_op_name, + op->common.aml, + walk_state->op_info->class, + walk_state->op_info->type, + walk_state->op_info->flags)); + }else { +ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT , +"Begin opcode: %s[0x%p].\n" , + op->common.aml_op_name, + op->common.aml)); + } }/*
drivers/acpi/acpica/psparse.c +4 -0
@@ -147,6 +147,10 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,return_ACPI_STATUS (AE_OK );/* OK for now */ } +ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT , +"End opcode: %s[0x%p].\n" , + op->common.aml_op_name, op->common.aml)); +/* Delete this op and the subtree below it if asked to */ if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) !=
include/acpi/acoutput.h +3 -1
@@ -88,7 +88,8 @@#define ACPI_LV_DEBUG_OBJECT 0x00000002#define ACPI_LV_INFO 0x00000004#define ACPI_LV_REPAIR 0x00000008 -#define ACPI_LV_ALL_EXCEPTIONS 0x0000000F +#define ACPI_LV_TRACE_POINT 0x00000010 +#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F/* Trace verbosity level 1 [Standard Trace Level] */
@@ -147,6 +148,7 @@#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)#define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) +#define ACPI_DB_TRACE_POINT ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT)#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)/* Trace level -- also used in the global "DebugLevel" */
Signature · 1 line
1.7.10
PATCH 9/22 ACPICA: Executer: Add interpreter tracing mode for method tracing facility.
In reply to Lv ZhengACPICA 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.
--- drivers/acpi/acpica/acdebug.h | 2 + drivers/acpi/acpica/acglobal.h | 2 - drivers/acpi/acpica/acinterp.h | 18 +++ drivers/acpi/acpica/dsdebug.c | 25 +--- drivers/acpi/acpica/dsmethod.c | 32 +---- drivers/acpi/acpica/exdebug.c | 271 ++++++++++++++++++++++++++++++++++++++++ drivers/acpi/acpica/psloop.c | 16 +-- drivers/acpi/acpica/psparse.c | 4 +- drivers/acpi/acpica/psxface.c | 121 ++---------------- drivers/acpi/acpica/utinit.c | 2 - include/acpi/acoutput.h | 13 ++ include/acpi/acpixf.h | 6 +- 12 files changed, 327 insertions(+), 185 deletions(-)
drivers/acpi/acpica/acdebug.h +2 -0
@@ -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);
drivers/acpi/acpica/acglobal.h +0 -2
@@ -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);/***************************************************************************** *
drivers/acpi/acpica/acinterp.h +18 -0
@@ -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 */
drivers/acpi/acpica/dsdebug.c +5 -20
@@ -48,6 +48,7 @@#ifdef ACPI_DISASSEMBLER #include "acdisasm.h" #endif +#include "acinterp.h" #define _COMPONENT ACPI_DISPATCHERACPI_MODULE_NAME ("dsdebug" )
@@ -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);
@@ -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,
drivers/acpi/acpica/dsmethod.c +3 -29
@@ -327,7 +327,6 @@ 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);
@@ -335,17 +334,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *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 */
@@ -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);
@@ -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; }
drivers/acpi/acpica/exdebug.c +271 -0
291 lines not on this page · raw message
drivers/acpi/acpica/psloop.c +2 -14
@@ -51,6 +51,7 @@#include <acpi/acpi.h> #include "accommon.h" +#include "acinterp.h" #include "acparser.h" #include "acdispat.h" #include "amlcode.h"
@@ -498,20 +499,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) op->common.aml)); } -if (walk_state->op_info) { -ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT , -"Begin opcode: %s[0x%p] Class=0x%02x, Type=0x%02x, Flags=0x%04x.\n" , - op->common.aml_op_name, - op->common.aml, - walk_state->op_info->class, - walk_state->op_info->type, - walk_state->op_info->flags)); - }else { -ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT , -"Begin opcode: %s[0x%p].\n" , - op->common.aml_op_name, - op->common.aml)); - } +acpi_ex_start_trace_opcode (op, walk_state); }/*
drivers/acpi/acpica/psparse.c +1 -3
@@ -147,9 +147,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,return_ACPI_STATUS (AE_OK );/* OK for now */ } -ACPI_DEBUG_PRINT ((ACPI_DB_TRACE_POINT , -"End opcode: %s[0x%p].\n" , - op->common.aml_op_name, op->common.aml)); +acpi_ex_stop_trace_opcode (op, walk_state);/* Delete this op and the subtree below it if asked to */
drivers/acpi/acpica/psxface.c +8 -113
165 lines not on this page · raw message
drivers/acpi/acpica/utinit.c +0 -2
@@ -204,8 +204,6 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_acpi_hardware_present = TRUE; acpi_gbl_last_owner_id_index =0 ; acpi_gbl_next_owner_id_offset =0 ; - acpi_gbl_trace_dbg_level =0 ; - acpi_gbl_trace_dbg_layer =0 ; acpi_gbl_debugger_configuration =DEBUGGER_THREADING ; acpi_gbl_osi_mutex =NULL ; acpi_gbl_reg_methods_executed = FALSE;
include/acpi/acoutput.h +13 -0
@@ -184,6 +184,19 @@#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR)#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) +/* +* Global trace flags +*/ +#define ACPI_TRACE_ENABLED ((u32) 2) +#define ACPI_TRACE_ONESHOT ((u32) 1) + +/* Defaults for trace debugging level/layer */ + +#define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL +#define ACPI_TRACE_LAYER_ALL 0x000001FF +#define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT +#define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER +#if defined (ACPI_DEBUG_OUTPUT ) || !defined (ACPI_NO_ERROR_MESSAGES )/* * The module name is used primarily for error and debug messages.
include/acpi/acpixf.h +4 -2
@@ -251,7 +251,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE);* traced each time it is executed. */ ACPI_INIT_GLOBAL (u32, acpi_gbl_trace_flags,0 ); -ACPI_INIT_GLOBAL (acpi_name, acpi_gbl_trace_method_name,0 ); +ACPI_INIT_GLOBAL(const char *, acpi_gbl_trace_method_name, NULL); +ACPI_INIT_GLOBAL (u32, acpi_gbl_trace_dbg_level,ACPI_TRACE_LEVEL_DEFAULT ); +ACPI_INIT_GLOBAL (u32, acpi_gbl_trace_dbg_layer,ACPI_TRACE_LAYER_DEFAULT );/* * Runtime configuration of debug output control masks. We want the debug
@@ -504,7 +506,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_statusacpi_object_handler handler, void **data))ACPI_EXTERNAL_RETURN_STATUS (acpi_status -acpi_debug_trace (char *name,u32 debug_level, +acpi_debug_trace (const char *name,u32 debug_level,u32 debug_layer,u32 flags))/*
Signature · 1 line
1.7.10
PATCH 10/22 ACPICA: Executer: Add OSL trace hook support.
In reply to Lv ZhengACPICA commit e8e4a9b19d0b72a7b165398bdc961fc2f6f502ec
This patch adds OSL trace hook support.
OSPMs are encouraged to use acpi_os_trace_point() with ACPI_USE_SYSTEM_TRACER defined to implement platform specific trace facility. Lv Zheng.
--- drivers/acpi/acpica/acinterp.h | 4 ++ drivers/acpi/acpica/exdebug.c | 125 ++++++++++++++++++++++++++++------------ drivers/acpi/acpica/utdebug.c | 31 +++++++++- include/acpi/acoutput.h | 3 + include/acpi/acpiosxf.h | 6 ++ include/acpi/acpixf.h | 5 ++ include/acpi/actypes.h | 8 +++ 7 files changed, 144 insertions(+), 38 deletions(-)
drivers/acpi/acpica/acinterp.h +4 -0
@@ -149,6 +149,10 @@ void acpi_ex_stop_trace_opcode(union acpi_parse_object *op, struct acpi_walk_state *walk_state); +void +acpi_ex_trace_point (acpi_trace_event_type type, +u8 begin,u8 *aml,char *pathname); +/* * exfield - ACPI AML (p-code) execution - field manipulation */
drivers/acpi/acpica/exdebug.c +88 -37
160 lines not on this page · raw message
drivers/acpi/acpica/utdebug.c +30 -1
@@ -45,6 +45,7 @@#include <acpi/acpi.h> #include "accommon.h" +#include "acinterp.h" #define _COMPONENT ACPI_UTILITIESACPI_MODULE_NAME ("utdebug" )
@@ -560,8 +561,37 @@ acpi_ut_ptr_exit(u32 line_number, } } +/******************************************************************************* +* +* FUNCTION: acpi_trace_point +* +* PARAMETERS: type - Trace event type +* begin - TRUE if before execution +* aml - Executed AML address +* pathname - Object path +* pointer - Pointer to the related object +* +* RETURN: None +* +* DESCRIPTION: Interpreter execution trace. +* +******************************************************************************/ + +void +acpi_trace_point (acpi_trace_event_type type,u8 begin,u8 *aml,char *pathname) +{ + +ACPI_FUNCTION_ENTRY (); + +acpi_ex_trace_point (type, begin, aml, pathname); + +#ifdef ACPI_USE_SYSTEM_TRACER +acpi_os_trace_point (type, begin, aml, pathname);#endif +} +ACPI_EXPORT_SYMBOL (acpi_trace_point) +#endif #ifdef ACPI_APPLICATION/******************************************************************************* *
@@ -575,7 +605,6 @@ acpi_ut_ptr_exit(u32 line_number,* DESCRIPTION: Print error message to the console, used by applications. * ******************************************************************************/ - void ACPI_INTERNAL_VAR_XFACE acpi_log_error(const char *format, ...) {va_list args;
include/acpi/acoutput.h +3 -0
@@ -447,6 +447,8 @@#define ACPI_DUMP_PATHNAME (a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)#define ACPI_DUMP_BUFFER (a, b) acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) +#define ACPI_TRACE_POINT (a, b, c, d) acpi_trace_point (a, b, c, d) +#else /* ACPI_DEBUG_OUTPUT */ /* * This is the non-debug case -- make everything go away,
@@ -468,6 +470,7 @@#define ACPI_DUMP_PATHNAME (a, b, c, d)#define ACPI_DUMP_BUFFER (a, b)#define ACPI_IS_DEBUG_ENABLED (level, component) 0 +#define ACPI_TRACE_POINT (a, b, c, d)/* Return macros must have a return statement at the minimum */
include/acpi/acpiosxf.h +6 -0
@@ -430,4 +430,10 @@ long acpi_os_get_file_offset(ACPI_FILE file);acpi_status acpi_os_set_file_offset (ACPI_FILE file,long offset,u8 from);#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_trace_point +void +acpi_os_trace_point (acpi_trace_event_type type, +u8 begin,u8 *aml,char *pathname); +#endif +#endif /* __ACPIOSXF_H__ */
include/acpi/acpixf.h +5 -0
@@ -909,6 +909,11 @@ ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6) const char *module_name, u32 component_id, const char *format, ...)) + +ACPI_DBG_DEPENDENT_RETURN_VOID(void + acpi_trace_point(acpi_trace_event_type type, + u8 begin, + u8 *aml, char *pathname)) ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1) void ACPI_INTERNAL_VAR_XFACE acpi_log_error(const char *format, ...))
include/acpi/actypes.h +8 -0
@@ -1247,6 +1247,14 @@ struct acpi_memory_list {#endif }; +/* Definitions of trace event types */ + +typedef enum { +ACPI_TRACE_AML_METHOD , +ACPI_TRACE_AML_OPCODE , +ACPI_TRACE_AML_REGION +}acpi_trace_event_type ; +/* Definitions of _OSI support */ #define ACPI_VENDOR_STRINGS 0x01
Signature · 1 line
1.7.10
PATCH 11/22 ACPICA: Executer: Add option to bypass opcode tracing.
In reply to Lv ZhengACPICA commit 61e9e20aadfaa03184d0959fbdc1fa5cdfea2551
This patch adds option to bypass opcode tracing. The option can be used to reduce the trace message output. Lv Zheng.
--- drivers/acpi/acpica/exdebug.c | 6 ++++-- include/acpi/acoutput.h | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/acpi/acpica/exdebug.c +4 -2
@@ -598,7 +598,8 @@ acpi_ex_start_trace_opcode(union acpi_parse_object *op,ACPI_FUNCTION_NAME (ex_start_trace_opcode); -if (acpi_ex_interpreter_trace_enabled (NULL )) { +if (acpi_ex_interpreter_trace_enabled (NULL ) && + (acpi_gbl_trace_flags &ACPI_TRACE_OPCODE )) {ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE , TRUE, op->common.aml, op->common.aml_op_name); }
@@ -625,7 +626,8 @@ acpi_ex_stop_trace_opcode(union acpi_parse_object *op,ACPI_FUNCTION_NAME (ex_stop_trace_opcode); -if (acpi_ex_interpreter_trace_enabled (NULL )) { +if (acpi_ex_interpreter_trace_enabled (NULL ) && + (acpi_gbl_trace_flags &ACPI_TRACE_OPCODE )) {ACPI_TRACE_POINT (ACPI_TRACE_AML_OPCODE , FALSE, op->common.aml, op->common.aml_op_name); }
include/acpi/acoutput.h +3 -2
@@ -187,8 +187,9 @@/* * Global trace flags */ -#define ACPI_TRACE_ENABLED ((u32) 2) -#define ACPI_TRACE_ONESHOT ((u32) 1) +#define ACPI_TRACE_ENABLED ((u32) 4) +#define ACPI_TRACE_ONESHOT ((u32) 2) +#define ACPI_TRACE_OPCODE ((u32) 1)/* Defaults for trace debugging level/layer */
Signature · 1 line
1.7.10
PATCH 12/22 ACPICA: Parser: Remove redundant opcode execution debugging output.
In reply to Lv ZhengACPICA commit c832b0a9263c560b3ae3ae31d7298ef33988f8d5
This patch removes one redundant debugging output of opcode execution which has already been covered by acpi_ex_start_trace_opcode(). Lv Zheng.
--- drivers/acpi/acpica/psloop.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/acpi/acpica/psloop.c +0 -8
@@ -491,14 +491,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)continue ; } -if (walk_state->op_info) { -ACPI_DEBUG_PRINT ((ACPI_DB_PARSE , -"Opcode %4.4X [%s] Op %p Aml %p\n" , - (u32 )op->common.aml_opcode, - walk_state->op_info->name, op, - op->common.aml)); - } -acpi_ex_start_trace_opcode (op, walk_state); }
Signature · 1 line
1.7.10
PATCH 13/22 ACPICA: Remove extraneous check for null walk_state.
In reply to Lv ZhengFrom: Markus Elfring <[email protected]>
ACPICA commit f9fd6e8bad0f16ce2b436c5cda36ced0c2d85302
Reported by Markus Elfring.
--- drivers/acpi/acpica/dsmethod.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/acpi/acpica/dsmethod.c +1 -3
@@ -582,9 +582,7 @@ cleanup:/* On error, we must terminate the method properly */ acpi_ds_terminate_control_method (obj_desc, next_walk_state); -if (next_walk_state) { -acpi_ds_delete_walk_state (next_walk_state); - } +acpi_ds_delete_walk_state (next_walk_state);return_ACPI_STATUS (status); }
Signature · 1 line
1.7.10
PATCH 14/22 ACPICA: iASL: Add new warnings for method local_x and arg_x variables.
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit eb9f8cb9fd65f1149dd335d05944c31cbca41af3
1) Warn if a Local is set but never used
2) Warn if a arg_x is never used (for non-predefined method names)
3) Warn if a arg_x that is used as a local is never used
This patch only affects iASL which is not in the kernel source tree.
--- drivers/acpi/acpica/aclocal.h | 4 ++++ 1 file changed, 4 insertions(+)
drivers/acpi/acpica/aclocal.h +4 -0
@@ -174,8 +174,12 @@ struct acpi_namespace_node {*/ #ifdef ACPI_LARGE_NAMESPACE_NODE union acpi_parse_object *op; +void *method_locals; +void *method_args;u32 value;u32 length; +u8 arg_count; +#endif };
Signature · 1 line
1.7.10
PATCH 15/22 ACPICA: MSVC: Fix inclusion order issue of <crtdbg.h>.
In reply to Lv ZhengACPICA commit 49c6a6517a906900e9baa51ad5859beeb8a3089f
The following error logs can be seen for calloc/free/malloc/realloc that defined in the stdlib.h:
...\stdlib.h(281) : error C2059: syntax error : ',' ...\stdlib.h(281) : error C2143: syntax error : missing ')' before 'constant' ...\stdlib.h(281) : error C2143: syntax error : missing '{' before 'constant' ...\stdlib.h(281) : error C2059: syntax error : '<Unknown>' ...\stdlib.h(281) : error C2059: syntax error : ')'
This is caused by the wrong inclusion order of stdlib.h/crtdbg.h introduced in acenv.h. This patch fixes this breakage. Lv Zheng.
This patch doesn't affect Linux kernel.
--- include/acpi/platform/acenvex.h | 3 +++ include/acpi/platform/acmsvcex.h | 54 ++++++++++++++++++++++++++++++++++++++ include/acpi/platform/acwinex.h | 49 ++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 include/acpi/platform/acmsvcex.h create mode 100644 include/acpi/platform/acwinex.h
include/acpi/platform/acenvex.h +3 -0
@@ -56,6 +56,9 @@#if defined(_LINUX) || defined(__linux__)#include <acpi/platform/aclinuxex.h> +#elif defined(WIN32 ) +#include "acwinex.h" +#elif defined(_AED_EFI)#include "acefiex.h"
include/acpi/platform/acmsvcex.h new file +54 -0
54 lines not on this page · raw message
include/acpi/platform/acwinex.h new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
1.7.10
PATCH 16/22 ACPICA: Cleanup use of all non-ANSI local C library functions.
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit 7c490c28a18b435c543c6b410e7e7c2131fccc78
ACPICA implements all non-ANSI functions locally. However, there are sometimes two or more versions of the same function throughout the ACPICA code. This change fixes this.
Adds a new file, utilities/utnonansi.c
--- drivers/acpi/acpica/Makefile | 1 + drivers/acpi/acpica/acmacros.h | 4 + drivers/acpi/acpica/acutils.h | 23 ++- drivers/acpi/acpica/utnonansi.c | 380 +++++++++++++++++++++++++++++++++++++++ drivers/acpi/acpica/utstring.c | 342 ----------------------------------- 5 files changed, 396 insertions(+), 354 deletions(-) create mode 100644 drivers/acpi/acpica/utnonansi.c
drivers/acpi/acpica/Makefile +1 -0
@@ -165,6 +165,7 @@ acpi-y += \ utmath.o \ utmisc.o \ utmutex.o \ + utnonansi.o \ utobject.o \ utosi.o \ utownerid.o \
drivers/acpi/acpica/acmacros.h +4 -0
@@ -220,6 +220,10 @@#define ACPI_MUL_32 (a) _ACPI_MUL(a, 5)#define ACPI_MOD_32 (a) _ACPI_MOD(a, 32) +/* Test for ASCII character */ + +#define ACPI_IS_ASCII (c) ((c) < 0x80) +/* * Rounding macros (Power of two boundaries only) */
drivers/acpi/acpica/acutils.h +11 -12
@@ -167,6 +167,17 @@ struct acpi_pkg_info {#define DB_QWORD_DISPLAY 8/* +* utnonansi - Non-ANSI C library functions +*/ +void acpi_ut_strupr (char *src_string); + +void acpi_ut_strlwr (char *src_string); + +int acpi_ut_stricmp (char *string1,char *string2); + +acpi_status acpi_ut_strtoul64 (char *string,u32 base,u64 *ret_integer); + +/* * utglobal - Global data structures and procedures */ acpi_status acpi_ut_init_globals (void );
@@ -205,8 +216,6 @@ acpi_status acpi_ut_hardware_initialize(void);void acpi_ut_subsystem_shutdown (void ); -#define ACPI_IS_ASCII (c) ((c) < 0x80) -/* * utcopy - Object construction and conversion interfaces */
@@ -567,16 +576,6 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag);/* * utstring - String and character utilities */ -void acpi_ut_strupr (char *src_string); - -#ifdef ACPI_ASL_COMPILER -void acpi_ut_strlwr (char *src_string); - -int acpi_ut_stricmp (char *string1,char *string2); -#endif - -acpi_status acpi_ut_strtoul64 (char *string,u32 base,u64 *ret_integer); -void acpi_ut_print_string (char *string,u16 max_length);#if definedACPI_ASL_COMPILER || definedACPI_EXEC_APP
drivers/acpi/acpica/utnonansi.c new file +380 -0
380 lines not on this page · raw message
drivers/acpi/acpica/utstring.c +0 -342
357 lines not on this page · raw message
Signature · 1 line
1.7.10
PATCH 17/22 ACPICA: Cleanup use of NEGATIVE and POSITIVE defines.
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit f88814201e01043a4f8caa69a69b799af11c44a3
These were defined in two places. Changed to ACPI_SIGN* names and define them once in acmacros.h
This patch doesn't affect Linux kernel.
--- drivers/acpi/acpica/acmacros.h | 5 +++++ 1 file changed, 5 insertions(+)
drivers/acpi/acpica/acmacros.h +5 -0
@@ -224,6 +224,11 @@#define ACPI_IS_ASCII (c) ((c) < 0x80) +/* Signed integers */ + +#define ACPI_SIGN_POSITIVE 0 +#define ACPI_SIGN_NEGATIVE 1 +/* * Rounding macros (Power of two boundaries only) */
Signature · 1 line
1.7.10
PATCH 18/22 ACPICA: iASL: Add support for TCPA Server Table.
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit 55fa9555c71eaa99daebed4cd82cfde3875e8c45
In addition to the existing support for the client table.
--- include/acpi/actbl2.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
include/acpi/actbl2.h +13 -4
@@ -1186,20 +1186,29 @@ enum acpi_spmi_interface_types {* December 19, 2014 * * NOTE: There are two versions of the table with the same signature -- -* the client version and the server version. +* the client version and the server version. The common platform_class +* field is used to differentiate the two types of tables. * ******************************************************************************/ -struct acpi_table_tcpa_client { +struct acpi_table_tcpa_hdr {struct acpi_table_header header;/* Common ACPI table header */ u16 platform_class; +}; + +/* +* Values for platform_class above. +* This is how the client and server subtables are differentiated +*/ +#define ACPI_TCPA_CLIENT_TABLE 0 +#define ACPI_TCPA_SERVER_TABLE 1 + +struct acpi_table_tcpa_client {u32 minimum_log_length;/* Minimum length for the event log area */ u64 log_address;/* Address of the event log area */ };struct acpi_table_tcpa_server { -struct acpi_table_header header;/* Common ACPI table header */ -u16 platform_class;u16 reserved;u64 minimum_log_length;/* Minimum length for the event log area */ u64 log_address;/* Address of the event log area */
Signature · 1 line
1.7.10
PATCH 19/22 ACPICA: Debugger: Reduce structure size for debugger.
In reply to Lv ZhengACPICA commit 310e0ae1c4730f4dadc80125125099ab76851499
arg_types in struct acpi_db_method_info is only referenced by ACPI_DEBUGGER.
This patch only affects ACPICA debugger which is only used by a non-kernel tool - acpiexec, so Linux kernel is currently not affected by this patch.
--- drivers/acpi/acpica/aclocal.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpica/aclocal.h +3 -0
@@ -1107,6 +1107,9 @@ struct acpi_db_method_info {* Index of current thread inside all them created. */ char init_args; +#ifdef ACPI_DEBUGGER +acpi_object_type arg_types[4 ]; +#endif char *arguments[4 ];char num_threads_str[11 ];char id_of_thread_str[11 ];
Signature · 1 line
1.7.10
PATCH 20/22 ACPICA: Debugger: Move debugger specific APIs to debugger component.
In reply to Lv ZhengACPICA commit 2164923d60429eea7cd5a4a8629b607af7325afa
Some disassembler APIs should rather be debugger APIs. This patch moves them to the debugger folder to be ready for debugger porting.
Since there is no in-kernel ACPICA debugger in the kernel source tree, this patch doesn't affect the Linux kernel.
--- drivers/acpi/acpica/acdebug.h | 17 +++++++++++++++++ drivers/acpi/acpica/dsmethod.c | 12 +++++------- 2 files changed, 22 insertions(+), 7 deletions(-)
drivers/acpi/acpica/acdebug.h +17 -0
@@ -264,6 +264,23 @@ char *acpi_db_get_next_token(char *string, char **next, acpi_object_type * return_type);/* +* dbobject +*/ +void acpi_db_decode_internal_object (union acpi_operand_object *obj_desc); + +void +acpi_db_display_internal_object (union acpi_operand_object *obj_desc, +struct acpi_walk_state *walk_state); + +void acpi_db_decode_arguments (struct acpi_walk_state *walk_state); + +void acpi_db_decode_locals (struct acpi_walk_state *walk_state); + +void +acpi_db_dump_method_info (acpi_status status, +struct acpi_walk_state *walk_state); + +/* * dbstats - Generation and display of ACPI table statistics */ void acpi_db_generate_statistics (union acpi_parse_object *root,u8 is_method);
drivers/acpi/acpica/dsmethod.c +5 -7
@@ -46,11 +46,9 @@#include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" -#ifdef ACPI_DISASSEMBLER -#include "acdisasm.h" -#endif #include "acparser.h" #include "amlcode.h" +#include "acdebug.h" #define _COMPONENT ACPI_DISPATCHERACPI_MODULE_NAME ("dsmethod" )
@@ -205,7 +203,7 @@ acpi_ds_detect_named_opcodes(struct acpi_walk_state *walk_state,* RETURN: Status * * DESCRIPTION: Called on method error. Invoke the global exception handler if -* present, dump the method data if the disassembler is configured +* present, dump the method data if the debugger is configured * * Note: Allows the exception handler to change the status code *
@@ -254,10 +252,10 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state * walk_state)if (ACPI_FAILURE (status)) {acpi_ds_dump_method_stack (status, walk_state, walk_state->op); -/* Display method locals/args if disassembler is present */ +/* Display method locals/args if debugger is present */ -#ifdef ACPI_DISASSEMBLER -acpi_dm_dump_method_info (status, walk_state); +#ifdef ACPI_DEBUGGER +acpi_db_dump_method_info (status, walk_state);#endif }
Signature · 1 line
1.7.10
PATCH 21/22 ACPICA: iASL/Disassembler: Add prototype verbose mode.
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit add72dca18ab5d02f1bf9b08027570e58da520e8
This mode will emit AML byte code after each ASL statement. This is a prototype only and requires additional development.
This patch only affects ACPICA disassembler which is not in the kernel source tree.
--- drivers/acpi/acpica/acglobal.h | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/acpica/acglobal.h +1 -0
@@ -307,6 +307,7 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE);ACPI_INIT_GLOBAL (u8, acpi_gbl_ignore_noop_operator, FALSE);ACPI_INIT_GLOBAL (u8, acpi_gbl_cstyle_disassembly, TRUE);ACPI_INIT_GLOBAL (u8, acpi_gbl_force_aml_disassembly, FALSE); +ACPI_INIT_GLOBAL(union acpi_parse_object *, acpi_gbl_previous_op, NULL);ACPI_GLOBAL (u8, acpi_gbl_db_opt_disasm);ACPI_GLOBAL (u8, acpi_gbl_db_opt_verbose);
Signature · 1 line
1.7.10
PATCH 22/22 ACPICA: Update version to 20150717.
In reply to Lv ZhengFrom: Bob Moore <[email protected]>
ACPICA commit 8580ce04c1b7aa415c364b06e79edb8aca77dded
Version 20150717.
--- include/acpi/acpixf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
@@ -46,7 +46,7 @@/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20150619 +#define ACPI_CA_VERSION 0x20150717#include <acpi/acconfig.h> #include <acpi/actypes.h>
Signature · 1 line
1.7.10
cover ACPI: Update method tracing facility.
In reply to Lv ZhengThis patch updates method tracing facility according to ACPICA 20150717 release changes.
Lv Zheng (4):
ACPI / sysfs: Add ACPI_LV_REPAIR debug level. ACPI / sysfs: Update method tracing facility. ACPI / Documentation: Update method tracing documentation. ACPI / sysfs: Add support to allow suppress leading "\" in
trace_method_name.
Documentation/acpi/method-tracing.txt | 53 +++++++++---- drivers/acpi/osl.c | 8 ++ drivers/acpi/sysfs.c | 133 ++++++++++++++++++++++++--------- 3 files changed, 145 insertions(+), 49 deletions(-)
Signature · 1 line
1.7.10
PATCH 1/4 ACPI / sysfs: Add ACPI_LV_REPAIR debug level.
This patch updates debug_level file, adding ACPI_LV_REPAIR.
--- drivers/acpi/sysfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/sysfs.c +1 -0
@@ -69,6 +69,7 @@ static const struct acpi_dlevel acpi_debug_levels[] = {ACPI_DEBUG_INIT (ACPI_LV_INIT ),ACPI_DEBUG_INIT (ACPI_LV_DEBUG_OBJECT ),ACPI_DEBUG_INIT (ACPI_LV_INFO ), +ACPI_DEBUG_INIT (ACPI_LV_REPAIR ),ACPI_DEBUG_INIT (ACPI_LV_INIT_NAMES ), ACPI_DEBUG_INIT(ACPI_LV_PARSE),
Signature · 1 line
1.7.10
PATCH 2/4 ACPI / sysfs: Update method tracing facility.
In reply to Lv ZhengThis patch updates the method tracing facility as the acpi_debug_trace() API has been updated to allow it to trace AML interpreter execution, the meanings and the usages of the API parameters are changed due to the updates.
The new API:
1. Uses ACPI_TRACE_ENABLED flag to indicate the enabling of the tracer;
2. Allows tracer still can be enabled when method name is not specified so that the AML interpreter execution can be traced without knowing the method name, which is useful for kernel boot tracing;
3. Supports arbitrary full path name, it doesn't need to be a name related to an entrance of acpi_evaluate_object().
Note that the sysfs parameters are also updated so that when reading the attribute files, ACPICA internal settings are returned.
In order to make the sysfs parameters (acpi.trace_state) available during boot, this patch adds code to bypass ACPICA semaphore/mutex invocations when acpi mutex utilities haven't been initialized.
This patch doesn't update documentation of method tracing facility, it will be updated by further patches.
--- drivers/acpi/osl.c | 8 +++ drivers/acpi/sysfs.c | 136 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 108 insertions(+), 36 deletions(-)
drivers/acpi/osl.c +8 -0
@@ -79,6 +79,7 @@ static void *acpi_irq_context;static struct workqueue_struct *kacpid_wq;static struct workqueue_struct *kacpi_notify_wq;static struct workqueue_struct *kacpi_hotplug_wq; +static bool acpi_os_initialized;/* * This list of permanent mappings is for memory that may be accessed from
@@ -1312,6 +1313,9 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)long jiffies;int ret =0 ; +if (!acpi_os_initialized) +return AE_OK ; +if (!sem || (units <1 ))return AE_BAD_PARAMETER ;
@@ -1351,6 +1355,9 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) {struct semaphore *sem = (struct semaphore *)handle; +if (!acpi_os_initialized) +return AE_OK ; +if (!sem || (units <1 ))return AE_BAD_PARAMETER ;
@@ -1859,6 +1866,7 @@ acpi_status __init acpi_os_initialize(void) rv =acpi_os_map_generic_address (&acpi_gbl_FADT.reset_register);pr_debug (PREFIX "%s: map reset_reg status %d\n" , __func__, rv); } + acpi_os_initialized = true;return AE_OK ; }
drivers/acpi/sysfs.c +100 -36
161 lines not on this page · raw message
Signature · 1 line
1.7.10
PATCH 3/4 ACPI / Documentation: Update method tracing documentation.
In reply to Lv ZhengThis patch updates method tracing documentation.
--- Documentation/acpi/method-tracing.txt | 53 ++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 14 deletions(-)
Documentation/acpi/method-tracing.txt +39 -14
@@ -1,26 +1,51 @@ /sys/module/acpi/parameters/: trace_method_name - The AML method name that the user wants to trace + The full path of the AML method that the user wants to use with the + "method"/"method-once" tracing mode. + Note that the full path shouldn't contain the trailing "_"s in its + name segments but should contain "\" to form an absolute path. trace_debug_layer - The temporary debug_layer used when tracing the method. - Using 0xffffffff by default if it is 0. + The temporary debug_layer used when the tracing feature is enabled. + Using ACPI_EXECUTER (0x80) by default. trace_debug_level - The temporary debug_level used when tracing the method. - Using 0x00ffffff by default if it is 0. + The temporary debug_level used when the tracing feature is enabled. + Using ACPI_LV_TRACE_POINT (0x10) by default. trace_state The status of the tracing feature. - "enabled" means this feature is enabled - and the AML method is traced every time it's executed. + Users can enable/disable this debug tracing feature by executing + the following command: + # echo string > /sys/module/acpi/parameters/trace_state + Where "string" should be one of the followings: + "disable" + Disable the tracing feature. + "enable" + Enable the tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during any method + execution will be logged. + "method" + Enable the tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during method execution + of "trace_method_name" will be logged. + "method-once" + Enable the tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during method execution + of "trace_method_name" will be logged only once. + "opcode" + Enable the tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during method/opcode + execution of "trace_method_name" will be logged. + "opcode-once" + Enable the tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during method/opcode + execution of "trace_method_name" will be logged only once. - "1" means this feature is enabled and the AML method - will only be traced during the next execution. - - "disabled" means this feature is disabled. - Users can enable/disable this debug tracing feature by - "echo string > /sys/module/acpi/parameters/trace_state". - "string" should be one of "enable", "disable" and "1".
Signature · 1 line
1.7.10
PATCH 4/4 ACPI / sysfs: Add support to allow leading "\" missing in trace_method_name.
In reply to Lv ZhengSince _SB.PCI0 can be used as relative path from root and can be easily converted into internal trace_method_name format, we allow users to specify trace_method_name using relative paths from root.
Note this is useful for grub2 for which users failed to pass "\" from the grub configuration file.
--- drivers/acpi/sysfs.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/acpi/sysfs.c +13 -15
@@ -164,14 +164,18 @@ static const struct kernel_param_ops param_ops_debug_level = {module_param_cb (debug_layer, ¶m_ops_debug_layer, &acpi_dbg_layer,0644 );module_param_cb (debug_level, ¶m_ops_debug_level, &acpi_dbg_level,0644 ); -static char * trace_method_name; -static bool trace_method_kmalloced; +static char trace_method_name[1024 ];int param_set_trace_method_name (const char *val,const struct kernel_param *kp) {u32 saved_flags =0 ; +bool is_abs_path = true; -if (strlen (val) >1024 ) { +if (*val !='\\' ) + is_abs_path = false; + +if ((is_abs_path &&strlen (val) >1023 ) || + (!is_abs_path &&strlen (val) >1022 )) {pr_err ("%s: string parameter too long\n" , kp->name);return -ENOSPC ; }
@@ -187,19 +191,13 @@ int param_set_trace_method_name(const char *val, const struct kernel_param *kp) acpi_gbl_trace_dbg_layer, 0); -if (trace_method_kmalloced) -kfree (trace_method_name); - trace_method_name =NULL ; - trace_method_kmalloced = false; -/* This is a hack. We can't kmalloc in early boot. */ -if (slab_is_available ()) { - trace_method_name =kstrdup (val,GFP_KERNEL ); -if (!trace_method_name) -return -ENOMEM ; - trace_method_kmalloced = true; - }else - trace_method_name = (char *)val; +if (is_abs_path) +strcpy (trace_method_name, val); +else { + trace_method_name[0 ] ='\\' ; +strcpy (trace_method_name+1 , val); + }/* Restore the original tracer state */ (void)acpi_debug_trace(trace_method_name,
Signature · 1 line
1.7.10
Re: [PATCH 0/4] ACPI: Update method tracing facility.
In reply to Lv ZhengQuoted 2 lines · Lv Zheng
This patch updates method tracing facility according to ACPICA 20150717 release changes.
Can you please explain this in a few more words.
Why do we need to update the interface?
Rafael
RE: [PATCH 0/4] ACPI: Update method tracing facility.
Hi, Rafael
ACPICA logs contain details (trace logs) that may be useful for development.
But the quantity of the trace logs are huge to be put into the kernel log buffer.
Originally, we have a "trace log reducer" in /sys/modules/acpi/parameter, it is the method tracing facility.
We can specify a method name, for example, "_PS0", and corresponding debug layer/level for the "trace log reducer". When the AML interpreter starts to execute the method, the tracing debug level/layer will be applied.
When the AML interpreter stops to execute the method, the original debug level/layer is restored.
Thus the ACPICA trace logs can only be enabled during the period the specified method is executed and its output thus can be reduced. The facility invokes acpi_debug_trace() to do the flexible settings.
See Documentation/acpi/method-tracing.txt for reference.
Actually, the "trace log reducer" facility is buggy and some of the shortcomings put us into the trouble in using it.
1. We cannot specify a full path for the tracing method. For example, though we only want to track \_SB,PCI0.I2C0._PS0, we can only specify "_PS0" and all _PS0 method execution logs will be dumped, the unwanted _PS0 execution trace logs may still blow the kernel log buffer up.
2. We can only specify a method that is passed to acpi_evaluate_object(). For example, if \_SB.LID0._LID invokes \_SB.PCI0.LPCB.H_EC.ECRD, since Linux never passes \_SB.PCI0.LPCB.H_EC.ECRD to acpi_evaluate_object(), specifying "ECRD" cannot match the start of the execution to enable the "trace log reducer".
So during this ACPICA release, we re-implement the facility in the ACPICA dispatcher rather than implementing it in acpi_evaluate_object and allows the full path to be specified to precisely lock on a specific control method.
It is achieved by doing the following improvements:
1. Re-implements the facility in the ACPICA dispatcher component.
1. Introduce a new AML path -> ASL path decoding facility to zap the trailing underscore. Originally ACPICA decodes AML path into such a format that the user must explicitly specify the trailing. And users are likely to forget to put the underscores and leave us with useless trace logs.
2. Move the exception stack walker from the ACPICA debugger component to the ACPICA dispatcher component. When an exception is encountered, AML interpreter just jumps to the top of the stack. Thus we need a facility to walk the stack so that the method can be matched to implement the "end of the tracing".
And with the improvements, we now can do an exciting tracing:
1. When the trace is enabled, we add new log entries for the begin/end of each control method that is executed by the interpreter.
2. When the trace is enabled, we add new log entries for the begin/end of each opcode that is executed by the interpreter.
3. We allow the method virtual address and the opcode virtual address to be dumped along with the begin/end logs. This makes it possible to draw a AML call graph using the dumped log and we can calculate the execution time of a control method/opcode. We can use it either for performance tuning or remote debugging.
The new feature is known as "AML execution tracer".
All of above improvements are done to the acpi_debug_trace(), new features/parameters are added to this ACPICA interface.
Now acpi_debug_trace() can be used not only as the "trace log reducer" but also the "AML execution tracer".
As its user, /sys/modules/acpi/parameters/trace_xxx files need to be updated so that we can use the fixed/improved old feature and the new feature in the Linux kernel.
There is an user experience example of the new feature (AML execution tracer) on the kernel Bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=70891
The user reported a delay to the ACPICA developers mailing list and I helped to file a bug there.
With the assistance of this debugging facility (see comment 29, 30, 31), I found the delay was caused by the EC driver (so this is really an effective debugging facility). This bug (erroneously reported as an ACPICA issue) motivated me to look at the Linux EC driver and offered the fixes to help to improve the quality of the EC/GPE implementations.
Hope this explanation can help.
Thanks and best regards
-Lv
Quoted 12 lines
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, July 24, 2015 4:51 AMQuoted 2 lines · Lv Zheng
This patch updates method tracing facility according to ACPICA 20150717 release changes.
Can you please explain this in a few more words.
Why do we need to update the interface?
Rafael
Re: [PATCH 0/4] ACPI: Update method tracing facility.
Quoted 1 line · Lv
Hi, Rafael
Hi,
Quoted 32 lines
ACPICA logs contain details (trace logs) that may be useful for development.
But the quantity of the trace logs are huge to be put into the kernel log buffer.
Originally, we have a "trace log reducer" in/sys/modules/acpi/parameter, it is the method tracing facility.
We can specify a method name, for example, "_PS0", and corresponding debug layer/level for the "trace log reducer". When the AML interpreter starts to execute the method, the tracing debug level/layer will be applied.
When the AML interpreter stops to execute the method, the original debug level/layer is restored.
Thus the ACPICA trace logs can only be enabled during the period the specified method is executed and its output thus can be reduced. The facility invokesacpi_debug_trace()to do the flexible settings.
SeeDocumentation/acpi/method-tracing.txtfor reference.Actually, the "trace log reducer" facility is buggy and some of the shortcomings put us into the trouble in using it.
1. We cannot specify a full path for the tracing method. For example, though we only want to track \_SB,PCI0.I2C0._PS0, we can only specify "_PS0" and all_PS0method execution logs will be dumped, the unwanted_PS0execution trace logs may still blow the kernel log buffer up.
2. We can only specify a method that is passed toacpi_evaluate_object(). For example, if \_SB.LID0._LID invokes \_SB.PCI0.LPCB.H_EC.ECRD, since Linux never passes \_SB.PCI0.LPCB.H_EC.ECRD toacpi_evaluate_object(), specifying "ECRD" cannot match the start of the execution to enable the "trace log reducer".So during this ACPICA release, we re-implement the facility in the ACPICA dispatcher rather than implementing it in
acpi_evaluate_objectand allows the full path to be specified to precisely lock on a specific control method.
It is achieved by doing the following improvements:
1. Re-implements the facility in the ACPICA dispatcher component.
1. Introduce a new AML path -> ASL path decoding facility to zap the trailing underscore. Originally ACPICA decodes AML path into such a format that the user must explicitly specify the trailing. And users are likely to forget to put the underscores and leave us with useless trace logs.
2. Move the exception stack walker from the ACPICA debugger component to the ACPICA dispatcher component. When an exception is encountered, AML interpreter just jumps to the top of the stack. Thus we need a facility to walk the stack so that the method can be matched to implement the "end of the tracing".And with the improvements, we now can do an exciting tracing:
1. When the trace is enabled, we add new log entries for the begin/end of each control method that is executed by the interpreter.
2. When the trace is enabled, we add new log entries for the begin/end of each opcode that is executed by the interpreter.
3. We allow the method virtual address and the opcode virtual address to be dumped along with the begin/end logs. This makes it possible to draw a AML call graph using the dumped log and we can calculate the execution time of a control method/opcode. We can use it either for performance tuning or remote debugging.
The new feature is known as "AML execution tracer".All of above improvements are done to the
acpi_debug_trace(), new features/parameters are added to this ACPICA interface.
Nowacpi_debug_trace()can be used not only as the "trace log reducer" but also the "AML execution tracer".
As its user,/sys/modules/acpi/parameters/trace_xxxfiles need to be updated so that we can use the fixed/improved old feature and the new feature in the Linux kernel.
Quoted 7 lines
There is an user experience example of the new feature (AML execution tracer) on the kernel Bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=70891
The user reported a delay to the ACPICA developers mailing list and I helped to file a bug there.
With the assistance of this debugging facility (see comment 29, 30, 31), I found the delay was caused by the EC driver (so this is really an effective debugging facility). This bug (erroneously reported as an ACPICA issue) motivated me to look at the Linux EC driver and offered the fixes to help to improve the quality of the EC/GPE implementations.Hope this explanation can help.
All of that is good information, so what about sending a documentation patch with it?
Rafael
RE: [PATCH 0/4] ACPI: Update method tracing facility.
Hi, Rafael
Quoted 56 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Rafael J. Wysocki
Sent: Saturday, July 25, 2015 3:56 AMQuoted 1 line · Lv
Hi, Rafael
Hi,
Quoted 7 lines
ACPICA logs contain details (trace logs) that may be useful for development.
But the quantity of the trace logs are huge to be put into the kernel log buffer.
Originally, we have a "trace log reducer" in/sys/modules/acpi/parameter, it is the method tracing facility. We can specify a method name, for example, "_PS0", and corresponding debug layer/level for the "trace log reducer". When the AML interpreter starts to execute the method, the tracing debug level/layer will be applied. When the AML interpreter stops to execute the method, the original debug level/layer is restored.
Thus the ACPICA trace logs can only be enabled during the period the specified method is executed and its output thus can bereduced.
Quoted 5 lines
The facility invokes
acpi_debug_trace()to do the flexible settings. SeeDocumentation/acpi/method-tracing.txtfor reference.Actually, the "trace log reducer" facility is buggy and some of the shortcomings put us into the trouble in using it.
1. We cannot specify a full path for the tracing method. For example, though we only want to track \_SB,PCI0.I2C0._PS0, we can onlyspecify "
_PS0" and all_PS0method execution logs will be dumped, the unwanted_PS0execution trace logs may still blow the kernel log buffer up.Quoted 1 line
2. We can only specify a method that is passed to
acpi_evaluate_object(). For example, if \_SB.LID0._LID invokes\_SB.PCI0.LPCB.H_EC.ECRD, since Linux never passes \_SB.PCI0.LPCB.H_EC.ECRD to
acpi_evaluate_object(), specifying "ECRD" cannot match the start of the execution to enable the "trace log reducer".Quoted 2 lines
So during this ACPICA release, we re-implement the facility in the ACPICA dispatcher rather than implementing it in
acpi_evaluate_objectand allows the full path to be specified to precisely lock on a specific control method.Quoted 3 lines
It is achieved by doing the following improvements:
1. Re-implements the facility in the ACPICA dispatcher component.
1. Introduce a new AML path -> ASL path decoding facility to zap the trailing underscore. Originally ACPICA decodes AML path intosuch a format that the user must explicitly specify the trailing. And users are likely to forget to put the underscores and leave us with useless trace logs.
Quoted 1 line
2. Move the exception stack walker from the ACPICA debugger component to the ACPICA dispatcher component. When an
exception is encountered, AML interpreter just jumps to the top of the stack. Thus we need a facility to walk the stack so that the method can be matched to implement the "end of the tracing".
Quoted 6 lines
And with the improvements, we now can do an exciting tracing:
1. When the trace is enabled, we add new log entries for the begin/end of each control method that is executed by the interpreter.
2. When the trace is enabled, we add new log entries for the begin/end of each opcode that is executed by the interpreter.
3. We allow the method virtual address and the opcode virtual address to be dumped along with the begin/end logs. This makes it possible to draw a AML call graph using the dumped log and we can calculate the execution time of a controlmethod/opcode.
Quoted 6 lines
We can use it either for performance tuning or remote debugging. The new feature is known as "AML execution tracer".
All of above improvements are done to the
acpi_debug_trace(), new features/parameters are added to this ACPICA interface. Nowacpi_debug_trace()can be used not only as the "trace log reducer" but also the "AML execution tracer". As its user,/sys/modules/acpi/parameters/trace_xxxfiles need to be updated so that we can use the fixed/improved old featureand the new feature in the Linux kernel.
Quoted 5 lines
There is an user experience example of the new feature (AML execution tracer) on the kernel Bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=70891
The user reported a delay to the ACPICA developers mailing list and I helped to file a bug there.
With the assistance of this debugging facility (see comment 29, 30, 31), I found the delay was caused by the EC driver (so this is really
Quoted 8 lines
an effective debugging facility).
Quoted 1 line
This bug (erroneously reported as an ACPICA issue) motivated me to look at the Linux EC driver and offered the fixes to help to
improve the quality of the EC/GPE implementations.
Quoted 2 lines
Hope this explanation can help.
All of that is good information, so what about sending a documentation patch with it?
OK, I'll re-send this patchset to include the above information in Documentation/acpi/method-tracing.txt.
Thanks and best regards
-Lv
Quoted 7 lines
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 65 lines · Lv Zheng
The 20150717 ACPICA kernel-resident subsystem updates are linuxized based on the linux-pm/linux-next branch.
The patchset has passed the following build/boot tests. Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + allyes +CONFIG_ACPI=y
3. i386 + default + COFNIG_ACPI=n
4. i386 + allyes +CONFIG_ACPI=n
5.x86_64+ default + COFNIG_ACPI=y
6.x86_64+ allyes +CONFIG_ACPI=y
7.x86_64+ default + COFNIG_ACPI=n
8.x86_64+ allyes +CONFIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2.x86_64+ default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2.x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
All hardware drivers related to the machines of i386/x86_64 All "drivers/acpi" configurations
All "drivers/platform" drivers
All other drivers that link the APIs provided by ACPICA subsystemThe divergences checking result:
Before applying (20150619 Release):
539 lines
After applying (20150717 Release):
518 lines
Note that the reduction is due to:
1. The FACS related divergences are not counted;
2. Some debugger related divergences are merged in this release as the configurability of the debugger code has improved.Bob Moore (6):
ACPICA: iASL: Add new warnings for methodlocal_xandarg_x
variables.
ACPICA: Cleanup use of all non-ANSI local C library functions.
ACPICA: Cleanup use of NEGATIVE and POSITIVE defines.
ACPICA: iASL: Add support for TCPA Server Table.
ACPICA: iASL/Disassembler: Add prototype verbose mode.
ACPICA: Update version to 20150717.Lv Zheng (15):
ACPICA: Parser: Reduce parser/namespace divergences for tracer
support.
ACPICA: Parser: Cleanupaml_offsetin structacpi_walk_state.
ACPICA: Parser: Cleanupaml_offsetin unionacpi_operand_object.
ACPICA: Dispatcher: Cleanup union acpi_operand_object's AML address
assignments.
ACPICA: Executer: Add back pointing reference of method operand.
ACPICA: Namespace: Add function to directly return normalized full
path.
ACPICA: Dispatcher: Move stack traversal code to dispatcher.
ACPICA: Dispatcher: Add trace support for interpreter.
ACPICA: Executer: Add interpreter tracing mode for method tracing
facility.
ACPICA: Executer: Add OSL trace hook support.
ACPICA: Executer: Add option to bypass opcode tracing.
ACPICA: Parser: Remove redundant opcode execution debugging output.
ACPICA: MSVC: Fix inclusion order issue of <crtdbg.h>.
ACPICA: Debugger: Reduce structure size for debugger.
ACPICA: Debugger: Move debugger specific APIs to debugger component.
Quoted 2 lines
Markus Elfring (1):
ACPICA: Remove extraneous check for nullwalk_state.
Series queued up for 4.3, thanks!
Rafael
Hi, Rafael
You may also need this patch:
https://patchwork.kernel.org/patch/6879621/
Which fixes a problem in this release.
Sorry for noticing this late.
Thanks and best regards
-Lv
Quoted 75 lines
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Wednesday, July 29, 2015 8:58 AMQuoted 65 lines · Lv Zheng
The 20150717 ACPICA kernel-resident subsystem updates are linuxized based on the linux-pm/linux-next branch.
The patchset has passed the following build/boot tests. Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + allyes +CONFIG_ACPI=y
3. i386 + default + COFNIG_ACPI=n
4. i386 + allyes +CONFIG_ACPI=n
5.x86_64+ default + COFNIG_ACPI=y
6.x86_64+ allyes +CONFIG_ACPI=y
7.x86_64+ default + COFNIG_ACPI=n
8.x86_64+ allyes +CONFIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2.x86_64+ default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2.x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
All hardware drivers related to the machines of i386/x86_64 All "drivers/acpi" configurations
All "drivers/platform" drivers
All other drivers that link the APIs provided by ACPICA subsystemThe divergences checking result:
Before applying (20150619 Release):
539 lines
After applying (20150717 Release):
518 lines
Note that the reduction is due to:
1. The FACS related divergences are not counted;
2. Some debugger related divergences are merged in this release as the configurability of the debugger code has improved.Bob Moore (6):
ACPICA: iASL: Add new warnings for methodlocal_xandarg_x
variables.
ACPICA: Cleanup use of all non-ANSI local C library functions.
ACPICA: Cleanup use of NEGATIVE and POSITIVE defines.
ACPICA: iASL: Add support for TCPA Server Table.
ACPICA: iASL/Disassembler: Add prototype verbose mode.
ACPICA: Update version to 20150717.Lv Zheng (15):
ACPICA: Parser: Reduce parser/namespace divergences for tracer
support.
ACPICA: Parser: Cleanupaml_offsetin structacpi_walk_state.
ACPICA: Parser: Cleanupaml_offsetin unionacpi_operand_object.
ACPICA: Dispatcher: Cleanup union acpi_operand_object's AML address
assignments.
ACPICA: Executer: Add back pointing reference of method operand.
ACPICA: Namespace: Add function to directly return normalized full
path.
ACPICA: Dispatcher: Move stack traversal code to dispatcher.
ACPICA: Dispatcher: Add trace support for interpreter.
ACPICA: Executer: Add interpreter tracing mode for method tracing
facility.
ACPICA: Executer: Add OSL trace hook support.
ACPICA: Executer: Add option to bypass opcode tracing.
ACPICA: Parser: Remove redundant opcode execution debugging output.
ACPICA: MSVC: Fix inclusion order issue of <crtdbg.h>.
ACPICA: Debugger: Reduce structure size for debugger.
ACPICA: Debugger: Move debugger specific APIs to debugger component.Quoted 2 lines
Markus Elfring (1):
ACPICA: Remove extraneous check for nullwalk_state.Series queued up for 4.3, thanks!
Rafael
v2 cover ACPI: Update method tracing facility.
In reply to Lv ZhengACPICA subsystem provides debugging outputs when CONFIG_ACPI_DEBUG is enabled. The debugging messages which are deployed via ACPI_DEBUG_PRINT() macro can be reduced at 2 levels - per-component level (known as debug layer) and per-type level (known as debug level). But when the particular layer/level is specified for all control method evaluations, the quantity of the debugging outputs may still be too huge to be put into the kernel log buffer.
Originally we have a method tracing facility to further reduce the debugging output so that the debugging output can be bounded to the specified control method evaluation(s).
Let me call it "log reducer" to distinguish another feature provided by the method tracing facility.
We can specify a method name, for example, "_PS0", and corresponding debug layer/level for the "log reducer". When the AML interpreter starts to execute the method, the tracing debug layer/level will be applied. When the AML interpreter stops to execute the method, the original debug layer/level is restored.
In this way, the useful debug layer/level can only apply when the matched method is executed and the debugging output thus can be reduced.
The facility invokes acpi_debug_trace() to do the flexible settings. See Documentation/acpi/method-tracing.txt for reference.
Actually, the "log reducer" facility is buggy and some of the shortcomings put us into the trouble in using it.
1. We cannot specify a full path for the tracing method. For example, though we only want to track \_SB,PCI0.I2C0._PS0, we can only specify "_PS0" and all _PS0 method execution logs will be dumped, the unwanted _PS0 execution trace logs may still blow the kernel log buffer up.
2. We can only specify a method that is passed to acpi_evaluate_object(). For example, if \_SB.LID0._LID invokes \_SB.PCI0.LPCB.H_EC.ECRD, since Linux never passes \_SB.PCI0.LPCB.H_EC.ECRD to acpi_evaluate_object(), specifying "ECRD" cannot match the start of the execution to enable the "log reducer".
In order to achieve the fixes, the following enhancements are done during this ACPICA 20150717 release:
1. During this ACPICA 20150717 release, we re-implement the facility in the ACPICA dispatcher rather than implementing it in acpi_evaluate_object() and allows the full path to be specified to precisely lock on a specific control method. It is achieved by doing the following improvements:
1. Re-implements the facility in the ACPICA dispatcher component ratner than implementing it in acpi_evaluate_object().
2. Allows full path to be specified to precisely lock on a specific control method.
3. Introduce a new AML path -> ASL path decoding facility to zap the trailing underscore. Originally ACPICA decodes AML path into such a format that the user must explicitly specify the trailing. And users are likely to forget to put the underscores and leave us with useless trace logs.
4. Move the exception stack walker from the ACPICA debugger component to the ACPICA dispatcher component. When an exception is encountered, AML interpreter just jumps to the top of the stack. Thus we need a facility to walk the stack so that the method can be matched to implement the "end of the tracing".
And with the improvements, we now can do an exciting tracing:
1. When the trace is enabled, we add new log entries for the begin/end of each control method that is executed by the interpreter.
2. When the trace is enabled, we add new log entries for the begin/end of each opcode that is executed by the interpreter.
3. We allow the method virtual address and the opcode virtual address to be dumped along with the begin/end logs.
This makes it possible to draw a AML call graph using the dumped log and we can calculate the execution time of a control method/opcode. We can use it either for performance tuning or remote debugging. Let me call the new feature as "AML tracer" to distinguish it from the feature described above.
All of the above improvements are done to the acpi_debug_trace(), new features/parameters are added to this ACPICA interface. Now acpi_debug_trace() can be used not only as the "log reducer" but also the "AML tracer".
As the userspace interface of acpi_debug_trace(), /sys/modules/acpi/parameters/trace_xxx files need to be updated so that we can use the fixed/improved old feature and the new feature in the Linux kernel.
Lv Zheng (4):
ACPI / sysfs: Add ACPI_LV_REPAIR debug level. ACPI / sysfs: Update method tracing facility. ACPI / sysfs: Add support to allow leading "\" missing in
trace_method_name.
ACPI / Documentation: Update method tracing documentation.
Documentation/acpi/method-tracing.txt | 204 ++++++++++++++++++++++++++++++--- drivers/acpi/osl.c | 8 ++ drivers/acpi/sysfs.c | 133 +++++++++++++++------ 3 files changed, 291 insertions(+), 54 deletions(-)
Signature · 1 line
1.7.10
PATCH v2 1/4 ACPI / sysfs: Add ACPI_LV_REPAIR debug level.
This patch updates debug_level file, adding ACPI_LV_REPAIR.
--- drivers/acpi/sysfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/sysfs.c +1 -0
@@ -69,6 +69,7 @@ static const struct acpi_dlevel acpi_debug_levels[] = {ACPI_DEBUG_INIT (ACPI_LV_INIT ),ACPI_DEBUG_INIT (ACPI_LV_DEBUG_OBJECT ),ACPI_DEBUG_INIT (ACPI_LV_INFO ), +ACPI_DEBUG_INIT (ACPI_LV_REPAIR ),ACPI_DEBUG_INIT (ACPI_LV_INIT_NAMES ), ACPI_DEBUG_INIT(ACPI_LV_PARSE),
Signature · 1 line
1.7.10
PATCH v2 2/4 ACPI / sysfs: Update method tracing facility.
In reply to Lv ZhengThis patch updates the method tracing facility as the acpi_debug_trace() API has been updated to allow it to trace AML interpreter execution, the meanings and the usages of the API parameters are changed due to the updates.
The new API:
1. Uses ACPI_TRACE_ENABLED flag to indicate the enabling of the tracer;
2. Allows tracer still can be enabled when method name is not specified so that the AML interpreter execution can be traced without knowing the method name, which is useful for kernel boot tracing;
3. Supports arbitrary full path name, it doesn't need to be a name related to an entrance of acpi_evaluate_object().
Note that the sysfs parameters are also updated so that when reading the attribute files, ACPICA internal settings are returned.
In order to make the sysfs parameters (acpi.trace_state) available during boot, this patch adds code to bypass ACPICA semaphore/mutex invocations when acpi mutex utilities haven't been initialized.
This patch doesn't update documentation of method tracing facility, it will be updated by further patches.
--- drivers/acpi/osl.c | 8 +++ drivers/acpi/sysfs.c | 136 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 108 insertions(+), 36 deletions(-)
drivers/acpi/osl.c +8 -0
@@ -79,6 +79,7 @@ static void *acpi_irq_context;static struct workqueue_struct *kacpid_wq;static struct workqueue_struct *kacpi_notify_wq;static struct workqueue_struct *kacpi_hotplug_wq; +static bool acpi_os_initialized;/* * This list of permanent mappings is for memory that may be accessed from
@@ -1312,6 +1313,9 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)long jiffies;int ret =0 ; +if (!acpi_os_initialized) +return AE_OK ; +if (!sem || (units <1 ))return AE_BAD_PARAMETER ;
@@ -1351,6 +1355,9 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) {struct semaphore *sem = (struct semaphore *)handle; +if (!acpi_os_initialized) +return AE_OK ; +if (!sem || (units <1 ))return AE_BAD_PARAMETER ;
@@ -1859,6 +1866,7 @@ acpi_status __init acpi_os_initialize(void) rv =acpi_os_map_generic_address (&acpi_gbl_FADT.reset_register);pr_debug (PREFIX "%s: map reset_reg status %d\n" , __func__, rv); } + acpi_os_initialized = true;return AE_OK ; }
drivers/acpi/sysfs.c +100 -36
161 lines not on this page · raw message
Signature · 1 line
1.7.10
PATCH v2 3/4 ACPI / sysfs: Add support to allow leading "\" missing in trace_method_name.
In reply to Lv ZhengSince _SB.PCI0 can be used as relative path from root and can be easily converted into internal trace_method_name format, we allow users to specify trace_method_name using relative paths from root.
Note this is useful for grub2 for which users failed to pass "\" from the grub configuration file.
--- drivers/acpi/sysfs.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/acpi/sysfs.c +13 -15
@@ -164,14 +164,18 @@ static const struct kernel_param_ops param_ops_debug_level = {module_param_cb (debug_layer, ¶m_ops_debug_layer, &acpi_dbg_layer,0644 );module_param_cb (debug_level, ¶m_ops_debug_level, &acpi_dbg_level,0644 ); -static char * trace_method_name; -static bool trace_method_kmalloced; +static char trace_method_name[1024 ];int param_set_trace_method_name (const char *val,const struct kernel_param *kp) {u32 saved_flags =0 ; +bool is_abs_path = true; -if (strlen (val) >1024 ) { +if (*val !='\\' ) + is_abs_path = false; + +if ((is_abs_path &&strlen (val) >1023 ) || + (!is_abs_path &&strlen (val) >1022 )) {pr_err ("%s: string parameter too long\n" , kp->name);return -ENOSPC ; }
@@ -187,19 +191,13 @@ int param_set_trace_method_name(const char *val, const struct kernel_param *kp) acpi_gbl_trace_dbg_layer, 0); -if (trace_method_kmalloced) -kfree (trace_method_name); - trace_method_name =NULL ; - trace_method_kmalloced = false; -/* This is a hack. We can't kmalloc in early boot. */ -if (slab_is_available ()) { - trace_method_name =kstrdup (val,GFP_KERNEL ); -if (!trace_method_name) -return -ENOMEM ; - trace_method_kmalloced = true; - }else - trace_method_name = (char *)val; +if (is_abs_path) +strcpy (trace_method_name, val); +else { + trace_method_name[0 ] ='\\' ; +strcpy (trace_method_name+1 , val); + }/* Restore the original tracer state */ (void)acpi_debug_trace(trace_method_name,
Signature · 1 line
1.7.10
PATCH v2 4/4 ACPI / Documentation: Update method tracing documentation.
In reply to Lv ZhengThis patch updates method tracing documentation.
--- Documentation/acpi/method-tracing.txt | 204 ++++++++++++++++++++++++++++++--- 1 file changed, 185 insertions(+), 19 deletions(-)
Documentation/acpi/method-tracing.txt +185 -19
@@ -1,26 +1,192 @@ -/sys/module/acpi/parameters/: +ACPICA Trace Facility -trace_method_name - The AML method name that the user wants to trace +Copyright (C) 2015, Intel Corporation +Author: Lv Zheng <[email protected]> -trace_debug_layer - The temporary debug_layer used when tracing the method. - Using 0xffffffff by default if it is 0. -trace_debug_level - The temporary debug_level used when tracing the method. - Using 0x00ffffff by default if it is 0. +Abstract: -trace_state - The status of the tracing feature. +This document describes the functions and the interfaces of the method +tracing facility. + +1. Functionalities and usage examples: + + ACPICA provides method tracing capability. And two functions are + currently implemented using this capability. + + A. Log reducer + ACPICA subsystem provides debugging outputs when CONFIG_ACPI_DEBUG is + enabled. The debugging messages which are deployed via + ACPI_DEBUG_PRINT() macro can be reduced at 2 levels - per-component + level (known as debug layer, configured via + /sys/module/acpi/parameters/debug_layer) and per-type level (known as + debug level, configured via /sys/module/acpi/parameters/debug_level). + + But when the particular layer/level is applied to the control method + evaluations, the quantity of the debugging outputs may still be too + large to be put into the kernel log buffer. The idea thus is worked out + to only enable the particular debug layer/level (normally more detailed) + logs when the control method evaluation is started, and disable the + detailed logging when the control method evaluation is stopped. + + The following command examples illustrate the usage of the "log reducer" + functionality: + a. Filter out the debug layer/level matched logs when control methods + are being evaluated: + # cd /sys/module/acpi/parameters + # echo "0xXXXXXXXX" > trace_debug_layer + # echo "0xYYYYYYYY" > trace_debug_level + # echo "enable" > trace_state + b. Filter out the debug layer/level matched logs when the specified + control method is being evaluated: + # cd /sys/module/acpi/parameters + # echo "0xXXXXXXXX" > trace_debug_layer + # echo "0xYYYYYYYY" > trace_debug_level + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name + # echo "method" > /sys/module/acpi/parameters/trace_state + c. Filter out the debug layer/level matched logs when the specified + control method is being evaluated for the first time: + # cd /sys/module/acpi/parameters + # echo "0xXXXXXXXX" > trace_debug_layer + # echo "0xYYYYYYYY" > trace_debug_level + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name + # echo "method-once" > /sys/module/acpi/parameters/trace_state + Where: + 0xXXXXXXXX/0xYYYYYYYY: Refer to Documentation/acpi/debug.txt for + possible debug layer/level masking values. + \PPPP.AAAA.TTTT.HHHH: Full path of a control method that can be found + in the ACPI namespace. It needn't be an entry + of a control method evaluation. + + B. AML tracer + + There are special log entries added by the method tracing facility at + the "trace points" the AML interpreter starts/stops to execute a control + method, or an AML opcode. Note that the format of the log entries are + subject to change: + [ 0.186427] exdebug-0398 ex_trace_point : Method Begin [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution. + [ 0.186630] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905c88:If] execution. + [ 0.186820] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:LEqual] execution. + [ 0.187010] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905a20:-NamePath-] execution. + [ 0.187214] exdebug-0398 ex_trace_point : Opcode End [0xf5905a20:-NamePath-] execution. + [ 0.187407] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution. + [ 0.187594] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution. + [ 0.187789] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:LEqual] execution. + [ 0.187980] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:Return] execution. + [ 0.188146] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution. + [ 0.188334] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution. + [ 0.188524] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:Return] execution. + [ 0.188712] exdebug-0398 ex_trace_point : Opcode End [0xf5905c88:If] execution. + [ 0.188903] exdebug-0398 ex_trace_point : Method End [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution. - "enabled" means this feature is enabled - and the AML method is traced every time it's executed. + Developers can utilize these special log entries to track the AML + interpretion, thus can aid issue debugging and performance tuning. Note + that, as the "AML tracer" logs are implemented via ACPI_DEBUG_PRINT() + macro, CONFIG_ACPI_DEBUG is also required to be enabled for enabling + "AML tracer" logs. - "1" means this feature is enabled and the AML method - will only be traced during the next execution. + The following command examples illustrate the usage of the "AML tracer" + functionality: + a. Filter out the method start/stop "AML tracer" logs when control + methods are being evaluated: + # cd /sys/module/acpi/parameters + # echo "0x80" > trace_debug_layer + # echo "0x10" > trace_debug_level + # echo "enable" > trace_state + b. Filter out the method start/stop "AML tracer" when the specified + control method is being evaluated: + # cd /sys/module/acpi/parameters + # echo "0x80" > trace_debug_layer + # echo "0x10" > trace_debug_level + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name + # echo "method" > trace_state + c. Filter out the method start/stop "AML tracer" logs when the specified + control method is being evaluated for the first time: + # cd /sys/module/acpi/parameters + # echo "0x80" > trace_debug_layer + # echo "0x10" > trace_debug_level + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name + # echo "method-once" > trace_state + d. Filter out the method/opcode start/stop "AML tracer" when the + specified control method is being evaluated: + # cd /sys/module/acpi/parameters + # echo "0x80" > trace_debug_layer + # echo "0x10" > trace_debug_level + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name + # echo "opcode" > trace_state + e. Filter out the method/opcode start/stop "AML tracer" when the + specified control method is being evaluated for the first time: + # cd /sys/module/acpi/parameters + # echo "0x80" > trace_debug_layer + # echo "0x10" > trace_debug_level + # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name + # echo "opcode-opcode" > trace_state - "disabled" means this feature is disabled. - Users can enable/disable this debug tracing feature by - "echo string > /sys/module/acpi/parameters/trace_state". - "string" should be one of "enable", "disable" and "1". + Note that all above method tracing facility related module parameters can + be used as the boot parameters, for example: + acpi.trace_debug_layer=0x80 acpi.trace_debug_level=0x10 \ + acpi.trace_method_name=\_SB.LID0._LID acpi.trace_state=opcode-once + +2. Interface descriptions: + + All method tracing functions can be configured via ACPI module + parameters that are accessible at /sys/module/acpi/parameters/: + + trace_method_name + The full path of the AML method that the user wants to trace. + Note that the full path shouldn't contain the trailing "_"s in its + name segments but may contain "\" to form an absolute path. + + trace_debug_layer + The temporary debug_layer used when the tracing feature is enabled. + Using ACPI_EXECUTER (0x80) by default, which is the debug_layer + used to match all "AML tracer" logs. + + trace_debug_level + The temporary debug_level used when the tracing feature is enabled. + Using ACPI_LV_TRACE_POINT (0x10) by default, which is the + debug_level used to match all "AML tracer" logs. + + trace_state + The status of the tracing feature. + Users can enable/disable this debug tracing feature by executing + the following command: + # echo string > /sys/module/acpi/parameters/trace_state + Where "string" should be one of the followings: + "disable" + Disable the method tracing feature. + "enable" + Enable the method tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during any method + execution will be logged. + "method" + Enable the method tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during method execution + of "trace_method_name" will be logged. + "method-once" + Enable the method tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during method execution + of "trace_method_name" will be logged only once. + "opcode" + Enable the method tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during method/opcode + execution of "trace_method_name" will be logged. + "opcode-once" + Enable the method tracing feature. + ACPICA debugging messages matching + "trace_debug_layer/trace_debug_level" during method/opcode + execution of "trace_method_name" will be logged only once. + Note that, the difference between the "enable" and other feature + enabling options are: + 1. When "enable" is specified, since + "trace_debug_layer/trace_debug_level" shall apply to all control + method evaluations, after configuring "trace_state" to "enable", + "trace_method_name" will be reset to NULL. + 2. When "method/opcode" is specified, if + "trace_method_name" is NULL when "trace_state" is configured to + these options, the "trace_debug_layer/trace_debug_level" will + apply to all control method evaluations.
Signature · 1 line
1.7.10