ARINC653 Scheduler: Difference between revisions

From Xen
Jump to navigationJump to search
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 38: Line 38:
{
{
/* identify domain by UUID */
/* identify domain by UUID */
parse_uuid(DOMN_UUID_STRING, sched.sched_entries[i].dom_handle);
uuid_parse(DOMN_UUID_STRING, sched.sched_entries[i].dom_handle);


/* must be 0 */
/* must be 0 */
Line 50: Line 50:
}
}


xc_sched_arinc653_schedule_set(xci, (struct xen_sysctl_arinc653_schedule *)as);
xc_sched_arinc653_schedule_set(xci, &sched);
</pre>
</pre>


Line 73: Line 73:
{
{
/* identify domain by UUID */
/* identify domain by UUID */
parse_uuid(DOMN_UUID_STRING, sched.sched_entries[i].dom_handle);
uuid_parse(DOMN_UUID_STRING, sched.sched_entries[i].dom_handle);


sched.sched_entries[i].vcpu_id = DOMN_VCPUID;
sched.sched_entries[i].vcpu_id = DOMN_VCPUID;
Line 84: Line 84:
}
}


xc_sched_arinc653_schedule_set(xci, SCHED_POOLID, (struct xen_sysctl_arinc653_schedule *)as);
xc_sched_arinc653_schedule_set(xci, SCHED_POOLID, &sched);
</pre>
</pre>



Latest revision as of 00:38, 20 May 2015

ARINC653 CPU Scheduler

Introduction

The ARINC653 scheduler is a periodically repeating fixed timeslice scheduler. Multicore support is not yet implemented.

Usage

  1. add "sched=arinc653 maxcpus=1" on Xen's boot command line.
  2. update domain configs to use only 1 PCPU for all domains.
  3. update domain configs to use only 1 VCPU per domain.
  4. create domains as usual.
  5. call the arinc653_schedule_set API with an ARINC653 scheduler structure

Pool Usage

Pool support was added in 4.4.

  1. sudo xl cpupool-create name=\"arinc_pool\" sched=\"arinc653\"
  2. sudo xl cpupool-cpu-remove Pool-0 [cpu id]
  3. sudo xl cpupool-cpu-add arinc_pool [cpu id]
  4. create domains in the arinc_pool: sudo xl create [domain config] pool=\"arinc_pool\"
  5. call the arinc653_schedule_set API with an ARINC653 scheduler structure and the pool_id

Example - Pre 4.4

    #include <xenctrl.h>
    #include <uuid/uuid.h>
    ...

    struct xen_sysctl_arinc653_schedule sched;
    xc_interface *xci = xc_interface_open(NULL, NULL, 0);
    int i;

    /* initialize major frame and number of minor frames */
    sched.major_frame = 0;
    sched.num_sched_entries = NUM_MINOR_FRAMES;

    for (i = 0, i < sched.num_sched_entries; ++i)
    {
        /* identify domain by UUID */
        uuid_parse(DOMN_UUID_STRING, sched.sched_entries[i].dom_handle);

        /* must be 0 */
        sched.sched_entries[i].vcpu_id = 0;

        /* runtime in ms */
        sched.sched_entries[i].runtime = DOMN_RUNTIME;

        /* updated major frame time */
        sched.major_frame += sched.sched_entries[i].runtime;
    }

    xc_sched_arinc653_schedule_set(xci, &sched);

Example - Post 4.4

Pooling support was added in the 4.4 release.

    #include <xenctrl.h>
    #include <uuid/uuid.h>
    ...

    struct xen_sysctl_arinc653_schedule sched;
    xc_interface *xci = xc_interface_open(NULL, NULL, 0);
    int i;

    /* initialize major frame and number of minor frames */
    sched.major_frame = 0;
    sched.num_sched_entries = NUM_MINOR_FRAMES;

    for (i = 0, i < sched.num_sched_entries; ++i)
    {
        /* identify domain by UUID */
        uuid_parse(DOMN_UUID_STRING, sched.sched_entries[i].dom_handle);

        sched.sched_entries[i].vcpu_id = DOMN_VCPUID;

        /* runtime in ms */
        sched.sched_entries[i].runtime = DOMN_RUNTIME;

        /* updated major frame time */
        sched.major_frame += sched.sched_entries[i].runtime;
    }

    xc_sched_arinc653_schedule_set(xci, SCHED_POOLID, &sched);

Algorithm

The ARINC653 schedule configuration provides the major frame duration, as well as the sequence of minor frames within this major frame. Each minor frame is specified by a domain/timeslice pair.

At the beginning of the major frame, the scheduler runs the VCPU corresponding with the domain of the first minor frame within the schedule. When it's timeslice has completed the scheduler runs the VCPU corresponding with the domain of the next minor frame within the schedule until there are no more minor frames remaining or until the major frame has expired. When the major frame expires the process is restarted.

If all minor frames have expired and there is still time remaining in the major frame, the idle domain is scheduled until the completion of the major frame.

If a domain listed in the schedule is not found, the idle domain is scheduled in its place. While there are no gaps allowed in the schedule configuration, this allows for a similar affect to be achieved by the use of a non-existent dummy domain.

Glossary of Terms

  • Major Frame: Peridiocally repeating scheduling frame of fixed duration.
  • Minor Frame: Divisions within the major frame.
  • VCPU: Virtual CPU (Only one per domain is allowed with the ARINC653 scheduler)
  • Timeslice: The timeslice a VCPU receives before being preempted to run another. (i.e. The duration of the minor frame.)