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

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



On Sat, May 30, 2015 at 11:29 AM, Mr Idris <mr@xxxxxxxxxxxx> wrote:
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
Hi all,

I have managed to call arinc653_scheduler_set.c without error. The message when i run it like this

not errorÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
not errorÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
hypercall bounce and schedule set finish *Â ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
trueÂÂ

* this message because i set on xc_sched_arinc653_schedule_set().


but when i try 'xl list -v' still VM is not running

Attachment: arinc653_scheduler_set.c
Description: Text Data

_______________________________________________
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®.