Skip to contentSkip to conversation

ARINC653

DISCUSSION Simon Martin 3 participants 8 messages Dec 3, 2013 – Dec 10, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Robbie,

Nate said that I should contact you if I was having problems with the scheduler, and unfortunately I have.

As far as I can see I have created a cpupool with 1 CPU running the arinc653 scheduler. Here the output from xl.

root@smartin-xen:~# xl cpupool-list
Name               CPUs   Sched     Active   Domain count
Pool-0               3    credit       y          1
pv400                1  arinc653       y          1

However the domU I load into the pv400 cpupool is never scheduled. I found a few mails talking about this, and it looks like I need to run a program on dom0 to configure the scheduler. I wrote the program and as far as I can see it should work, however whatever I do it fails. I tried to put a few printk statements in the corresponding arinc653_sched_set but I don't see any output in the xl dmesg, or domU log either.

I attach the code I wrote to configure the scheduler. It accepts one parameter, the UUID of the dom_handle I need to specify. The mail I found wasn't too clear so I test this using the dom0 UUID (00000000-0000-0000-0000-000000000000) and with the domU UUID as well. Both fail the do_sysctl call in xc_sched_arinc653_schedule_set (xc_arinc653.c line 51).

Can you give me some idea of what I'm doing wrong here?

Regards.

/* ********************************************************************
* Project :
* Author : smartin
********************************************************************

    Modifications:
    0.01 29/11/2013 Initial version.

*/

/*---------------------------------------------------------------------
-- macros (preamble) ---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
-- standard includes ---------------------------------------------------------------------*/
#include <stdio.h>
#include <xenctrl.h>
#include <uuid/uuid.h>

/*---------------------------------------------------------------------
-- project includes (import) ---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
-- project includes (export) ---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
-- macros (postamble) ---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
-- data types ---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
-- function prototypes ---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
-- global variables ---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
-- local variables ---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
-- private functions ---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
-- public functions ---------------------------------------------------------------------*/

int main(int argc, char *argv[], char *envp[])

{
    // check for parameters
    if (argc < 2)
    {
        printf("%s <dom uuid>\n", argv[0]);
        return -1;
    }
    printf("scheduling %s\n", argv[1]);

    // get the xen control interface
    xc_interface *xci = xc_interface_open(NULL, NULL, 0);
    if (!xci)
    {
        printf("error opening xen control interface\n");
        return -1;
    }

    /* initialize major frame and number of minor frames */
    struct xen_sysctl_arinc653_schedule sched = {0};
    sched.major_frame = 0;
    sched.num_sched_entries = 1;

    // initialise frames
    int i;
    for (i = 0; i < sched.num_sched_entries; ++i)
    {
        /* identify domain by UUID */
        if (uuid_parse(argv[1], sched.sched_entries[i].dom_handle))
        {
            printf("error parsing uuid %s\n", argv[1]);
            return -1;
        }

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

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

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

    i = xc_sched_arinc653_schedule_set(xci, &sched);
    if (i)
    {
        printf("error %i setting scheduler data\n", i);
        return -1;
    }

    return 0;
}

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
Quoted 4 lines · Simon Martin

Hi Robbie,

Nate said that I should contact you if I was having problems with the scheduler, and unfortunately I have.

I am actually back, so I can field this one.

Quoted 16 lines

As far as I can see I have created a cpupool with 1 CPU running the arinc653 scheduler. Here the output from xl.

root@smartin-xen <mailto:root@smartin-xen>:~# xl cpupool-list
Name CPUs Sched Active Domain count

Pool-0               3    credit       y          1
pv400                1  arinc653       y          1

However the domU I load into the pv400 cpupool is never scheduled. I found a few mails talking about this, and it looks like I need to run a program on dom0 to configure the scheduler. I wrote the program and as far as I can see it should work, however whatever I do it fails. I tried to put a few printk statements in the corresponding arinc653_sched_set but I don't see any output in the xl dmesg, or domU log either.

Quoted 7 lines

I attach the code I wrote to configure the scheduler. It accepts one parameter, the UUID of the dom_handle I need to specify. The mail I found wasn't too clear so I test this using the dom0 UUID (00000000-0000-0000-0000-000000000000) and with the domU UUID as well. Both fail the do_sysctl call in xc_sched_arinc653_schedule_set (xc_arinc653.c line 51).

Can you give me some idea of what I'm doing wrong here?

Did you apply the patches I posted to the list a couple weeks ago? I noticed that you are calling the xc_sched_arinc653_schedule_set function without a pool id, so I think the answer is no.

http://lists.xenproject.org/archives/html/xen-devel/2013-11/msg02549.html

Without these patches, you can only load a schedule into Pool-0.

If you just want to wait a little bit, I should be addressing Andrew's comments soon, in order to get them into unstable.

Nate

Quoted 3 lines

Regards.

#3 lore raw

Thanks Nate.

I hope everything went well!

Quoted 10 lines

Did you apply the patches I posted to the list a couple weeks ago? I noticed that you are calling the xc_sched_arinc653_schedule_set function without a pool id, so I think the answer is no.

http://lists.xenproject.org/archives/html/xen-devel/2013-11/msg02549.html

Without these patches, you can only load a schedule into Pool-0.

If you just want to wait a little bit, I should be addressing Andrew's comments soon, in order to get them into unstable.

I didn't apply those patches. I just brought in the patches that were committed to git. Sounds like it's better if I wait for you to commit your stuff before continuing with this so I'll to onto other bits of the system for the moment.

Regards.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw

Hi Nate,

I finally got round to pulling in the latest and greatest patches and after a few silly mistakes (RTFM) I now have a working system. As mentioned before I have 2 pools:

smartin@smartin-xen:~/projects/trio/xen/pv499$ sudo xl cpupool-list
Name               CPUs   Sched     Active   Domain count
Pool-0               3    credit       y          1
pv499                1  arinc653       y          1

After loading the domU into the pv499 and running the program that configures the arinc scheduler I get this:

smartin@smartin-xen:~/projects/trio/xen/pv499$ sudo xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  2967     4     r-----    
 117.2
pv499                                       24    32     1     r-----    
 373.0

So far so good. Now looking at the timings things are not too different from when I was using the credit scheduler. Running a single shot timer at a period of 250 µs gives me a jitter in the timer handler latency in the range [3.5 µs, 45 µs]. This makes it look like the problem in the jitter is not the scheduling but the underlying hypervisor. It is going off to do things on this CPU which is causing the deadlines not to be met.

So unless I am doing something silly it looks like I will have to go to RT-Xen to get better timings. For the moment I'm going to leave this and go on to getting more of my operating system working.

Regards.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
Quoted 5 lines · Simon Martin
smartin@smartin-xen:~/projects/trio/xen/pv499$ sudo xl cpupool-list
Name               CPUs   Sched     Active   Domain count
Pool-0               3    credit       y          1
pv499                1  arinc653       y          1

Ok, which pcpus are in each pool? In theory, it shouldn't matter, but, you know... :-P

Quoted 19 lines

After loading the domU into the pv499 and running the program that configures the arinc scheduler I get this:

smartin@smartin-xen:~/projects/trio/xen/pv499$ sudo xl list
Name                                        ID   Mem VCPUs      State
Time(s)
Domain-0                                     0  2967     4     r-----
117.2
pv499                                       24    32     1     r-----
373.0

So far so good. Now looking at the timings things are not too different from when I was using the credit scheduler. Running a single shot timer at a period of 250 µs gives me a jitter in the timer handler latency in the range [3.5 µs, 45 µs]. This makes it look like the problem in the jitter is not the scheduling but the underlying hypervisor. It is going off to do things on this CPU which is causing the deadlines not to be met.

Quoted 4 lines

So unless I am doing something silly it looks like I will have to go to RT-Xen to get better timings. For the moment I'm going to leave this and go on to getting more of my operating system working.

Well, RT-Xen is a great project, but it's mostly, if not all, about scheduling. I mean, all they do is introducing two new schedulers (with a couple of operational mode in each), and that's it... There is nothing there being done for reducing latency or jitter.

I think, we'd better off (as soon as, as you said, you have more pieces in place), trying to figure out what is causing the behavior you're seeing and workaround/fix/amend it!

It's a busy period, with the 4.4 release, etc., but, as repeatedly said, I'm up for helping with this, if help is needed! :-P

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw

Thanks Dario,

Quoted 8 lines
Quoted 5 lines
 smartin@smartin-xen:~/projects/trio/xen/pv499$ sudo xl cpupool-list
 Name CPUs Sched Active Domain count
 Pool-0 3 credit y 1
 pv499 1 arinc653 y 1

Ok, which pcpus are in each pool? In theory, it shouldn't matter, but, you know...

Pool-0 has pcpu 1, 2 and 3
pv499 has pcpu 0.

Quoted 8 lines
Quoted 4 lines

So unless I am doing something silly it looks like I will have to go to RT-Xen to get better timings. For the moment I'm going to leave this and go on to getting more of my operating system working.

Well, RT-Xen is a great project, but it's mostly, if not all, about scheduling. I mean, all they do is introducing two new schedulers (with a couple of operational mode in each), and that's it... There is nothing there being done for reducing latency or jitter.

Thanks for the pointer. As my tests have shown, changing the scheduler does not really alter the behaviour.

Quoted 4 lines

I think, we'd better off (as soon as, as you said, you have more pieces in place), trying to figure out what is causing the behavior you're seeing and workaround/fix/amend it!

I agree.

Quoted 3 lines

It's a busy period, with the 4.4 release, etc., but, as repeatedly said, I'm up for helping with this, if help is needed!

Thanks. This is something that is going to take a while to get sorted so I'll definitely be plugging until way after 4.4 is done and dusted.

Regards.

Quoted 1 line

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw
Quoted 8 lines · Simon Martin

Thanks Dario,

Quoted 6 lines
Quoted 6 lines
 smartin@smartin-xen:~/projects/trio/xen/pv499$ sudo xl
cpupool-list 
 Name CPUs Sched Active Domain count 
 Pool-0 3 credit y 1 
 pv499 1 arinc653 y 1 
Quoted 7 lines
Quoted 4 lines

Ok, which pcpus are in each pool? In theory, it shouldn't matter, but,
you know... :-P

Pool-0 has pcpu 1, 2 and 3
pv499 has pcpu 0.

Can you try the opposite? I mean, something like having the 1 pCPU only pool when you run your domU *not* including pCPU #0?

I can't point the finger to anything specific right now, but, you now, pCPU #0 is the first being brought up, etc.

Probably, as scheduling does not matter much to you, you can even just use vCPU affinities/pinning, like having Dom0 pinned to pCPUs 0-2, and your DomU to pCPU 3.

Quoted 7 lines
Quoted 3 lines

It's a busy period, with the 4.4 release, etc., but, as repeatedly said,
I'm up for helping with this, if help is needed! :-P

Thanks. This is something that is going to take a while to get sorted so I'll definitely be plugging until way after 4.4 is done and dusted.

Well, in that case I'm sure I'll be able to help a bit. :-)

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw

Hi Dario,

Quoted 6 lines
Quoted 3 lines

Pool-0 has pcpu 1, 2 and 3
pv499 has pcpu 0.

Can you try the opposite? I mean, something like having the 1 pCPU only pool when you run your domU *not* including pCPU #0?

I changed it so that Pool-0 has pcpu 0, 1 and 2, and pv499 has pcpu 3. No difference. Which is good in a way :-).

Regards.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel