Module: xenomai-forge
Branch: master
Commit: a183fb5647481aaa049ddae3a51c387bd0d16657
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=a183fb5647481aaa049ddae3a51c387bd0d16657

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Dec 12 15:58:53 2011 +0100

cobalt/nucleus: remove norm/denorm thread priorities

We don't need to support normalized/denormalized priorities for
threads, since both Cobalt and RTDM interfaces use the same priority
scale.

All APIs with non-POSIX scales now run in userland, handling
conversions between Cobalt and their own priority scale locally from
the Copperplate interface.

---

 include/cobalt/nucleus/thread.h  |    8 --------
 kernel/cobalt/nucleus/pod.c      |   10 ++--------
 kernel/cobalt/nucleus/sched-rt.c |   10 +---------
 kernel/cobalt/nucleus/sched.c    |    9 +--------
 kernel/cobalt/nucleus/shadow.c   |   15 ++++++---------
 5 files changed, 10 insertions(+), 42 deletions(-)

diff --git a/include/cobalt/nucleus/thread.h b/include/cobalt/nucleus/thread.h
index c55bbd7..4775853 100644
--- a/include/cobalt/nucleus/thread.h
+++ b/include/cobalt/nucleus/thread.h
@@ -175,7 +175,6 @@ union xnsched_policy_param;
 struct xnbufd;
 
 struct xnthread_operations {
-       int (*get_denormalized_prio)(struct xnthread *, int coreprio);
        unsigned (*get_magic)(void);
 };
 
@@ -365,13 +364,6 @@ typedef struct xnhook {
 #define xnthread_get_rescnt(thread)        ((thread)->hrescnt)
 #endif /* !__XENO_SIM__ */
 
-/* Class-level operations for threads. */
-static inline int xnthread_get_denormalized_prio(struct xnthread *t, int 
coreprio)
-{
-       return t->ops && t->ops->get_denormalized_prio
-               ? t->ops->get_denormalized_prio(t, coreprio) : coreprio;
-}
-
 static inline unsigned xnthread_get_magic(struct xnthread *t)
 {
        return t->ops ? t->ops->get_magic() : 0;
diff --git a/kernel/cobalt/nucleus/pod.c b/kernel/cobalt/nucleus/pod.c
index 642ae1b..d8ee29d 100644
--- a/kernel/cobalt/nucleus/pod.c
+++ b/kernel/cobalt/nucleus/pod.c
@@ -226,7 +226,7 @@ void xnpod_fatal_helper(const char *format, ...)
 
                while (holder) {
                        xnthread_t *thread = link2thread(holder, glink);
-                       int cprio, dnprio;
+                       int cprio;
 
                        holder = nextq(&nkpod->threadq, holder);
 
@@ -234,13 +234,7 @@ void xnpod_fatal_helper(const char *format, ...)
                                continue;
 
                        cprio = xnthread_current_priority(thread);
-                       dnprio = xnthread_get_denormalized_prio(thread, cprio);
-
-                       if (dnprio != cprio)
-                               snprintf(pbuf, sizeof(pbuf), "%3d(%d)",
-                                        cprio, dnprio);
-                       else
-                               snprintf(pbuf, sizeof(pbuf), "%3d", dnprio);
+                       snprintf(pbuf, sizeof(pbuf), "%3d", cprio);
 
                        xnlogerr_noprompt("%c%3u  %-6d %-8s %-8Lu %.8lx  %s\n",
                                          thread == sched->curr ? '>' : ' ',
diff --git a/kernel/cobalt/nucleus/sched-rt.c b/kernel/cobalt/nucleus/sched-rt.c
index 71181b7..bbd5319 100644
--- a/kernel/cobalt/nucleus/sched-rt.c
+++ b/kernel/cobalt/nucleus/sched-rt.c
@@ -137,7 +137,6 @@ struct vfile_sched_rt_data {
        char name[XNOBJECT_NAME_LEN];
        xnticks_t period;
        int cprio;
-       int dnprio;
 };
 
 static struct xnvfile_snapshot_ops vfile_sched_rt_ops;
@@ -182,7 +181,6 @@ static int vfile_sched_rt_next(struct 
xnvfile_snapshot_iterator *it,
        p->pid = xnthread_user_pid(thread);
        memcpy(p->name, thread->name, sizeof(p->name));
        p->cprio = thread->cprio;
-       p->dnprio = xnthread_get_denormalized_prio(thread, thread->cprio);
        p->period = xnthread_get_period(thread);
 
        return 1;
@@ -198,14 +196,8 @@ static int vfile_sched_rt_show(struct 
xnvfile_snapshot_iterator *it,
                xnvfile_printf(it, "%-3s  %-6s %-8s %-10s %s\n",
                               "CPU", "PID", "PRI", "PERIOD", "NAME");
        else {
-               if (p->cprio != p->dnprio)
-                       snprintf(pribuf, sizeof(pribuf), "%3d(%d)",
-                                p->cprio, p->dnprio);
-               else
-                       snprintf(pribuf, sizeof(pribuf), "%3d", p->cprio);
-
+               snprintf(pribuf, sizeof(pribuf), "%3d", p->cprio);
                xntimer_format_time(p->period, ptbuf, sizeof(ptbuf));
-
                xnvfile_printf(it, "%3u  %-6d %-8s %-10s %s\n",
                               p->cpu,
                               p->pid,
diff --git a/kernel/cobalt/nucleus/sched.c b/kernel/cobalt/nucleus/sched.c
index d4261b8..83581e5 100644
--- a/kernel/cobalt/nucleus/sched.c
+++ b/kernel/cobalt/nucleus/sched.c
@@ -640,7 +640,6 @@ struct vfile_schedlist_data {
        char name[XNOBJECT_NAME_LEN];
        char sched_class[XNOBJECT_NAME_LEN];
        int cprio;
-       int dnprio;
        xnticks_t timeout;
        xnflags_t state;
 };
@@ -682,7 +681,6 @@ static int vfile_schedlist_next(struct 
xnvfile_snapshot_iterator *it,
        p->pid = xnthread_user_pid(thread);
        memcpy(p->name, thread->name, sizeof(p->name));
        p->cprio = thread->cprio;
-       p->dnprio = xnthread_get_denormalized_prio(thread, thread->cprio);
        p->state = xnthread_state_flags(thread);
        xnobject_copy_name(p->sched_class, thread->sched_class->name);
        period = xnthread_get_period(thread);
@@ -719,12 +717,7 @@ static int vfile_schedlist_show(struct 
xnvfile_snapshot_iterator *it,
                               "CPU", "PID", "CLASS", "PRI", "TIMEOUT",
                               "STAT", "NAME");
        else {
-               if (p->cprio != p->dnprio)
-                       snprintf(pbuf, sizeof(pbuf), "%3d(%d)",
-                                p->cprio, p->dnprio);
-               else
-                       snprintf(pbuf, sizeof(pbuf), "%3d", p->cprio);
-
+               snprintf(pbuf, sizeof(pbuf), "%3d", p->cprio);
                xntimer_format_time(p->timeout, tbuf, sizeof(tbuf));
                xnthread_format_status(p->state, sbuf, sizeof(sbuf));
 
diff --git a/kernel/cobalt/nucleus/shadow.c b/kernel/cobalt/nucleus/shadow.c
index 7f06fe3..2993bd1 100644
--- a/kernel/cobalt/nucleus/shadow.c
+++ b/kernel/cobalt/nucleus/shadow.c
@@ -2392,26 +2392,23 @@ static inline void do_setsched_event(struct task_struct 
*p, int priority)
                priority = 0;
 
        /*
+        * Reflect a Linux priority change for a given thread in the
+        * Xenomai scheduler.
+        *
         * Linux's priority scale is a subset of the core pod's
         * priority scale, so there is no need to bound the priority
-        * values when mapping them from Linux -> Xenomai. We
-        * propagate priority changes to the nucleus only for threads
-        * that belong to skins that have a compatible priority scale.
+        * values when mapping them from Linux -> Xenomai.
         *
         * BIG FAT WARNING: Change of scheduling parameters from the
         * Linux side are propagated only to threads that belong to
         * the Xenomai RT scheduling class. Threads from other classes
-        * are remain unaffected, since we could not map this
-        * information 1:1 between Linux and Xenomai.
+        * remain unaffected, since we could not map this information
+        * 1:1 between Linux and Xenomai.
         */
        if (thread->base_class != &xnsched_class_rt ||
            thread->cprio == priority)
                return;
 
-       if (xnthread_get_denormalized_prio(thread, priority) != priority)
-               /* Priority scales don't match 1:1. */
-               return;
-
        param.rt.prio = priority;
        __xnpod_set_thread_schedparam(thread, &xnsched_class_rt, &param, 0);
        sched = xnpod_current_sched();


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to