Doc: Content edit to cpu-sharing page

Signed-off-by: Deb Taylor <deb.taylor@intel.com>
This commit is contained in:
Deb Taylor 2019-12-21 09:59:55 -05:00 committed by deb-intel
parent fa5922c8bf
commit 3e45d5e301

View File

@ -11,7 +11,7 @@ The goal of CPU Sharing is to fully utilize the physical CPU resource, to suppor
Schedule Framework
******************
To satisfy the modularization design conception, the schedule framework layer isolates the vcpu layer and scheduler algorithm. It has not vCPU concept and can only be aware of the thread object instance. The thread object state machine will be maintained in the framework. The framework abstracts the scheduler algorithm object, so this architecture can easily extend new scheduler algorithms.
To satisfy the modularization design conception, the schedule framework layer isolates the vcpu layer and scheduler algorithm. It has not vCPU concept and can only be aware of the thread object instance. The thread object state machine will be maintained in the framework. The framework abstracts the scheduler algorithm object, so this architecture can easily extend new scheduler algorithms.
.. figure:: images/cpu_sharing_framework.png
:align: center
@ -34,6 +34,7 @@ Here is an example for affinity:
- VM0: 2 vCPUs, pinned to pCPU0 and pCPU1
- VM1: 2 vCPUs, pinned to pCPU2 and pCPU3
- VM2: 2 vCPUs, pinned to pCPU2 and pCPU3
.. figure:: images/cpu_sharing_affinity.png
:align: center
@ -50,21 +51,21 @@ After a new vCPU is created, the corresponding thread object is initiated. The v
Scheduler
*********
Below block diagram shows the basic concept for the scheduler. There are two kinds of scheduler in the diagram, one is NOOP(No-Operation) scheduler and the other is IORR (IO sensitive Round-Robin) scheduler.
Below block diagram shows the basic concept for the scheduler. There are two kinds of scheduler in the diagram, one is NOOP (No-Operation) scheduler and the other is IORR (IO sensitive Round-Robin) scheduler.
- **No-Operation scheduler**:
The NOOP(No-operation) scheduler has the same policy with original partition mode, every pCPU can run only two thread objects, one is idle thread, and another is the thread of the assigned vCPU. With this scheduler, vCPU work in work-conserving mode, and will run once its ready. idle thread could run when the vCPU thread blocked.
The NOOP (No-operation) scheduler has the same policy with original partition mode, every pCPU can run only two thread objects, one is idle thread, and another is the thread of the assigned vCPU. With this scheduler, vCPU work in work-conserving mode, and will run once its ready. idle thread could run when the vCPU thread blocked.
- **IO sensitive round-robin scheduler**:
IORR(IO sensitive round-robin) scheduler is implemented with per-pCPU runqueue and per-pCPU tick timer, it supports more than one vCPU running on a pCPU. The scheduler schedule thread objects in round-robin policy basically, and support preemption by timeslice counting.
IORR (IO sensitive round-robin) scheduler is implemented with per-pCPU runqueue and per-pCPU tick timer, it supports more than one vCPU running on a pCPU. The scheduler schedule thread objects in round-robin policy basically, and support preemption by timeslice counting.
+ Every thread object has an initial timeslice (ex: 10ms)
+ timeslice is consumed with time and be counted in context switch and tick handler
+ If timeslice is positive or zero, then switch out current thread object and put it to tail of runqueue.Then, pick next runnable one from runqueue to run.
+ Threads who has IO request will preempt current running thread on the same pCPU.
- Every thread object has an initial timeslice (ex: 10ms)
- Timeslice is consumed with time and be counted in context switch and tick handler
- If timeslice is positive or zero, then switch out current thread object and put it to tail of runqueue.Then, pick next runnable one from runqueue to run.
- Threads who has IO request will preempt current running thread on the same pCPU.
Scheduler configuration
***********************
@ -74,19 +75,18 @@ There are two place in the code decide the usage for scheduler.
* The option in Kconfig decides the only scheduler used in runtime.
``hypervisor/arch/x86/Kconfig``
.. literalinclude:: ../hypervisor/arch/x86/Kconfig
.. literalinclude:: ../../../../hypervisor/arch/x86/Kconfig
:name: Kconfig for Scheduler
:caption: Kconfig for Scheduler
:linenos:
:lines: 40-58
:emphasize-lines: 42
:language: c
The default scheduler is **SCHED_NOOP**. To use the IORR, only need to set **SCHED_IORR** in **ACRN Scheduler**.
* The affinity for VMs are set in ``hypervisor/scenarios/<scenario_name>/vm_configurations.h``
.. literalinclude:: ../hypervisor/scenarios/industry/vm_configurations.h
.. literalinclude:: ../../../..//hypervisor/scenarios/industry/vm_configurations.h
:name: Affinity for VMs
:caption: Affinity for VMs
:linenos: