[LITMUS^RT] Problem with Litmus-RT plugin
Evgeniy Veretennikov
evg.veretennikov at gmail.com
Tue May 27 15:50:38 CEST 2014
On 27.05.2014 12:23, Andrea Bastoni wrote:
> Hi Evgeniy,
>
> On Tue, May 27, 2014 at 9:33 AM, Evgeniy Veretennikov
> <evg.veretennikov at gmail.com> wrote:
>> Hello Andrea,
>>
>> I'm student of the Moscow Aviation Institute, and I develop Litmus-RT plugin
>> which schedules processes like ARINC 653 scheduler schedules partitions
>> (ARINC 653 is aviation standard). This is simple round-robin algorithm: each
>> process has predefined runtime inside predefined period. My plugin is based
>> on version 2012.2 as a demo plugin in this CreateAPluginTutorial:
>> https://wiki.litmus-rt.org/litmus/CreateAPluginTutorial
> Can I ask you why 2012.2 and not a more updated version?
Of course. Only reason is that demo plugin is for 2012.2, so I thought
it would be better to have simple working example.
>
>> My plugin's function arinc_schedule(struct task_struct*) just chooses
>> task_struct* of process which should run now and returns this pointer. So, I
>> can successfully start my plugin ($ setsched ARINC), but when I start some
>> RT-process (for example, $ rtspin 10 100 10), Ubuntu GUI freezes and virtual
>> machine with Litmus uses 100% of all CPUs. I think, I should change process
>> state or some queues inside arinc_schedule() function, but I don't know what
>> exactly to do. I saw some queue-management in demo plugin, but I don't know
>> how to use process queues, because my algorithm is just round-robin, either
>> array, not a queue.
> The Litmus RT infrastructure allows you to define the logic to select
> the next task to be run, but is integrated in the linux-scheduler
> infrastructure.
>
> Although it should be relatively straightforward to define your own
> scheduling policy (either ARINC o P-EDF, or G-EDF), you should make
> sure you also understand the linux-scheduler infrastructure where
> Litmus is "plugged-in".
>
> To implement an A653 policy, I'd suggest you to start with a P-FP
> plugin, understand its implementation, and then hack-in the
> modification required to support your specific need. The data
> structure you use to manage your tasks (provided that you adequately
> protect them) are your specific plugin implementation details.
Ok, I had already tried to understood P-FP. Unfortunately, some details
aren't clear for me. That's my skeleton of current schedule function's
implementation:
static struct task_struct *arinc_schedule(struct task_struct *prev)
{
struct task_struct *next = NULL;
spin_lock_irqsave(...);
/* here is schedule decision: next = some next task; do nothing
with cpu state, process state, etc. */
sched_state_task_picked();
spin_unlock_irqrestore(...);
return next;
}
But I can't start RT-processes with current code (see my previous
letter). I think, I have to change process state, I tried this after
schedule decision:
set_rt_flags(prev, RT_F_SLEEP);
set_rt_flags(next, RT_F_RUNNING);
But problem wasn't solved. Maybe I need to manipulate with rt_param
structure? All what I need is to sleep prev task and to run next task.
Thanks for the quick reply.
Best regards,
Evgeniy Veretennikov
Student of the Moscow Aviation Institute
More information about the litmus-dev
mailing list