1f08c3bdfSopenharmony_ciTestcase 01
2f08c3bdfSopenharmony_ci-----------
3f08c3bdfSopenharmony_ci
4f08c3bdfSopenharmony_ciThis test attempts to verify that when a CPU is offlined, that a process
5f08c3bdfSopenharmony_ciwriting to disk doesn't cause an issue.  We create a process that writes
6f08c3bdfSopenharmony_cito disk, force it to run only on a specified CPU by setting its CPU
7f08c3bdfSopenharmony_ciaffinity to just that CPU, then offline that CPU, and verify that the
8f08c3bdfSopenharmony_ciprocess moves to another processor properly.
9f08c3bdfSopenharmony_ci
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_ciNotes
12f08c3bdfSopenharmony_ci=====
13f08c3bdfSopenharmony_ci
14f08c3bdfSopenharmony_ciThere are two kinds of masks:  One to specify which CPU's are allowed
15f08c3bdfSopenharmony_cito be used for the given process, and one for the smp affinity.
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ciThis may be hard to verify but we can indirectly check on this
18f08c3bdfSopenharmony_ciby looking at /proc/stat or measuring the relative performance
19f08c3bdfSopenharmony_ciof some parallelized benchmark before and after onlining the CPU.
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_ci
22f08c3bdfSopenharmony_ciAlgorithm
23f08c3bdfSopenharmony_ci=========
24f08c3bdfSopenharmony_ciGiven a CPU to test that exists
25f08c3bdfSopenharmony_ci
26f08c3bdfSopenharmony_ciTake a snapshot of what CPUs are on and off initially
27f08c3bdfSopenharmony_ci
28f08c3bdfSopenharmony_ciMake sure the cpu is online
29f08c3bdfSopenharmony_ci
30f08c3bdfSopenharmony_ciStart up a process that writes to disk
31f08c3bdfSopenharmony_ci
32f08c3bdfSopenharmony_ciLoop until done:
33f08c3bdfSopenharmony_ci  Take a snapshot of /proc/interrupts
34f08c3bdfSopenharmony_ci
35f08c3bdfSopenharmony_ci  Foreach CPU in the system
36f08c3bdfSopenharmony_ci    online the CPU
37f08c3bdfSopenharmony_ci    migrate the IRQs to it
38f08c3bdfSopenharmony_ci    sleep a little while
39f08c3bdfSopenharmony_ci
40f08c3bdfSopenharmony_ci  Foreach CPU in the system
41f08c3bdfSopenharmony_ci    migrate IRQs onto the CPU
42f08c3bdfSopenharmony_ci    offline the cpu
43f08c3bdfSopenharmony_ci    sleep a little while
44f08c3bdfSopenharmony_ci
45f08c3bdfSopenharmony_ci  Take another snapshot of /proc/interrupts
46f08c3bdfSopenharmony_ci
47f08c3bdfSopenharmony_ci  Print a report showing the change in IRQs
48f08c3bdfSopenharmony_ci
49f08c3bdfSopenharmony_ci
50f08c3bdfSopenharmony_ciWhen exiting:
51f08c3bdfSopenharmony_ci  Kill the write loop process
52f08c3bdfSopenharmony_ci
53f08c3bdfSopenharmony_ci  Restore all CPUs to their initial state
54