Skip to content

Commit

Permalink
ACPICA: Remove global option to serialize all control methods.
Browse files Browse the repository at this point in the history
According to the reports, the "acpi_serialize" mechanism is broken as:

 A. The parallel method calls can still happen when the interpreter lock is
    released under the following conditions:
    1. External callbacks are invoked, for example, by the region handlers,
       the exception handlers, etc.;
    2. Module level execution is performed when Load/LoadTable opcodes are
       executed, and
    3. The _REG control methods are invoked to complete the region
       registrations.
 B. For the following situations, the interpreter lock need to be released
    even for a serialized method while currently, the lock-releasing
    operation is marked as a no-op by
    acpi_ex_relinquish/reacquire_interpreter() when this mechanism is
    enabled:
    1. Wait opcode is executed,
    2. Acquire opcode is executed, and
    3. Sleep opcode is executed.

This patch removes this mechanism and the internal
acpi_ex_relinquish/reacquire_interpreter() APIs.  Lv Zheng.

References: https://bugzilla.kernel.org/show_bug.cgi?id=52191
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>
  • Loading branch information
Lv Zheng authored and Rafael J. Wysocki committed Mar 26, 2014
1 parent 6e59608 commit e2b8ddc
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 103 deletions.
2 changes: 0 additions & 2 deletions Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode
Format: { level | edge | high | low }

acpi_serialize [HW,ACPI] force serialization of AML methods

acpi_skip_timer_override [HW,ACPI]
Recognize and ignore IRQ0/pin2 Interrupt Override.
For broken nForce2 BIOS resulting in XT-PIC timer.
Expand Down
8 changes: 0 additions & 8 deletions drivers/acpi/acpica/acglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@
*/
ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE);

/*
* Automatically serialize ALL control methods? Default is FALSE, meaning
* to use the Serialized/not_serialized method flags on a per method basis.
* Only change this if the ASL code is poorly written and cannot handle
* reentrancy even though methods are marked "NotSerialized".
*/
ACPI_INIT_GLOBAL(u8, acpi_gbl_all_methods_serialized, FALSE);

/*
* Create the predefined _OSI method in the namespace? Default is TRUE
* because ACPI CA is fully compatible with other ACPI implementations.
Expand Down
4 changes: 0 additions & 4 deletions drivers/acpi/acpica/acinterp.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,6 @@ void acpi_ex_enter_interpreter(void);

void acpi_ex_exit_interpreter(void);

void acpi_ex_reacquire_interpreter(void);

void acpi_ex_relinquish_interpreter(void);

u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);

void acpi_ex_acquire_global_lock(u32 rule);
Expand Down
12 changes: 6 additions & 6 deletions drivers/acpi/acpica/exsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)

/* We must wait, so unlock the interpreter */

acpi_ex_relinquish_interpreter();
acpi_ex_exit_interpreter();

status = acpi_os_wait_semaphore(semaphore, 1, timeout);

Expand All @@ -87,7 +87,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)

/* Reacquire the interpreter */

acpi_ex_reacquire_interpreter();
acpi_ex_enter_interpreter();
}

return_ACPI_STATUS(status);
Expand Down Expand Up @@ -123,7 +123,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)

/* We must wait, so unlock the interpreter */

acpi_ex_relinquish_interpreter();
acpi_ex_exit_interpreter();

status = acpi_os_acquire_mutex(mutex, timeout);

Expand All @@ -133,7 +133,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)

/* Reacquire the interpreter */

acpi_ex_reacquire_interpreter();
acpi_ex_enter_interpreter();
}

return_ACPI_STATUS(status);
Expand Down Expand Up @@ -198,7 +198,7 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long)

/* Since this thread will sleep, we must release the interpreter */

acpi_ex_relinquish_interpreter();
acpi_ex_exit_interpreter();

/*
* For compatibility with other ACPI implementations and to prevent
Expand All @@ -212,7 +212,7 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long)

/* And now we must get the interpreter again */

acpi_ex_reacquire_interpreter();
acpi_ex_enter_interpreter();
return (AE_OK);
}

Expand Down
80 changes: 10 additions & 70 deletions drivers/acpi/acpica/exutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,37 +98,6 @@ void acpi_ex_enter_interpreter(void)
return_VOID;
}

/*******************************************************************************
*
* FUNCTION: acpi_ex_reacquire_interpreter
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Reacquire the interpreter execution region from within the
* interpreter code. Failure to enter the interpreter region is a
* fatal system error. Used in conjunction with
* relinquish_interpreter
*
******************************************************************************/

void acpi_ex_reacquire_interpreter(void)
{
ACPI_FUNCTION_TRACE(ex_reacquire_interpreter);

/*
* If the global serialized flag is set, do not release the interpreter,
* since it was not actually released by acpi_ex_relinquish_interpreter.
* This forces the interpreter to be single threaded.
*/
if (!acpi_gbl_all_methods_serialized) {
acpi_ex_enter_interpreter();
}

return_VOID;
}

/*******************************************************************************
*
* FUNCTION: acpi_ex_exit_interpreter
Expand All @@ -139,7 +108,16 @@ void acpi_ex_reacquire_interpreter(void)
*
* DESCRIPTION: Exit the interpreter execution region. This is the top level
* routine used to exit the interpreter when all processing has
* been completed.
* been completed, or when the method blocks.
*
* Cases where the interpreter is unlocked internally:
* 1) Method will be blocked on a Sleep() AML opcode
* 2) Method will be blocked on an Acquire() AML opcode
* 3) Method will be blocked on a Wait() AML opcode
* 4) Method will be blocked to acquire the global lock
* 5) Method will be blocked waiting to execute a serialized control
* method that is currently executing
* 6) About to invoke a user-installed opregion handler
*
******************************************************************************/

Expand All @@ -158,44 +136,6 @@ void acpi_ex_exit_interpreter(void)
return_VOID;
}

/*******************************************************************************
*
* FUNCTION: acpi_ex_relinquish_interpreter
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Exit the interpreter execution region, from within the
* interpreter - before attempting an operation that will possibly
* block the running thread.
*
* Cases where the interpreter is unlocked internally
* 1) Method to be blocked on a Sleep() AML opcode
* 2) Method to be blocked on an Acquire() AML opcode
* 3) Method to be blocked on a Wait() AML opcode
* 4) Method to be blocked to acquire the global lock
* 5) Method to be blocked waiting to execute a serialized control method
* that is currently executing
* 6) About to invoke a user-installed opregion handler
*
******************************************************************************/

void acpi_ex_relinquish_interpreter(void)
{
ACPI_FUNCTION_TRACE(ex_relinquish_interpreter);

/*
* If the global serialized flag is set, do not release the interpreter.
* This forces the interpreter to be single threaded.
*/
if (!acpi_gbl_all_methods_serialized) {
acpi_ex_exit_interpreter();
}

return_VOID;
}

/*******************************************************************************
*
* FUNCTION: acpi_ex_truncate_for32bit_table
Expand Down
12 changes: 0 additions & 12 deletions drivers/acpi/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1539,18 +1539,6 @@ static int __init osi_setup(char *str)

__setup("acpi_osi=", osi_setup);

/* enable serialization to combat AE_ALREADY_EXISTS errors */
static int __init acpi_serialize_setup(char *str)
{
printk(KERN_INFO PREFIX "serialize enabled\n");

acpi_gbl_all_methods_serialized = TRUE;

return 1;
}

__setup("acpi_serialize", acpi_serialize_setup);

/* Check of resource interference between native drivers and ACPI
* OperationRegions (SystemIO and System Memory only).
* IO ports and memory declared in ACPI might be used by the ACPI subsystem
Expand Down
1 change: 0 additions & 1 deletion include/acpi/acpixf.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ extern u32 acpi_dbg_layer;

/* ACPICA runtime options */

extern u8 acpi_gbl_all_methods_serialized;
extern u8 acpi_gbl_copy_dsdt_locally;
extern u8 acpi_gbl_create_osi_method;
extern u8 acpi_gbl_disable_auto_repair;
Expand Down

0 comments on commit e2b8ddc

Please sign in to comment.