[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Call schedule set on arinc653 scheduler?



On 5/29/15, Nathan Studer <nate.studer@xxxxxxxxx> wrote:
> On Fri, May 29, 2015 at 6:45 AM, Mr Idris <mr@xxxxxxxxxxxx> wrote:
>> Hi,
>> On 5/28/15, Nathan Studer <nate.studer@xxxxxxxxx> wrote:
>>>> I write small program to call arinc653, it gives me no error when i
>>>> compiled with parameter -lxenctrl and -luuid. When i run it, it works
>>>> fine like i set variable to xc_sched_xfair_schedule_set(xci, 0,
>>>> &sched); and when it's correct will give true. But still when i check
>>>> 'xl list' still no state running on VM.
>>>>
>>>> Name                                        ID   Mem VCPUs      State
>>>> Time(s)
>>>> Domain-0                                     0  6258     1     r-----
>>>> 370.1
>>>> Debian                                       3   512     1     ------
>>>>  0.0
>>>>
>>>
>>> Are you sure you have the Debian VM's UUID right?  Can you run "xl
>>> list -v" to confirm the UUID below?
>>>
>> here is "xl list -v"
>>
>> Name                                        ID   Mem VCPUs      State
>>  Time(s)   UUID                            Reason-Code   Security
>> Label
>> Domain-0                                     0  6771     1     r-----
>>    176.2 00000000-0000-0000-0000-000000000000        -
>> -
>> Debian                                       3   512     1     ------
>>      0.0 938b9c5b-8d9d-402a-9be0-0e0cc4cf67dc        -
>> -
>>
>>>> Here is the arinc653_schedule_set
>>>>
>>>> #include <stdio.h>
>>>> #include <xenctrl.h>
>>>> #include <uuid/uuid.h>
>>>>
>>>> int main()
>>>> {
>>>>         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 = 2;
>>>>
>>>>         uuid_parse("", sched.sched_entries[0].dom_handle);
>>>
>>> uuid_parse fails when given a null string, so
>>> sched.sched_entries[0].dom_handle is likely junk.  You can use
>>> uuid_clear(sched.sched_entries[0].dom_handle) instead to set this
>>> handle to the NULL string.
>>>
>>>>         sched.sched_entries[0].vcpu_id = 0;
>>>>         sched.sched_entries[0].runtime = 10;
>>>>         sched.major_frame += sched.sched_entries[0].runtime;
>>>>
>>>>         uuid_parse("938b9c5b-8d9d-402a-9be0-0e0cc4cf67dc",
>>>> sched.sched_entries[1].dom_handle);
>>>>         sched.sched_entries[1].vcpu_id = 0;
>>>>         sched.sched_entries[1].runtime = 10;
>>>>         sched.major_frame += sched.sched_entries[1].runtime;
>>>>
>>>>         i = xc_sched_arinc653_schedule_set(xci, 0, &sched);
>>>>         if (i)
>>>>         {
>>>>                 printf("true\n");
>>>>         } else {
>>>>                 printf("false\n");
>>>>         }
>>>
>>> Your print statement is somewhat misleading here, since
>>> xc_sched_arinc653_schedule_set returns 0 on success and something else
>>> on failure not true/false.
>>>
>>>>         return 0;
>>>> }
>>>>
>>>> interestingly when i run this program suddenly the dom0 hang but when
>>>> i make num_sched_entries bigger than 2, it runs and give me true
>>>> message.
>>>
>>> If sched.sched_entries[0].dom_handle has junk, it will hang because
>>> dom0 does not have a slice.
>>>
>>> If the only thing that you are changing is num_sched_entries than it's
>>> unlikely that the schedule you are loading is valid, which would
>>> result in the schedule being rejected and an error being returned.
>>> The "true" output would seem to confirm this.
>>>
>>>      Nate
>>>
>>>>
>>>> Does anyone have any idea what change I need to make to get the
>>>> scheduler
>>>> to run
>>>> the VM?  I appreciate the help.
>>>>
>>>> Thanks,
>>>> Idris
>>>>
>>>> _______________________________________________
>>>> Xen-users mailing list
>>>> Xen-users@xxxxxxxxxxxxx
>>>> http://lists.xen.org/xen-users
>>>
>>
>> I tried using 'uuid_clear(sched.sched_entries[0].dom_handle);' or
>> 'uuid_parse("00000000-0000-0000-0000-000000000000",
>> sched.sched_entries[0].dom_handle);' both make computer hang.
>>
>> I also tried using 'strncpy((char *)sched.sched_entries[0].dom_handle,
>> dom0_str, sizeof(sched.sched_entries[0].dom_handle));' it gives me
>> nothing either computer hang or message true/false or VM run.
>
> What exactly happens here?  At least one of the messages should print.
>

I checked using valgrind, there is an error on line 'strncpy((char
*)sched.sched_entries[0].dom_handle, dom0_str,
sizeof(sched.sched_entries[0].dom_handle));'

==2873== Invalid read of size 1
==2873==    at 0x4C296D1: strncpy (mc_replace_strmem.c:463)
==2873==    by 0x4008C7: main (arinc653_schedule_set.c:21)
==2873==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

I don't know what i'm doing wrong ,so any help will be appreciated.

> Can you try memset(sched.sched_entries[0].dom_handle, 0,
> sizeof(sched.sched_entries[0].dom_handle))?
>
> The arinc653 scheduler is doing a memcmp on the entire array, so the
> entire thing needs to be cleared.
>
>      Nate

I tried, but it also suddenly hang dom0. Anyway, how do i get error
message when it suddenly hang?

Thanks,
Idris

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
http://lists.xen.org/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.