[LITMUS^RT] is get_rt_flag deprecated

Glenn Elliott gelliott at cs.unc.edu
Wed Nov 6 04:07:04 CET 2013


On Nov 5, 2013, at 9:29 PM, ayoade gbadebo <gbaduz at gmail.com> wrote:

> I am trying to follow the tutorial on implementing a plugin,
>  but it complains about this function and RT_F_SLEEP 
> get_rt_flags(prev) == RT_F_SLEEP and set_rt_flags(tsk, RT_F_RUNNING);
> 
> What functions replaced them
> 
> Thanks
> _______________________________________________
> litmus-dev mailing list
> litmus-dev at lists.litmus-rt.org
> https://lists.litmus-rt.org/listinfo/litmus-dev



You might want to look at the schedule() code for some of the other plugins for hints.  I think this code from sched_psn_edf.c::psnedf_schedule(…) is relevant:

    exists      = pedf->scheduled != NULL;
    blocks      = exists && !is_running(pedf->scheduled);
    out_of_time = exists &&
                  budget_enforced(pedf->scheduled) &&
                  budget_exhausted(pedf->scheduled);
    np      = exists && is_np(pedf->scheduled);
    sleep       = exists && is_completed(pedf->scheduled);
    preempt     = edf_preemption_needed(edf, pref);

There are several is_*() macros (see include/litmus/litmus.h) and inline functions that replace reading these flags.  I believe the flags were replaced by “unsigned int:1” boolean bitfields in struct rt_param (this may not be as efficient as OR’ing and AND’ing flags, but it’s a lot easier to work with).  For example, here’s the code for litmus.h::is_completed():

static inline int is_completed(struct task_struct* t)
{
    return t && tsk_rt(t)->completed;  // here’s the declaration for completed: "unsigned int completed:1;"
}

Let’s look at an old Litmus implementation for the same part of sched_psn_edf.c::psnedf_schedule(…):

     exists      = pedf->scheduled != NULL;
     blocks      = exists && !is_running(pedf->scheduled);
     out_of_time = exists &&
                   budget_enforced(pedf->scheduled) &&
                   budget_exhausted(pedf->scheduled);
     np	= exists && is_np(pedf->scheduled);
     sleep = exists && get_rt_flags(pedf->scheduled) == RT_F_SLEEP;
     preempt = edf_preemption_needed(edf, prev);

See where the value for “sleep” is computed?  I think it’s safe to assume “get_rt_flags(tsk) == RT_F_SLEEP” is equivalent to "is_completed(tsk)”.  Furthermore, comparing the old Litmus code against the new, I believe “set_rt_flags(tsk, RT_F_SLEEP)” is equivalent to “tsk_rt(t)->completed = 1” and “set_rt_flags(tsk, RT_F_RUNNING)” is equivalent to “tsk_rt(t)->completed = 0”.  Regarding the flag “RT_F_EXIT_SEM”, I think this functionality has been replaced by logic relating to task release policy (release_policy_t) in task wake-up routines.

Here’s a patch for an older version of Litmus that you can search through for examples of RT_F_*: http://www.litmus-rt.org/releases/2012.2/litmus-rt-2012.2.patch

I didn’t run into any situations where I couldn’t correlate an old segment of code with equivalent code in the newest version of Litmus, but please feel free to ask more questions if you run into trouble.

-Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.litmus-rt.org/pipermail/litmus-dev/attachments/20131105/6512a7d1/attachment.html>


More information about the litmus-dev mailing list