aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-03-24 02:48:45 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-26 11:25:59 -0400
commite2b8ddcc6b3fbb860e15c5d52455735e128326aa (patch)
treebf13dd14aeb07496271de07f7392b470fd6a12be /drivers/acpi
parent6e596084833b95662dfe90e1f30d83ccbd64575c (diff)
ACPICA: Remove global option to serialize all control methods.
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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpica/acglobal.h8
-rw-r--r--drivers/acpi/acpica/acinterp.h4
-rw-r--r--drivers/acpi/acpica/exsystem.c12
-rw-r--r--drivers/acpi/acpica/exutils.c80
-rw-r--r--drivers/acpi/osl.c12
5 files changed, 16 insertions, 100 deletions
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 8f40bb972ae3..767556cb1448 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -93,14 +93,6 @@
93ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE); 93ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE);
94 94
95/* 95/*
96 * Automatically serialize ALL control methods? Default is FALSE, meaning
97 * to use the Serialized/not_serialized method flags on a per method basis.
98 * Only change this if the ASL code is poorly written and cannot handle
99 * reentrancy even though methods are marked "NotSerialized".
100 */
101ACPI_INIT_GLOBAL(u8, acpi_gbl_all_methods_serialized, FALSE);
102
103/*
104 * Create the predefined _OSI method in the namespace? Default is TRUE 96 * Create the predefined _OSI method in the namespace? Default is TRUE
105 * because ACPI CA is fully compatible with other ACPI implementations. 97 * because ACPI CA is fully compatible with other ACPI implementations.
106 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. 98 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index c54267748be5..b01f71ce0523 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -458,10 +458,6 @@ void acpi_ex_enter_interpreter(void);
458 458
459void acpi_ex_exit_interpreter(void); 459void acpi_ex_exit_interpreter(void);
460 460
461void acpi_ex_reacquire_interpreter(void);
462
463void acpi_ex_relinquish_interpreter(void);
464
465u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); 461u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
466 462
467void acpi_ex_acquire_global_lock(u32 rule); 463void acpi_ex_acquire_global_lock(u32 rule);
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c
index 841caed11c08..f7da64123ed5 100644
--- a/drivers/acpi/acpica/exsystem.c
+++ b/drivers/acpi/acpica/exsystem.c
@@ -77,7 +77,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
77 77
78 /* We must wait, so unlock the interpreter */ 78 /* We must wait, so unlock the interpreter */
79 79
80 acpi_ex_relinquish_interpreter(); 80 acpi_ex_exit_interpreter();
81 81
82 status = acpi_os_wait_semaphore(semaphore, 1, timeout); 82 status = acpi_os_wait_semaphore(semaphore, 1, timeout);
83 83
@@ -87,7 +87,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
87 87
88 /* Reacquire the interpreter */ 88 /* Reacquire the interpreter */
89 89
90 acpi_ex_reacquire_interpreter(); 90 acpi_ex_enter_interpreter();
91 } 91 }
92 92
93 return_ACPI_STATUS(status); 93 return_ACPI_STATUS(status);
@@ -123,7 +123,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
123 123
124 /* We must wait, so unlock the interpreter */ 124 /* We must wait, so unlock the interpreter */
125 125
126 acpi_ex_relinquish_interpreter(); 126 acpi_ex_exit_interpreter();
127 127
128 status = acpi_os_acquire_mutex(mutex, timeout); 128 status = acpi_os_acquire_mutex(mutex, timeout);
129 129
@@ -133,7 +133,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
133 133
134 /* Reacquire the interpreter */ 134 /* Reacquire the interpreter */
135 135
136 acpi_ex_reacquire_interpreter(); 136 acpi_ex_enter_interpreter();
137 } 137 }
138 138
139 return_ACPI_STATUS(status); 139 return_ACPI_STATUS(status);
@@ -198,7 +198,7 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long)
198 198
199 /* Since this thread will sleep, we must release the interpreter */ 199 /* Since this thread will sleep, we must release the interpreter */
200 200
201 acpi_ex_relinquish_interpreter(); 201 acpi_ex_exit_interpreter();
202 202
203 /* 203 /*
204 * For compatibility with other ACPI implementations and to prevent 204 * For compatibility with other ACPI implementations and to prevent
@@ -212,7 +212,7 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long)
212 212
213 /* And now we must get the interpreter again */ 213 /* And now we must get the interpreter again */
214 214
215 acpi_ex_reacquire_interpreter(); 215 acpi_ex_enter_interpreter();
216 return (AE_OK); 216 return (AE_OK);
217} 217}
218 218
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 5b16c5484bee..d9d72dff2a76 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -100,37 +100,6 @@ void acpi_ex_enter_interpreter(void)
100 100
101/******************************************************************************* 101/*******************************************************************************
102 * 102 *
103 * FUNCTION: acpi_ex_reacquire_interpreter
104 *
105 * PARAMETERS: None
106 *
107 * RETURN: None
108 *
109 * DESCRIPTION: Reacquire the interpreter execution region from within the
110 * interpreter code. Failure to enter the interpreter region is a
111 * fatal system error. Used in conjunction with
112 * relinquish_interpreter
113 *
114 ******************************************************************************/
115
116void acpi_ex_reacquire_interpreter(void)
117{
118 ACPI_FUNCTION_TRACE(ex_reacquire_interpreter);
119
120 /*
121 * If the global serialized flag is set, do not release the interpreter,
122 * since it was not actually released by acpi_ex_relinquish_interpreter.
123 * This forces the interpreter to be single threaded.
124 */
125 if (!acpi_gbl_all_methods_serialized) {
126 acpi_ex_enter_interpreter();
127 }
128
129 return_VOID;
130}
131
132/*******************************************************************************
133 *
134 * FUNCTION: acpi_ex_exit_interpreter 103 * FUNCTION: acpi_ex_exit_interpreter
135 * 104 *
136 * PARAMETERS: None 105 * PARAMETERS: None
@@ -139,7 +108,16 @@ void acpi_ex_reacquire_interpreter(void)
139 * 108 *
140 * DESCRIPTION: Exit the interpreter execution region. This is the top level 109 * DESCRIPTION: Exit the interpreter execution region. This is the top level
141 * routine used to exit the interpreter when all processing has 110 * routine used to exit the interpreter when all processing has
142 * been completed. 111 * been completed, or when the method blocks.
112 *
113 * Cases where the interpreter is unlocked internally:
114 * 1) Method will be blocked on a Sleep() AML opcode
115 * 2) Method will be blocked on an Acquire() AML opcode
116 * 3) Method will be blocked on a Wait() AML opcode
117 * 4) Method will be blocked to acquire the global lock
118 * 5) Method will be blocked waiting to execute a serialized control
119 * method that is currently executing
120 * 6) About to invoke a user-installed opregion handler
143 * 121 *
144 ******************************************************************************/ 122 ******************************************************************************/
145 123
@@ -160,44 +138,6 @@ void acpi_ex_exit_interpreter(void)
160 138
161/******************************************************************************* 139/*******************************************************************************
162 * 140 *
163 * FUNCTION: acpi_ex_relinquish_interpreter
164 *
165 * PARAMETERS: None
166 *
167 * RETURN: None
168 *
169 * DESCRIPTION: Exit the interpreter execution region, from within the
170 * interpreter - before attempting an operation that will possibly
171 * block the running thread.
172 *
173 * Cases where the interpreter is unlocked internally
174 * 1) Method to be blocked on a Sleep() AML opcode
175 * 2) Method to be blocked on an Acquire() AML opcode
176 * 3) Method to be blocked on a Wait() AML opcode
177 * 4) Method to be blocked to acquire the global lock
178 * 5) Method to be blocked waiting to execute a serialized control method
179 * that is currently executing
180 * 6) About to invoke a user-installed opregion handler
181 *
182 ******************************************************************************/
183
184void acpi_ex_relinquish_interpreter(void)
185{
186 ACPI_FUNCTION_TRACE(ex_relinquish_interpreter);
187
188 /*
189 * If the global serialized flag is set, do not release the interpreter.
190 * This forces the interpreter to be single threaded.
191 */
192 if (!acpi_gbl_all_methods_serialized) {
193 acpi_ex_exit_interpreter();
194 }
195
196 return_VOID;
197}
198
199/*******************************************************************************
200 *
201 * FUNCTION: acpi_ex_truncate_for32bit_table 141 * FUNCTION: acpi_ex_truncate_for32bit_table
202 * 142 *
203 * PARAMETERS: obj_desc - Object to be truncated 143 * PARAMETERS: obj_desc - Object to be truncated
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 0d7b7145399e..b7af3b758f32 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1539,18 +1539,6 @@ static int __init osi_setup(char *str)
1539 1539
1540__setup("acpi_osi=", osi_setup); 1540__setup("acpi_osi=", osi_setup);
1541 1541
1542/* enable serialization to combat AE_ALREADY_EXISTS errors */
1543static int __init acpi_serialize_setup(char *str)
1544{
1545 printk(KERN_INFO PREFIX "serialize enabled\n");
1546
1547 acpi_gbl_all_methods_serialized = TRUE;
1548
1549 return 1;
1550}
1551
1552__setup("acpi_serialize", acpi_serialize_setup);
1553
1554/* Check of resource interference between native drivers and ACPI 1542/* Check of resource interference between native drivers and ACPI
1555 * OperationRegions (SystemIO and System Memory only). 1543 * OperationRegions (SystemIO and System Memory only).
1556 * IO ports and memory declared in ACPI might be used by the ACPI subsystem 1544 * IO ports and memory declared in ACPI might be used by the ACPI subsystem