Debian Codegraph @

tests/aslts/src/runtime/collections/mt/mutex/SPEC

raw
1 Descriptions of tests
2
3 Thread means below the Worker thread
4 (if another is not specified explicitly).
5
6 Active agents of subject of mt-testing
7 (attention to be drawn to in mt-tests).
8
9 - Threads
10 - Methods (Serialized/non-Serialized)
11 - Mutexes (Acquire/Release)
12 - Level of mutex
13 - order of correct dealing with levels
14 1) mix on the same level Acquire {0,1,2}, Release {1,2,0}
15 2) Acquire+Release {0,1,2..,F}, {F..,2,1,0}
16 - Milliseconds to wait
17 - Events (Wait/Signal)
18 - global lock (_GL)
19 - OperationRegion (SystemMemory/SystemIO/PCI_Config/
20 EmbeddedControl/SMBus/CMOS/PCIBARTarget)
21 - Field,BankField,IndexFiled (Lock/NoLock) of different type OperationRegions
22 - context (GPE/usual)
23 - OS side
24 - firmware side
25 - Notify
26
27 ======================== see:
28 - invocation (?) -- is not thread (?)
29 - can invocation have several different threads?
30 - "interpretation of the current invocation could not be
31 transferred to different invocation until the current says
32 - 'ok I complete'"
33 ========================
34
35 Note:
36 the Global lock in mt-tests is mutex of 0-th level 1-th index (mux-0-1).
37
38 THR-NUMBER:
39 this entry describes how many threads are needed for the test, and the role of threads.
40 The 0-th thread, so-called Control Thread, is not counted in this entry.
41 --------.
42
43
44 # ========================= #
45 # === TEST 001 (mf01) === #
46 # ========================= #
47
48 FUNCTION OF EACH WORKER THREAD:
49
50 Acquire one mutex of i-th level, Sleep, then Release it.
51 Check the mutually exclusive ownership of mutex.
52 Do it for all levels.
53 Check that GL behaves as 0-level mutex.
54
55 After all threads Acquire/Release each mutex of
56 the current level one by one in the same order go
57 to the next level. So, from level 0 up to 15.
58
59 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
60 THR-NUMBER: arbitrary, all threads do the same
61
62
63 DETAILS:
64
65 1. The Control thread resets all flags and counters of all mutexes.
66 2. The Worker threads do the same actions with each of the same N mutexes of i-th level:
67 - acquire the mutex
68 - check that flag of the mutex is zero (not set up yet)
69 - set up flag of the mutex to the index of this thread
70 - increment the counter of this mutex
71 - fall into sleep for the specified time
72 - wake up
73 - check up flag of the mutex that it was not changed by other threads
74 while this one was sleeping
75 - reset flag of the mutex
76 - release mutex
77 3. Control thread after all the worker threads complete with all N mutexes of i-th level:
78 - checks that the counter of each relevant mutex is correct
79 - report errors detected by Worker threads
80 - report other errors
81 4. Control thread initiates and Worker threads fulfill actions (2)
82 for mutexes of all levels one after another from 0 up to 15
83 (and GL too).
84
85 # ========================= #
86 # === TEST 002 (mf02) === #
87 # ========================= #
88
89 FUNCTION OF EACH WORKER THREAD:
90
91 Acquire mutexes of all levels then Release them in the inverse order.
92
93 Check that particular thread is allowed to nestedly acquire mutexes of level not less than the current one.
94 The inverse order is true for Releasing mutexes by the particular thread.
95 Several mutexes of the same level can be simultaneously owned by the same thread.
96 While one thread owns all the mutexes other threads hang on Acquire of the first 0-level mutex
97 (because of the same order of mutexes to be Acquired for all threads),
98 then after the thread releases all the mutexes another thread starts
99 actually owning all the mutexes. All threads own all mutexes in this way.
100
101 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
102 THR-NUMBER: arbitrary, all threads do the same
103
104 DETAILS:
105
106 1. The Worker threads do the same actions described below:
107 - acquire one by one mutexes of all levels from 0 up to 15 (N mutexes per level)
108 - after acquiring the mutex of 15-th level start releaseng them in the inverse order
109 - do the control actions with the flags and counters of mutexes (see comment to mf01)
110
111 # ========================= #
112 # === TEST 003 (mf03) === #
113 # ========================= #
114
115 Example 0, taken from the real bug
116
117 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL; the test involves only mux-0-1
118 THR-NUMBER: arbitrary, odd and even threads fulfill two different methods, N times
119
120
121 # ========================= #
122 # === TEST 004 (mf04) === #
123 # ========================= #
124
125 The available levels of mutexes on thread_1 don't depend on mutex levels occupied by other threads
126
127 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
128 THR-NUMBER: 2 or greater; only 2 work effectively other sleep
129
130 DETAILS:
131
132 I.
133
134 1. Thread_1 owns mutexes of all levels and fall into sleeping
135 2. Thread_2 owns mutexes of all levels too not touching those occuppied by Thread_1
136 3. Thread_2 Releases its mutexes
137 4. Thread_1 Releases its mutexes
138
139 II. Do the same as (I) but {1,2,4,3}.
140
141 III.
142
143 1. Thread_1 owns one (non-zero level) mutex and falls into sleeping
144 2. Thread_2 owns mutexes of all levels not touching that occuppied by Thread_1
145 3. Thread_2 Releases its mutex
146 4. Thread_1 Releases its mutexes
147
148 # ========================= #
149 # === TEST 005 (mf05) === #
150 # ========================= #
151
152 Another thread tries to Release mutex and gets exception
153
154 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
155 THR-NUMBER: 2 or greater; only 2 work effectively other sleep
156
157 DETAILS:
158
159 1. Thread_1 owns all-level mutexes and falls into sleeping
160 2. Thread_2 tries to Release all those mutexes owned by Thread_1
161 3. Exception is expected
162 4. Thread_2 owns all-level mutexes (not intersecting with Thread_1)
163 5. Thread_2 tries again to Release mutexes owned by Thread_1
164 6. Exception is expected
165 7. Thread_1 tries to Release mutexes owned by Thread_2
166 8. Exception is expected
167 9. Thread_1 Releases its mutexes
168 10. Thread_2 Releases its mutexes
169
170 # ========================= #
171 # === TEST 006 (mf06) === #
172 # ========================= #
173
174 Modification of TEST 005
175 (Another thread tries to Release mutex and gets exception)
176
177 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
178 THR-NUMBER: 2 or greater; maximum 4 (min0) work effectively, other sleep
179
180 1.Threads thr-1, thr-2, thr-3, thr-4 Acquire mutexes of
181 the same i-th level but different Indexes.
182
183 2. Threads thr-2, thr-3, thr-4 attempt (one by one) to Release mutex of thr-1, and gets exception
184 3. Threads thr-1, thr-3, thr-4 attempt (one by one) to Release mutex of thr-2, and gets exception
185 4. Threads thr-1, thr-2, thr-4 attempt (one by one) to Release mutex of thr-3, and gets exception
186 5. Threads thr-1, thr-2, thr-3, attempt (one by one) to Release mutex of thr-4, and gets exception
187
188 6. Threads thr-1, thr-2, thr-3, thr-4 Release their mutexes.
189
190 Go to the next level of mutexes.
191
192
193 # ========================= #
194 # === TEST 007 (mf07) === #
195 # ========================= #
196
197 Attempt to Acquire mutex of lower than the current level causes exception
198
199 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
200 THR-NUMBER: 1 or greater; maximum 4 (min0) work effectively and do the same, other sleep
201
202 DETAILS:
203
204 All threads do the same not intersecting with mutexes.
205
206 1. Do below for all levels (N) from 15 up to 0
207 2. Set up current level (N) to 15
208 3. Acquire mutexes from 0 to (N-1) levels
209 4. Release mutexes
210 5. Acquire mutex of level N
211 6. Attempt to Acquire mutexes from 0 to (N-1) levels
212 7. Exception is expected
213 8. Acquire mutexes from (N+1) to 15 levels
214 9. Release all mutexes
215 10. Acquire mutexes from 0 to (N-1) levels
216 11. Release mutexes
217 12. Decrement the current level
218 13. Go to (3)
219
220 # ========================= #
221 # === TEST 008 (mf08) === #
222 # ========================= #
223
224 Threads simultaneously own different mutexes of the same level
225 (prove that mutexes of different indexes of the same level allow
226 real competition (not one by one owning)).
227
228 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
229 THR-NUMBER: 4 or greater; only 4 work effectively other sleep
230
231 DETAILS:
232
233 Mapping of ownerships of mutexes {n0,n1,n2,n3} in test
234 by threads {thread_1-thread_2,thread_3,thread_4}:
235
236 x-0-123, x-1-230, x-2-301, x-3-012, x-0-123
237 x - Control thread
238
239 x-0-123:
240
241 All threads acquire different mutexes of the same n-th level:
242
243 thread_1 n0_mutex
244 thread_2 n1_mutex
245 thread_3 n2_mutex
246 thread_4 n3_mutex
247
248 - acquire i-th mutex of n-th level (ni_mutex)
249 - check the mutually exclusive ownership of ni_mutex
250 - report that ni_mutex is owned
251 - check that all mutexes are owned by the relevant threads
252
253 x-1-230:
254
255 Threads thread_2, thread_3 and thread_4 acquire mutexes
256 n2_mutex, n3_mutex and n0_mutex respectively and hang
257 because all those mutexes are busy by other threads.
258
259 After making sure that threads thread_2, thread_3 and thread_4 hang
260 the thread_1 is initiated to release n0_mutex and acquire n1_mutex.
261
262 It allows thread_4 to own n0_mutex.
263 It releases n3_mutex.
264
265 It allows thread_3 to own n3_mutex.
266 It releases n2_mutex.
267
268 It allows thread_2 to own n2_mutex.
269 It releases n1_mutex.
270
271 It allows thread_1 to own n1_mutex.
272
273 x-2-301,
274 x-3-012,
275 x-0-123: identically to <x-1-230>.
276
277 # ========================= #
278 # === TEST 009 (mf09) === #
279 # ========================= #
280
281 Another implementation of TEST 008.
282
283 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
284 THR-NUMBER: 4 or greater; only 4 work effectively other sleep
285
286 # ========================= #
287 # === TEST 010 (mf10) === #
288 # ========================= #
289
290 Threads simultaneously own different mutexes of different levels
291 (prove that mutexes of different levels allow real competition
292 (not one by one owning)).
293
294 Similar to the TEST 008 but mutexes differ with their Levels
295 but not Indexes.
296
297 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
298 THR-NUMBER: 4 or greater; only 4 work effectively other sleep
299
300 # ========================= #
301 # === TEST 011 (mf11) === #
302 # ========================= #
303
304 ACPI allows to multiply Acquire the same mutex.
305
306 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
307 THR-NUMBER: 1 or greater; maximum 4 (min0) work effectively, other sleep
308
309 Each thread deals with its set of mutexes not intersecting with other threads.
310
311 1. Each thread Acquires successfully its mutex N times (do it for increasing levels 0-15)
312 2. Each thread Releases successfully its mutex N times (do it in inverse order, levels 15-0)
313 3. Each thread gets exception AE_AML_MUTEX_NOT_ACQUIRED on additional Release
314
315 # ========================= #
316 # === TEST 012 (mf12) === #
317 # ========================= #
318
319 ACPI allows to Acquire repeatedly the same mutex over
320 the pending requests of other threads to that mutex.
321
322 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
323 THR-NUMBER: 2 or greater; maximum 4 (min0) work effectively, other sleep
324
325 1. Thread thr-i Acquires successfully mutex M0 of (i-1)-th index for N times
326 2. Other threads Acquire M0 too and hang
327 3. Thread thr-i Acquires successfully mutex M0 for N times again
328 4. Thread thr-i Releases mutex M0 for 2*N times
329 5. One of other threads (thr-j) owns M0
330 6. Thread thr-j Releases M0
331 7. Do 5-6 items for all 'other' threads
332 8. Do 1-7 for all threads one by one (so, for 0-3 Indexes of mutex as well)
333 9. Do 1-8 for all Levels of mutex one by one
334
335 # ========================= #
336 # === TEST 013 (mf13) === #
337 # ========================= #
338
339 Acquire the same mutex by the same thread 'many times' (say 256).
340
341 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
342 THR-NUMBER: 1 or greater; maximum 4 (min0) work effectively, other sleep
343
344 # ========================= #
345 # === TEST 014 (mf14) === #
346 # ========================= #
347
348 Check that all mutexes Acquired by thread and not explicitly Released
349 are Released implicitly by ACPICA when the thread completes.
350
351 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
352 THR-NUMBER: 2 or greater; only 2 work effectively other sleep
353 NOTE: the thread with the greatest index terminates at the end of this test
354
355 1. Thread thr-N Acquires all the mutexes on all levels
356 2. Thread thr-1 tries to Acquire all the same mutexes and gets FAIL (TimeOutValue is not 0xFFFF)
357 3. Thread thr-N terminates
358 4. Thread thr-1 tries to Acquire all those mutexes again and gets success (TimeOutValue is 0xFFFF)
359 5. Thread thr-1 Releases all mutexes
360
361 # ========================= #
362 # === TEST 015 (mf15) === #
363 # ========================= #
364
365 Modification of test 014.
366
367 GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
368 THR-NUMBER: 2 or greater; only 2 work effectively other sleep
369 NOTE: the thread with the greatest index terminates at the end of this test
370
371 1. Thread thr-N Acquires all the mutexes on all levels
372 2. Thread thr-1 tries to Acquire all the same mutexes and gets FAIL (TimeOutValue is not 0xFFFF)
373 3. Thread thr-1 tries to Acquire all the same mutexes and hang (TimeOutValue is 0xFFFF)
374 4. Thread thr-N terminates
375 5. Thread thr-1 owns all those mutexes
376 6. Thread thr-1 Releases all mutexes
377
378 # ========================= #
379 # === TEST 016 (mf16) === #
380 # ========================= #
381
382 THR-NUMBER: 2 or greater; only 2 work effectively other sleep
383
384 1. Thread thr-N
385 - invokes Serialized method MXXX
386 - waits for another thread (thr-1) trying to invoke same method MXXX
387 - falls into sleep (several times)
388 - awakes
389 - check that thr-1 continue hanging trying to get into MXXX
390 - exit MXXX
391 2. Check that thr-1 succeeds getting into MXXX
392
393
394 # ========================= #
395 # === TEST 017 (mf17) === #
396 # ========================= #
397
398 Modification of test 016.
399
400 Similar to test 016 but instead of Serialized method a
401 mutex is used for exclisive access to critical section.
402
403
404 # ========================= #
405 # === TEST 018 (mf18) === #
406 # ========================= #
407
408 Modification of test 016.
409
410 Similar to test 016 check for non-serialized method.
411
412 ####################################################################
413 ####################################################################
414 ####################################################################
415 ####################################################################
416 ####################################################################
417
418
419
420
421
422 ========================================= XXXXX:
423 acquire mutex on a global level but don't release it -
424 check that it is released automatically ???
425 (code in initialization of global variables)
426
427
428
429
430
431
432 ========================================= XXXXX:
433 Simulate interconnection between Firmware and OS.
434
435 ========================================= XXXXX,serialized-method:
436 check serialized method (immediately, and
437 calls to other methods inside the serialized method)
438
439 1) access to different type data inside serialized method
440 ========================================= XXXXX, serialized-method:
441 try to Acq/Rel mutex of inappropriate level LL from method MT0 of synclevel NN.
442 - immediately from that method
443 - from invoking more the intermittent methods
444 enclosed statically or only dynamically in that method
445 ========================================= XXXXX:
446 check blocked: check that when one thread fall to sleep
447 another can own that mutex ?????????????
448 ========================================= XXXXX:
449 > Fixed a regression where an error was no longer emitted if a control method attempts
450 > to create 2 objects of the same name. This once again returns AE_ALREADY_EXISTS.
451 > When this exception occurs, it invokes the mechanism that will dynamically serialize the
452 > control method to possibly prevent future errors. (BZ 440)
453 Test:
454 1. thr-1 - come into test and creates the internal object
455 2. thr-2 - come in starts creating that same object and gets exception
456 3. thr-3 - it should be blocked because method is serialized at step 2
457 ========================================= XXXXX:
458 multi-threading and Switch
459 multi-threading and While
460 etc..
461 ========================================= XXXXX:
462 Now the mutex tests (in Sinchronization and mt-tests)
463 do Acquire/Release mutexes of monotone increasing/decreasing
464 levels (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 and inversely).
465 Do tests where these levels jump over levels:
466 (0, 2, 4, 6, 8,9,10, 12, 14,15 and inversely).
467
468 Will it check 'acquisition depth' below?
469
470 ACPI_STATUS
471 AcpiDsBeginMethodExecution (
472 ACPI_NAMESPACE_NODE *MethodNode,
473 ACPI_OPERAND_OBJECT *ObjDesc,
474 ACPI_WALK_STATE *WalkState)
475 {
476 /* Always increase acquisition depth */
477
478 ObjDesc->Method.Mutex->Mutex.AcquisitionDepth++;
479 }
480 ========================================= XXXXX:
481
482
483
484
485 ======================== work for 2,3,4,5,and more threads:
486 + mf01
487 + mf02
488 + mf03
489 + mf04
490 + mf05
491 + mf06
492 + mf07
493 + mf08
494 + mf09
495 + mf10
496 + mf11
497 + mf12
498 + mf13
499 ======================== work for 2 and more threads:
500 + mf01
501 + mf02
502 + mf03
503 + mf04
504 + mf05
505 + mf06
506 + mf07
507 + mf08 (4 and greater) run time == 0x10
508 + mf09 (4 and greater) run time == 0x60
509 + mf10 (4 and greater) run time == 0x60
510 + mf11
511 + mf12
512 + mf13
513 ========================
514 + mf01
515 + mf02
516 + mf03
517 + mf04
518 + mf05
519 + mf06
520 + mf07
521 + mf08 (4 and greater) run time == 0x10
522 + mf09 (4 and greater) run time == 0x60
523 + mf10 (4 and greater) run time == 0x60
524 + mf11
525 + mf12
526 + mf13
527 ========================
528
529
530
531
532