1. 19 3月, 2018 1 次提交
  2. 22 2月, 2018 2 次提交
  3. 06 2月, 2018 1 次提交
  4. 09 2月, 2017 1 次提交
  5. 10 9月, 2016 2 次提交
    • L
      ACPICA: Namespace: Fix dynamic table loading issues · 74f51b80
      Lv Zheng 提交于
      ACPICA commit 767ee53354e0c4b7e8e7c57c6dd7bf569f0d52bb
      
      There are issues related to the namespace/interpreter locks, which causes
      several ACPI functionalities not specification compliant. The lock issues
      were detectec when we were trying to fix the functionalities (please see
      Link # [1] for the details).
      
      What's the lock issues? Let's first look into the namespace/interpreter
      lock usages inside of the object evaluation and the table loading which are
      the key AML interpretion code paths:
      Table loading:
      acpi_ns_load_table
      	L(Namespace)
      	acpi_ns_parse_table
      		acpi_ns_one_complete_parse(LOAD_PASS1/LOAD_PASS2)
      			acpi_ds_load1_begion_op
      			acpi_ds_load1_end_op
      			acpi_ds_load2_begion_op
      			acpi_ds_load2_end_op
      	U(Namespace)
      Object evaluation:
      acpi_ns_evaluate
      	L(Interpreter)
      	acpi_ps_execute_method
      		acpi_ds_exec_begin_op
      		acpi_ds_exec_end_op
      			U(Interpreter)
      			acpi_ns_load_table
      				L(Namespace)
      				U(Namespace)
      			acpi_ev_initialize_region
      				L(Namespace)
      				U(Namespace)
      			address_space.Setup
      			address_space.Handler
      			acpi_os_wait_semaphore
      			acpi_os_acquire_mutex
      			acpi_os_sleep
      			L(Interpreter)
      	U(Interpreter)
      	L(Interpreter)
      	acpi_ex_resolve_node_to_value
      	U(Interpreter)
      	acpi_ns_check_return_value
      Where:
        1. L(Interpreter) means acquire(MTX_INTERPRETER);
        2. U(Interpreter) means release(MTX_INTERPRETER);
        3. L(Namespace) means acquire(MTX_NAMESPACE);
        4. U(Namespace) means release(MTX_NAMESPACE);
      
      We can see that acpi_ns_exec_module_code() (which invokes acpi_ns_evaluate) is
      implemented in a deferred way just in order to avoid to reacquire the
      namespace lock. This is in fact the root cause of many other ACPICA issues:
      1. We now know for sure that the module code should be executed right in
         place by the Windows AML interpreter. So in the current design, if
         the region initializations/accesses or the table loadings (where the
         namespace surely should be locked again) happening during the table
         loading period, dead lock could happen because ACPICA never unlocks the
         namespace during the AML interpretion.
      2. ACPICA interpreter just ensures that all static namespace nodes (named
         objects created during the acpi_load_tables()) are created
         (acpi_ns_lookup()) with the correct lock held, but doesn't ensure that
         the named objects created by the control method are created with the
         same correct lock held. It requires the control methods to be executed
         in a serial way after "loading a table", that's why ACPICA requires
         method auto serialization.
      
      This patch fixes these software design issues by extending interpreter
      enter/exit APIs to hold both interpreter/namespace locks to ensure the lock
      order correctness, so that we can get these code paths:
      Table loading:
      acpi_ns_load_table
      	E(Interpreter)
      		acpi_ns_parse_table
      			acpi_ns_one_complete_parse
      			acpi_ns_execute_table
      				X(Interpreter)
      				acpi_ns_load_table
      				acpi_ev_initialize_region
      				address_space.Setup
      				address_space.Handler
      				acpi_os_wait_semaphore
      				acpi_os_acquire_mutex
      				acpi_os_sleep
      				E(Interpreter)
      	X(Interpreter)
      Object evaluation:
      acpi_ns_evaluate
      	E(Interpreter)
      	acpi_ps_execute_method
      		X(Interpreter)
      		acpi_ns_load_table
      		acpi_ev_initialize_region
      		address_space.Setup
      		address_space.Handler
      		acpi_os_wait_semaphore
      		acpi_os_acquire_mutex
      		acpi_os_sleep
      		E(Interpreter)
      	X(Interpreter)
      Where:
        1. E(Interpreter) means acquire(MTX_INTERPRETER, MTX_NAMESPACE);
        2. X(Interpreter) means release(MTX_NAMESPACE, MTX_INTERPRETER);
      
      After this change, we can see:
      1. All namespace nodes creations are locked by the namespace lock.
      2. All namespace nodes referencing are locked with the same lock.
      3. But we also can notice a defact that, all namespace nodes deletions
         could be affected by this change. As a consequence,
         acpi_ns_delete_namespace_subtree() may delete a static namespace node that
         is still referenced by the interpreter (for example, the parser scopes).
      Currently, we needn't worry about the last defact because in ACPICA, table
      unloading is not fully functioning, its design strictly relies on the fact
      that when the namespace deletion happens, either the AML table or the OSPMs
      should have been notified and thus either the AML table or the OSPMs
      shouldn't reference deletion-related namespace nodes during the namespace
      deletion. And this change still works with the above restrictions applied.
      While making this a-step-forward helps us to correct the wrong grammar to
      pull many things back to the correct rail. And pulling things back to the
      correct rail in return makes it possible for us to support fully
      functioning table unloading after doing many cleanups.
      
      While this patch is generated, all namespace locks are examined to ensure
      that they can meet either of the following pattens:
      1. L(Namespace)
         U(Namespace)
      2. E(Interpreter)
         X(Interpreter)
      3. E(Interpreter)
         X(Interpreter)
         L(Namespace)
         U(Namespace)
         E(Interpreter)
         X(Interpreter)
      We ensure this by adding X(Interpreter)/E(Interpreter) or removing
      U(Namespace)/L(Namespace) for those currently are executed in the following
      order:
         E(Interpreter)
         L(Namespace)
         U(Namespace)
         X(Interpreter)
      And adding E(Interpreter)/X(Interpreter) for those currently are executed
      in the following order:
         X(Interpreter)
         E(Interpreter)
      
      Originally, the interpreter lock is held for the execution AML opcodes, the
      namespace lock is held for the named object creation AML opcodes. Since
      they are actually same in MS interpreter (can all be executed during the
      table loading), we can combine the 2 locks and tune the locking code better
      in this way. Lv Zheng.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=153541 # [1]
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=121701 # [1]
      Link: https://bugs.acpica.org/show_bug.cgi?id=1323
      Link: https://github.com/acpica/acpica/commit/767ee533Reported-and-tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reported-and-tested-by: NGreg White <gwhite@kupulau.com>
      Reported-and-tested-by: NDutch Guy <lucht_piloot@gmx.net>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      74f51b80
    • L
      ACPICA: Interpreter: Fix MLC issues by switching to new term_list grammar for table loading · de56ba95
      Lv Zheng 提交于
      ACPICA commit 0e24fb67cde08d7df7671d7d7b183490dc79707e
      
      The MLC (Module Level Code) is an ACPICA terminology describing the AML
      code out of any control method, its support is an indication of the
      interpreter behavior during the table loading.
      
      The original implementation of MLC in ACPICA had several issues:
      1. Out of any control method, besides of the object creating opcodes, only
         the code blocks wrapped by "If/Else/While" opcodes were supported.
      2. The supported MLC code blocks were executed after loading the table
         rather than being executed right in place.
         ============================================================
         The demo of this order issue is as follows:
           Name (OBJ1, 1)
           If (CND1 == 1)
           {
             Name (OBJ2, 2)
           }
           Name (OBJ3, 3)
         The original MLC support created OBJ2 after OBJ3's creation.
         ============================================================
      Other than these limitations, MLC support in ACPICA looks correct. And
      supporting this should be easy/natural for ACPICA, but enabling of this was
      blocked by some ACPICA internal and OSPM specific initialization order
      issues we've fixed recently. The wrong support started from the following
      false bug fixing commit:
        Commit: 7f0c826a
        Subject: ACPICA: Add support for module-level executable AML code
        Commit: 9a884ab6
        Subject: ACPICA: Add additional module-level code support
        ...
      
      We can confirm Windows interpreter behavior via reverse engineering means.
      It can be proven that not only If/Else/While wrapped code blocks, all
      opcodes can be executed at the module level, including operation region
      accesses. And it can be proven that the MLC should be executed right in
      place, not in such a deferred way executed after loading the table.
      
      And the above facts indeed reflect the spec words around ACPI definition
      block tables (DSDT/SSDT/...), the entire table and the Scope object is
      defined by the AML specification in BNF style as:
        AMLCode := def_block_header term_list
        def_scope := scope_op pkg_length name_string term_list
      The bodies of the scope opening terms (AMLCode/Scope) are all term_list,
      thus the table loading should be no difference than the control method
      evaluations as the body of the Method is also defined by the AML
      specification as term_list:
        def_method := method_op pkg_length name_string method_flags term_list
      The only difference is: after evaluating control method, created named
      objects may be freed due to no reference, while named objects created by
      the table loading should only be freed after unloading the table.
      
      So this patch follows the spec and the de-facto standard behavior, enables
      the new grammar (term_list) for the table loading.
      
      By doing so, beyond the fixes to the above issues, we can see additional
      differences comparing to the old grammar based table loading:
      1. Originally, beyond the scope opening terms (AMLCode/Scope),
         If/Else/While wrapped code blocks under the scope creating terms
         (Device/power_resource/Processor/thermal_zone) are also supported as
         deferred MLC, which violates the spec defined grammar where object_list
         is enforced. With MLC support improved as non-deferred, the interpreter
         parses such scope creating terms as term_list rather object_list like the
         scope opening terms.
         After probing the Windows behavior and proving that it also parses these
         terms as term_list, we submitted an ECR (Engineering Change Request) to
         the ASWG (ACPI Specification Working Group) to clarify this. The ECR is
         titled as "ASL Grammar Clarification for Executable AML Opcodes" and has
         been accepted by the ASWG. The new grammar will appear in ACPI
         specification 6.2.
      2. Originally, Buffer/Package/operation_region/create_XXXField/bank_field
         arguments are evaluated in a deferred way after loading the table. With
         MLC support improved, they are also parsed right in place during the
         table loading.
         This is also Windows compliant and the only difference is the removal
         of the debugging messages implemented before acpi_ds_execute_arguments(),
         see Link # [1] for the details. A previous commit should have ensured
         that acpi_check_address_range() won't regress.
      
      Note that enabling this feature may cause regressions due to long term
      Linux ACPI support on top of the wrong grammar. So this patch also prepares
      a global option to be used to roll back to the old grammar during the
      period between a regression is reported and the regression is
      root-cause-fixed. Lv Zheng.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=112911 # [1]
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=117671 # [1]
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=153541 # [1]
      Link: https://github.com/acpica/acpica/issues/122
      Link: https://bugs.acpica.org/show_bug.cgi?id=963
      Link: https://github.com/acpica/acpica/commit/0e24fb67Reported-and-tested-by: NChris Bainbridge <chris.bainbridge@gmail.com>
      Reported-by: NEhsan <dashesy@gmail.com>
      Reported-and-tested-by: NDutch Guy <lucht_piloot@gmx.net>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      de56ba95
  6. 11 7月, 2016 2 次提交
  7. 06 7月, 2016 1 次提交
    • L
      ACPICA: Namespace: Fix namespace/interpreter lock ordering · 45209046
      Lv Zheng 提交于
      There is a lock order issue in acpi_load_tables(). The namespace lock
      is held before holding the interpreter lock.
      
      With ACPI_MUTEX_DEBUG enabled in the kernel, this is printed to the
      log during boot:
      
        [    0.885699] ACPI Error: Invalid acquire order: Thread 405884224 owns [ACPI_MTX_Namespace], wants [ACPI_MTX_Interpreter] (20160422/utmutex-263)
        [    0.885881] ACPI Error: Could not acquire AML Interpreter mutex (20160422/exutils-95)
        [    0.893846] ACPI Error: Mutex [0x0] is not acquired, cannot release (20160422/utmutex-326)
        [    0.894019] ACPI Error: Could not release AML Interpreter mutex (20160422/exutils-133)
      
      The issue has been introduced by the following commit:
      
        Commit: 2f38b1b1
        ACPICA Commit: bfe03ffcde8ed56a7eae38ea0b188aeb12f9c52e
        Subject: ACPICA: Namespace: Fix a regression that MLC support triggers
                 dead lock in dynamic table loading
      
      Which fixed a deadlock issue for acpi_ns_load_table() in
      acpi_ex_add_table() but didn't take care of the lock order in
      acpi_ns_load_table() correctly.
      
      Originally (before the above commit), ACPICA used the
      namespace/interpreter locks in the following 2 key code
      paths:
      
       1. Table loading:
       acpi_ns_load_table
      	L(Namespace)
      		acpi_ns_parse_table
      			acpi_ns_one_complete_parse
      	U(Namespace)
       2. Object evaluation:
       acpi_ns_evaluate
      	L(Interpreter)
      	acpi_ps_execute_method
      		U(Interpreter)
      		acpi_ns_load_table
      			L(Namespace)
      			U(Namespace)
      		acpi_ev_initialize_region
      			L(Namespace)
      			U(Namespace)
      		address_space.setup
      			L(Namespace)
      			U(Namespace)
      		address_space.handler
      			L(Namespace)
      			U(Namespace)
      		acpi_os_wait_semaphore
      		acpi_os_acquire_mutex
      		acpi_os_sleep
      		L(Interpreter)
      	U(Interpreter)
      
      During runtime, while acpi_ns_evaluate is called, the lock order is
      always Interpreter -> Namespace.
      
      In turn, the problematic commit acquires the locks in the following
      order:
      
       3. Table loading:
       acpi_ns_load_table
      	L(Namespace)
      		acpi_ns_parse_table
      		L(Interpreter)
      			acpi_ns_one_complete_parse
      		U(Interpreter)
      	U(Namespace)
      
      To fix the lock order issue, move the interpreter lock to
      acpi_ns_load_table() to ensure the lock order correctness:
      
       4. Table loading:
       acpi_ns_load_table
      	L(Interpreter)
      	L(Namespace)
      		acpi_ns_parse_table
      			acpi_ns_one_complete_parse
      	U(Namespace)
      	U(Interpreter)
      
      However, this doesn't fix the current design issues related to the
      namespace lock. For example, we can notice that in acpi_ns_evaluate(),
      outside of acpi_ns_load_table(), the namespace objects may be created
      by the named object creation control methods. And the creation of
      the method-owned namespace objects are not locked by the namespace
      lock. This patch doesn't try to fix such kind of existing issues.
      
      Fixes: 2f38b1b1 (ACPICA: Namespace: Fix a regression that MLC support triggers dead lock in dynamic table loading)
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      45209046
  8. 22 6月, 2016 1 次提交
  9. 16 1月, 2016 1 次提交
  10. 01 1月, 2016 1 次提交
  11. 24 7月, 2015 2 次提交
    • L
      ACPICA: Dispatcher: Cleanup union acpi_operand_object's AML address assignments · 62eb935b
      Lv Zheng 提交于
      ACPICA 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.
      
      Link: https://github.com/acpica/acpica/commit/afb52611Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      62eb935b
    • L
      ACPICA: Parser: Reduce parser/namespace divergences for tracer support · eb87a052
      Lv Zheng 提交于
      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.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NZhouyi Zhou <yizhouzhou@ict.ac.cn>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      eb87a052
  12. 02 7月, 2015 1 次提交
  13. 05 2月, 2015 1 次提交
  14. 11 2月, 2014 1 次提交
  15. 31 10月, 2013 1 次提交
  16. 25 1月, 2013 1 次提交
  17. 15 11月, 2012 1 次提交
  18. 17 1月, 2012 1 次提交
  19. 19 1月, 2011 1 次提交
  20. 07 7月, 2010 1 次提交
  21. 23 1月, 2010 1 次提交
  22. 28 3月, 2009 1 次提交
  23. 09 1月, 2009 2 次提交
  24. 31 12月, 2008 1 次提交
  25. 17 7月, 2008 1 次提交
  26. 24 4月, 2008 1 次提交
  27. 23 4月, 2008 2 次提交
  28. 03 2月, 2007 4 次提交
  29. 14 6月, 2006 1 次提交
    • B
      ACPI: ACPICA 20060421 · b229cf92
      Bob Moore 提交于
      Removed a device initialization optimization introduced in
      20051216 where the _STA method was not run unless an _INI
      was also present for the same device. This optimization
      could cause problems because it could allow _INI methods
      to be run within a not-present device subtree (If a
      not-present device had no _INI, _STA would not be run,
      the not-present status would not be discovered, and the
      children of the device would be incorrectly traversed.)
      
      Implemented a new _STA optimization where namespace
      subtrees that do not contain _INI are identified and
      ignored during device initialization. Selectively running
      _STA can significantly improve boot time on large machines
      (with assistance from Len Brown.)
      
      Implemented support for the device initialization case
      where the returned _STA flags indicate a device not-present
      but functioning. In this case, _INI is not run, but the
      device children are examined for presence, as per the
      ACPI specification.
      
      Implemented an additional change to the IndexField support
      in order to conform to MS behavior. The value written to
      the Index Register is not simply a byte offset, it is a
      byte offset in units of the access width of the parent
      Index Field. (Fiodor Suietov)
      
      Defined and deployed a new OSL interface,
      acpi_os_validate_address().  This interface is called during
      the creation of all AML operation regions, and allows
      the host OS to exert control over what addresses it will
      allow the AML code to access. Operation Regions whose
      addresses are disallowed will cause a runtime exception
      when they are actually accessed (will not affect or abort
      table loading.)
      
      Defined and deployed a new OSL interface,
      acpi_os_validate_interface().  This interface allows the host OS
      to match the various "optional" interface/behavior strings
      for the _OSI predefined control method as appropriate
      (with assistance from Bjorn Helgaas.)
      
      Restructured and corrected various problems in the
      exception handling code paths within DsCallControlMethod
      and DsTerminateControlMethod in dsmethod (with assistance
      from Takayoshi Kochi.)
      
      Modified the Linux source converter to ignore quoted string
      literals while converting identifiers from mixed to lower
      case. This will correct problems with the disassembler
      and other areas where such strings must not be modified.
      
      The ACPI_FUNCTION_* macros no longer require quotes around
      the function name. This allows the Linux source converter
      to convert the names, now that the converter ignores
      quoted strings.
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      b229cf92
  30. 01 4月, 2006 1 次提交
    • B
      ACPI: ACPICA 20060310 · 8313524a
      Bob Moore 提交于
      Tagged all external interfaces to the subsystem with the
      new ACPI_EXPORT_SYMBOL macro. This macro can be defined
      as necessary to assist kernel integration. For Linux,
      the macro resolves to the EXPORT_SYMBOL macro. The default
      definition is NULL.
      
      Added the ACPI_THREAD_ID type for the return value from
      acpi_os_get_thread_id(). This allows the host to define this
      as necessary to simplify kernel integration. The default
      definition is ACPI_NATIVE_UINT.
      
      Valery Podrezov fixed two interpreter problems related
      to error processing, the deletion of objects, and placing
      invalid pointers onto the internal operator result stack.
      http://bugzilla.kernel.org/show_bug.cgi?id=6028
      http://bugzilla.kernel.org/show_bug.cgi?id=6151
      
      Increased the reference count threshold where a warning is
      emitted for large reference counts in order to eliminate
      unnecessary warnings on systems with large namespaces
      (especially 64-bit.) Increased the value from 0x400
      to 0x800.
      
      Due to universal disagreement as to the meaning of the
      'c' in the calloc() function, the ACPI_MEM_CALLOCATE
      macro has been renamed to ACPI_ALLOCATE_ZEROED so that the
      purpose of the interface is 'clear'. ACPI_MEM_ALLOCATE and
      ACPI_MEM_FREE are renamed to ACPI_ALLOCATE and ACPI_FREE.
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      8313524a
  31. 20 1月, 2006 1 次提交
    • B
      [ACPI] ACPICA 20060113 · 4a90c7e8
      Bob Moore 提交于
      Added 2006 copyright.
      
      At SuSE's suggestion, enabled all error messages
      without enabling function tracing, ie with CONFIG_ACPI_DEBUG=n
      
      Replaced all instances of the ACPI_DEBUG_PRINT macro invoked at
      the ACPI_DB_ERROR and ACPI_DB_WARN debug levels with
      the ACPI_REPORT_ERROR and ACPI_REPORT_WARNING macros,
      respectively. This preserves all error and warning messages
      in the non-debug version of the ACPICA code (this has been
      referred to as the "debug lite" option.) Over 200 cases
      were converted to create a total of over 380 error/warning
      messages across the ACPICA code. This increases the code
      and data size of the default non-debug version by about 13K.
      Added ACPI_NO_ERROR_MESSAGES flag to enable deleting all messages.
      The size of the debug version remains about the same.
      Signed-off-by: NBob Moore <robert.moore@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      4a90c7e8