1Descriptions of tests
2
3Thread means below the Worker thread
4(if another is not specified explicitly).
5
6Active 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
35Note:
36the Global lock in mt-tests is mutex of 0-th level 1-th index (mux-0-1).
37
38THR-NUMBER:
39this entry describes how many threads are needed for the test, and the role of threads.
40The 0-th thread, so-called Control Thread, is not counted in this entry.
41--------.
42
43
44# ========================= #
45# ===  TEST 001 (mf01)  === #
46# ========================= #
47
48FUNCTION 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
55After all threads Acquire/Release each mutex of
56the current level one by one in the same order go
57to the next level. So, from level 0 up to 15.
58
59GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
60THR-NUMBER: arbitrary, all threads do the same
61
62
63DETAILS:
64
651. The Control thread resets all flags and counters of all mutexes.
662. 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
773. 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
814. 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
89FUNCTION OF EACH WORKER THREAD:
90
91   Acquire mutexes of all levels then Release them in the inverse order.
92
93Check that particular thread is allowed to nestedly acquire mutexes of level not less than the current one.
94The inverse order is true for Releasing mutexes by the particular thread.
95Several mutexes of the same level can be simultaneously owned by the same thread.
96While 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),
98then after the thread releases all the mutexes another thread starts
99actually owning all the mutexes. All threads own all mutexes in this way.
100
101GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
102THR-NUMBER: arbitrary, all threads do the same
103
104DETAILS:
105
1061. 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
115Example 0, taken from the real bug
116
117GL-LOCK: if GL00 is non-zero, mux-0-1 is GL; the test involves only mux-0-1
118THR-NUMBER: arbitrary, odd and even threads fulfill two different methods, N times
119
120
121# ========================= #
122# ===  TEST 004 (mf04)  === #
123# ========================= #
124
125The available levels of mutexes on thread_1 don't depend on mutex levels occupied by other threads
126
127GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
128THR-NUMBER: 2 or greater; only 2 work effectively other sleep
129
130DETAILS:
131
132I.
133
1341. Thread_1 owns mutexes of all levels and fall into sleeping
1352. Thread_2 owns mutexes of all levels too not touching those occuppied by Thread_1
1363. Thread_2 Releases its mutexes
1374. Thread_1 Releases its mutexes
138
139II. Do the same as (I) but {1,2,4,3}.
140
141III.
142
1431. Thread_1 owns one (non-zero level) mutex and falls into sleeping
1442. Thread_2 owns mutexes of all levels not touching that occuppied by Thread_1
1453. Thread_2 Releases its mutex
1464. Thread_1 Releases its mutexes
147
148# ========================= #
149# ===  TEST 005 (mf05)  === #
150# ========================= #
151
152Another thread tries to Release mutex and gets exception
153
154GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
155THR-NUMBER: 2 or greater; only 2 work effectively other sleep
156
157DETAILS:
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
16810. Thread_2 Releases its mutexes
169
170# ========================= #
171# ===  TEST 006 (mf06)  === #
172# ========================= #
173
174Modification of TEST 005
175(Another thread tries to Release mutex and gets exception)
176
177GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
178THR-NUMBER: 2 or greater; maximum 4 (min0) work effectively, other sleep
179
1801.Threads thr-1, thr-2, thr-3, thr-4 Acquire mutexes of
181  the same i-th level but different Indexes.
182
1832. Threads        thr-2, thr-3, thr-4 attempt (one by one) to Release mutex of thr-1, and gets exception
1843. Threads thr-1,        thr-3, thr-4 attempt (one by one) to Release mutex of thr-2, and gets exception
1854. Threads thr-1, thr-2,        thr-4 attempt (one by one) to Release mutex of thr-3, and gets exception
1865. Threads thr-1, thr-2, thr-3,       attempt (one by one) to Release mutex of thr-4, and gets exception
187
1886. Threads thr-1, thr-2, thr-3, thr-4 Release their mutexes.
189
190Go to the next level of mutexes.
191
192
193# ========================= #
194# ===  TEST 007 (mf07)  === #
195# ========================= #
196
197Attempt to Acquire mutex of lower than the current level causes exception
198
199GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
200THR-NUMBER: 1 or greater; maximum 4 (min0) work effectively and do the same, other sleep
201
202DETAILS:
203
204All 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
21510. Acquire mutexes from 0 to (N-1) levels
21611. Release mutexes
21712. Decrement the current level
21813. Go to (3)
219
220# ========================= #
221# ===  TEST 008 (mf08)  === #
222# ========================= #
223
224Threads simultaneously own different mutexes of the same level
225(prove that mutexes of different indexes of the same level allow
226real competition (not one by one owning)).
227
228GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
229THR-NUMBER: 4 or greater; only 4 work effectively other sleep
230
231DETAILS:
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
239x-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
253x-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
273x-2-301,
274x-3-012,
275x-0-123: identically to <x-1-230>.
276
277# ========================= #
278# ===  TEST 009 (mf09)  === #
279# ========================= #
280
281Another implementation of TEST 008.
282
283GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
284THR-NUMBER: 4 or greater; only 4 work effectively other sleep
285
286# ========================= #
287# ===  TEST 010 (mf10)  === #
288# ========================= #
289
290Threads simultaneously own different mutexes of different levels
291(prove that mutexes of different levels allow real competition
292(not one by one owning)).
293
294Similar to the TEST 008 but mutexes differ with their Levels
295but not Indexes.
296
297GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
298THR-NUMBER: 4 or greater; only 4 work effectively other sleep
299
300# ========================= #
301# ===  TEST 011 (mf11)  === #
302# ========================= #
303
304ACPI allows to multiply Acquire the same mutex.
305
306GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
307THR-NUMBER: 1 or greater; maximum 4 (min0) work effectively, other sleep
308
309Each thread deals with its set of mutexes not intersecting with other threads.
310
3111. Each thread Acquires successfully its mutex N times (do it for increasing levels 0-15)
3122. Each thread Releases successfully its mutex N times (do it in inverse order, levels 15-0)
3133. Each thread gets exception AE_AML_MUTEX_NOT_ACQUIRED on additional Release
314
315# ========================= #
316# ===  TEST 012 (mf12)  === #
317# ========================= #
318
319ACPI allows to Acquire repeatedly the same mutex over
320the pending requests of other threads to that mutex.
321
322GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
323THR-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
339Acquire the same mutex by the same thread 'many times' (say 256).
340
341GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
342THR-NUMBER: 1 or greater; maximum 4 (min0) work effectively, other sleep
343
344# ========================= #
345# ===  TEST 014 (mf14)  === #
346# ========================= #
347
348Check that all mutexes Acquired by thread and not explicitly Released
349are Released implicitly by ACPICA when the thread completes.
350
351GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
352THR-NUMBER: 2 or greater; only 2 work effectively other sleep
353NOTE: the thread with the greatest index terminates at the end of this test
354
3551. Thread thr-N Acquires all the mutexes on all levels
3562. Thread thr-1 tries to Acquire all the same mutexes and gets FAIL (TimeOutValue is not 0xFFFF)
3573. Thread thr-N terminates
3584. Thread thr-1 tries to Acquire all those mutexes again and gets success (TimeOutValue is 0xFFFF)
3595. Thread thr-1 Releases all mutexes
360
361# ========================= #
362# ===  TEST 015 (mf15)  === #
363# ========================= #
364
365Modification of test 014.
366
367GL-LOCK: if GL00 is non-zero, mux-0-1 is GL
368THR-NUMBER: 2 or greater; only 2 work effectively other sleep
369NOTE: the thread with the greatest index terminates at the end of this test
370
3711. Thread thr-N Acquires all the mutexes on all levels
3722. Thread thr-1 tries to Acquire all the same mutexes and gets FAIL (TimeOutValue is not 0xFFFF)
3733. Thread thr-1 tries to Acquire all the same mutexes and hang (TimeOutValue is 0xFFFF)
3744. Thread thr-N terminates
3755. Thread thr-1 owns all those mutexes
3766. Thread thr-1 Releases all mutexes
377
378# ========================= #
379# ===  TEST 016 (mf16)  === #
380# ========================= #
381
382THR-NUMBER: 2 or greater; only 2 work effectively other sleep
383
3841. 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
3912. Check that thr-1 succeeds getting into MXXX
392
393
394# ========================= #
395# ===  TEST 017 (mf17)  === #
396# ========================= #
397
398Modification of test 016.
399
400Similar to test 016 but instead of Serialized method a
401mutex is used for exclisive access to critical section.
402
403
404# ========================= #
405# ===  TEST 018 (mf18)  === #
406# ========================= #
407
408Modification of test 016.
409
410Similar to test 016 check for non-serialized method.
411
412####################################################################
413####################################################################
414####################################################################
415####################################################################
416####################################################################
417
418
419
420
421
422========================================= XXXXX:
423acquire mutex on a global level but don't release it -
424check that it is released automatically ???
425(code in initialization of global variables)
426
427
428
429
430
431
432========================================= XXXXX:
433Simulate interconnection between Firmware and OS.
434
435========================================= XXXXX,serialized-method:
436check serialized method (immediately, and
437calls to other methods inside the serialized method)
438
4391) access to  different type data inside serialized method
440========================================= XXXXX, serialized-method:
441try 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:
446check blocked: check that when one thread fall to sleep
447another 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)
453Test:
4541. thr-1 - come into test and creates the internal object
4552. thr-2 - come in starts creating that same object and gets exception
4563. thr-3 - it should be blocked because method is serialized at step 2
457========================================= XXXXX:
458multi-threading and Switch
459multi-threading and While
460etc..
461========================================= XXXXX:
462Now the mutex tests (in Sinchronization and mt-tests)
463do Acquire/Release mutexes of monotone increasing/decreasing
464levels (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 and inversely).
465Do tests where these levels jump over levels:
466(0, 2, 4, 6, 8,9,10, 12, 14,15 and inversely).
467
468Will it check 'acquisition depth' below?
469
470ACPI_STATUS
471AcpiDsBeginMethodExecution (
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
533