linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, Lv Zheng <zetalog@gmail.com>,
	<linux-kernel@vger.kernel.org>,
	linux-acpi@vger.kernel.org
Subject: [PATCH v2 0/4] ACPI: Update method tracing facility.
Date: Wed,  5 Aug 2015 16:23:36 +0800	[thread overview]
Message-ID: <cover.1438762804.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1437627016.git.lv.zheng@intel.com>

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) 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(-)

-- 
1.7.10


  parent reply	other threads:[~2015-08-05  8:24 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23  4:51 [PATCH 00/22] ACPICA: 20150717 Release Lv Zheng
2015-07-23  4:52 ` [PATCH 01/22] ACPICA: Parser: Reduce parser/namespace divergences for tracer support Lv Zheng
2015-07-23  4:52 ` [PATCH 02/22] ACPICA: Parser: Cleanup aml_offset in struct acpi_walk_state Lv Zheng
2015-07-23  4:52 ` [PATCH 03/22] ACPICA: Parser: Cleanup aml_offset in union acpi_operand_object Lv Zheng
2015-07-23  4:52 ` [PATCH 04/22] ACPICA: Dispatcher: Cleanup union acpi_operand_object's AML address assignments Lv Zheng
2015-07-23  4:52 ` [PATCH 05/22] ACPICA: Executer: Add back pointing reference of method operand Lv Zheng
2015-07-23  4:52 ` [PATCH 06/22] ACPICA: Namespace: Add function to directly return normalized full path Lv Zheng
2015-07-23  4:52 ` [PATCH 07/22] ACPICA: Dispatcher: Move stack traversal code to dispatcher Lv Zheng
2015-07-23  4:52 ` [PATCH 08/22] ACPICA: Dispatcher: Add trace support for interpreter Lv Zheng
2015-07-23  4:52 ` [PATCH 09/22] ACPICA: Executer: Add interpreter tracing mode for method tracing facility Lv Zheng
2015-07-23  4:53 ` [PATCH 10/22] ACPICA: Executer: Add OSL trace hook support Lv Zheng
2015-07-23  4:53 ` [PATCH 11/22] ACPICA: Executer: Add option to bypass opcode tracing Lv Zheng
2015-07-23  4:53 ` [PATCH 12/22] ACPICA: Parser: Remove redundant opcode execution debugging output Lv Zheng
2015-07-23  4:53 ` [PATCH 13/22] ACPICA: Remove extraneous check for null walk_state Lv Zheng
2015-07-23  4:53 ` [PATCH 14/22] ACPICA: iASL: Add new warnings for method local_x and arg_x variables Lv Zheng
2015-07-23  4:53 ` [PATCH 15/22] ACPICA: MSVC: Fix inclusion order issue of <crtdbg.h> Lv Zheng
2015-07-23  4:53 ` [PATCH 16/22] ACPICA: Cleanup use of all non-ANSI local C library functions Lv Zheng
2015-07-23  4:53 ` [PATCH 17/22] ACPICA: Cleanup use of NEGATIVE and POSITIVE defines Lv Zheng
2015-07-23  4:54 ` [PATCH 18/22] ACPICA: iASL: Add support for TCPA Server Table Lv Zheng
2015-07-23  4:54 ` [PATCH 19/22] ACPICA: Debugger: Reduce structure size for debugger Lv Zheng
2015-07-23  4:54 ` [PATCH 20/22] ACPICA: Debugger: Move debugger specific APIs to debugger component Lv Zheng
2015-07-23  4:54 ` [PATCH 21/22] ACPICA: iASL/Disassembler: Add prototype verbose mode Lv Zheng
2015-07-23  4:54 ` [PATCH 22/22] ACPICA: Update version to 20150717 Lv Zheng
2015-07-23  5:06 ` [PATCH 0/4] ACPI: Update method tracing facility Lv Zheng
2015-07-23  5:06   ` [PATCH 1/4] ACPI / sysfs: Add ACPI_LV_REPAIR debug level Lv Zheng
2015-07-23  5:06   ` [PATCH 2/4] ACPI / sysfs: Update method tracing facility Lv Zheng
2015-07-23  5:06   ` [PATCH 3/4] ACPI / Documentation: Update method tracing documentation Lv Zheng
2015-07-23  5:07   ` [PATCH 4/4] ACPI / sysfs: Add support to allow leading "\" missing in trace_method_name Lv Zheng
2015-07-23 20:51   ` [PATCH 0/4] ACPI: Update method tracing facility Rafael J. Wysocki
2015-07-24  2:02     ` Zheng, Lv
2015-07-24 19:55       ` Rafael J. Wysocki
2015-07-27  0:42         ` Zheng, Lv
2015-07-29  0:58 ` [PATCH 00/22] ACPICA: 20150717 Release Rafael J. Wysocki
2015-07-29  1:41   ` Zheng, Lv
2015-08-05  8:23 ` Lv Zheng [this message]
2015-08-05  8:23   ` [PATCH v2 1/4] ACPI / sysfs: Add ACPI_LV_REPAIR debug level Lv Zheng
2015-08-05  8:23   ` [PATCH v2 2/4] ACPI / sysfs: Update method tracing facility Lv Zheng
2015-08-05  8:23   ` [PATCH v2 3/4] ACPI / sysfs: Add support to allow leading "\" missing in trace_method_name Lv Zheng
2015-08-05  8:24   ` [PATCH v2 4/4] ACPI / Documentation: Update method tracing documentation Lv Zheng

Reply instructions:

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

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

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

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

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

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

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