Skip to contentSkip to conversation

ACPICA: Add support for printing AML arguments when trace point enabled

PATCH Superseded Mario Limonciello 2 participants 2 messages Apr 15, 2025 – Apr 17, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPICA: Add support for printing AML arguments when trace point enabled

From: Mario Limonciello <[email protected]>

When debug level is set to ACPI_LV_TRACE_POINT method start and exit are emitted into the debug logs. This can be useful to understand call paths, however none of the arguments for the method calls are populated even when turning up other debug levels.

This can be useful for BIOSes that contain debug strings to see those strings. When ACPI_LV_TRACE_POINT is set also output all of the arguments for a given method call.

This enables this type of debugging:

```
extrace-0138 ex_trace_point        : Method Begin [0x0000000096b240c4:\M460] execution.
extrace-0173 ex_trace_args         :  "  POST CODE: %X  ACPI TIMER: %X  TIME: %d.%d ms\n", b0003f53, 1a26a8b2, 0, 15e, 0, 0
extrace-0138 ex_trace_point        : Method End [0x0000000096b240c4:\M460] execution.
```

---
This is a backport from upstream ACPICA. I'm not sure if there is a script that converts code style, so I just manually adjusted to kernel code style. It is really useful for me for debugging; so I would ideally like to see it go for 6.16 if possible.

---
 drivers/acpi/acpica/acinterp.h |  3 +++
 drivers/acpi/acpica/dsmthdat.c |  1 +
 drivers/acpi/acpica/extrace.c  | 49 ++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+)
drivers/acpi/acpica/acinterp.h +3 -0
index 955114c926bd0..d02779ee92103 100644
@@ -120,6 +120,9 @@ void
 acpi_ex_trace_point(acpi_trace_event_type type,
 		    u8 begin, u8 *aml, char *pathname);
 
+void
+acpi_ex_trace_args(union acpi_operand_object **params, u32 count);
+
 /*
  * exfield - ACPI AML (p-code) execution - field manipulation
  */
drivers/acpi/acpica/dsmthdat.c +1 -0
index eca50517ad824..5393de4dbc4ca 100644
@@ -188,6 +188,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
 
 		index++;
 	}
+	acpi_ex_trace_args(params, index);
 
 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%u args passed to method\n", index));
 	return_ACPI_STATUS(AE_OK);
drivers/acpi/acpica/extrace.c +49 -0

55 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw
kernel test robot noticed the following build warnings:

Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/bleeding-edge linus/master v6.15-rc2 next-20250416] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/ACPICA-Add-support-for-printing-AML-arguments-when-trace-point-enabled/20250416-125019
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20250415192614.2042036-1-superm1%40kernel.org
patch subject: [PATCH] ACPICA: Add support for printing AML arguments when trace point enabled
config: i386-buildonly-randconfig-006-20250417 (https://download.01.org/0day-ci/archive/20250417/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250417/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/acpi/acpica/extrace.c: In function 'acpi_ex_trace_args':

>> drivers/acpi/acpica/extrace.c:174:69: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
     174 |                         ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, " "));
         |                                                                     ^
>> drivers/acpi/acpica/extrace.c:195:74: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
     195 |                         ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, ", "));
         |                                                                          ^

vim +/if +174 drivers/acpi/acpica/extrace.c

149
150 /*******************************************************************************
151 *
152 * FUNCTION: acpi_ex_trace_args
153 *

   154	 * PARAMETERS:  params            - AML method arguments
   155	 *              count             - numer of method arguments
   156	 *
   157	 * RETURN:      None
   158	 *
   159	 * DESCRIPTION: Trace any arguments
   160	 *
   161	 ******************************************************************************/
   162	
   163	void
   164	acpi_ex_trace_args(union acpi_operand_object **params, u32 count)
   165	{
   166		u32 i;
   167	
   168		ACPI_FUNCTION_NAME(ex_trace_args);
   169	
   170		for (i = 0; i < count; i++) {
   171			union acpi_operand_object *obj_desc = params[i];
   172	
   173			if (!i)
 > 174				ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, " "));
   175	
   176			switch (obj_desc->common.type) {
   177			case ACPI_TYPE_INTEGER:
   178				ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "%llx", obj_desc->integer.value));
   179				break;
   180			case ACPI_TYPE_STRING:
   181				if (!obj_desc->string.length) {
   182					ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "NULL"));
   183					continue;
   184				}
   185				if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_TRACE_POINT, _COMPONENT))
   186					acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
   187				break;
   188			default:
   189				ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "Unknown"));
   190				break;
   191			}
   192			if (i+1 == count)
   193				ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, "\n"));
   194			else
 > 195				ACPI_DEBUG_PRINT_RAW((ACPI_DB_TRACE_POINT, ", "));

196 }
197 }
198

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki