ACPICA: Tables: Tune table mutex to be a leaf lock

ACPICA commit f564d57c6501b97a2871f0b4c048e79910f71783

This patch tunes MTX_TABLES into a leaf lock by always ensuring it is
released before holding other locks.

This patch also collects all table loading related functions into
acpi_tb_load_table() (invoked by load_table opcode) and
acpi_tb_install_and_load_table() (invoked by Load opcode and acpi_load_table()) so
that we can have lock tuning code collected at the boundary of these 2
functions. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/f564d57c
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Dutch Guy <lucht_piloot@gmx.net>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bu işleme şunda yer alıyor:
Lv Zheng
2016-09-07 14:07:24 +08:00
işlemeyi yapan: Rafael J. Wysocki
ebeveyn 441ad11d07
işleme ac0f06ebb8
5 değiştirilmiş dosya ile 182 ekleme ve 131 silme

Dosyayı Görüntüle

@@ -45,6 +45,7 @@
#include "accommon.h"
#include "acnamesp.h"
#include "actables.h"
#include "acevents.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME("tbdata")
@@ -771,3 +772,142 @@ void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded)
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_load_table
*
* PARAMETERS: table_index - Table index
* parent_node - Where table index is returned
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table
*
******************************************************************************/
acpi_status
acpi_tb_load_table(u32 table_index, struct acpi_namespace_node *parent_node)
{
struct acpi_table_header *table;
acpi_status status;
acpi_owner_id owner_id;
ACPI_FUNCTION_TRACE(tb_load_table);
/*
* Note: Now table is "INSTALLED", it must be validated before
* using.
*/
status = acpi_get_table_by_index(table_index, &table);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
status = acpi_ns_load_table(table_index, parent_node);
/* Execute any module-level code that was found in the table */
if (!acpi_gbl_parse_table_as_term_list
&& acpi_gbl_group_module_level_code) {
acpi_ns_exec_module_code_list();
}
/*
* Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
* responsible for discovering any new wake GPEs by running _PRW methods
* that may have been loaded by this table.
*/
status = acpi_tb_get_owner_id(table_index, &owner_id);
if (ACPI_SUCCESS(status)) {
acpi_ev_update_gpes(owner_id);
}
/* Invoke table handler if present */
if (acpi_gbl_table_handler) {
(void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table,
acpi_gbl_table_handler_context);
}
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_install_and_load_table
*
* PARAMETERS: table - Pointer to the table
* address - Physical address of the table
* flags - Allocation flags of the table
* table_index - Where table index is returned
*
* RETURN: Status
*
* DESCRIPTION: Install and load an ACPI table
*
******************************************************************************/
acpi_status
acpi_tb_install_and_load_table(struct acpi_table_header *table,
acpi_physical_address address,
u8 flags, u8 override, u32 *table_index)
{
acpi_status status;
u32 i;
acpi_owner_id owner_id;
ACPI_FUNCTION_TRACE(acpi_load_table);
(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
/* Install the table and load it into the namespace */
status = acpi_tb_install_standard_table(address, flags, TRUE,
override, &i);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/*
* Note: Now table is "INSTALLED", it must be validated before
* using.
*/
status = acpi_tb_validate_table(&acpi_gbl_root_table_list.tables[i]);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
status = acpi_ns_load_table(i, acpi_gbl_root_node);
/* Execute any module-level code that was found in the table */
if (!acpi_gbl_parse_table_as_term_list
&& acpi_gbl_group_module_level_code) {
acpi_ns_exec_module_code_list();
}
/*
* Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
* responsible for discovering any new wake GPEs by running _PRW methods
* that may have been loaded by this table.
*/
status = acpi_tb_get_owner_id(i, &owner_id);
if (ACPI_SUCCESS(status)) {
acpi_ev_update_gpes(owner_id);
}
/* Invoke table handler if present */
if (acpi_gbl_table_handler) {
(void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table,
acpi_gbl_table_handler_context);
}
(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
unlock_and_exit:
*table_index = i;
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
return_ACPI_STATUS(status);
}