[Xenomai-git] Philippe Gerum : nucleus: demote RPI boost upon linux-originated signal

2010-10-04 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: e10a88e8cd9ef54a14ac36359b16dcd71e299df7
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=e10a88e8cd9ef54a14ac36359b16dcd71e299df7

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Aug 16 17:21:15 2010 +0200

nucleus: demote RPI boost upon linux-originated signal

This patch clears the RPI boost for any relaxed thread which is
getting a signal while running, so that it won't keep a boosted
priority to process asynchronous linux-originated events, such as
termination signals.

Rationale: RPI is mainly for preventing priority inversion during
normal operations in secondary mode, handling signals should not apply
there, since this would also boost low-priority cleanup work, which is
unwanted. The thread may get RPI-boosted again the next time it
resumes for suspension, linux-wise (if ever it does).

---

 ksrc/nucleus/shadow.c |   23 ---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 9c801aa..52ee381 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -2641,7 +2641,7 @@ static inline void do_sigwake_event(struct task_struct *p)
struct xnthread *thread = xnshadow_thread(p);
spl_t s;
 
-   if (!thread)
+   if (thread == NULL)
return;
 
xnlock_get_irqsave(nklock, s);
@@ -2660,8 +2660,25 @@ static inline void do_sigwake_event(struct task_struct 
*p)
}
}
 
-   if (xnthread_test_state(thread, XNRELAX))
-   goto unlock_and_exit;
+   /*
+* If a relaxed thread is getting a signal while running, we
+* force it out of RPI, so that it won't keep a boosted
+* priority to process asynchronous linux-originated events,
+* such as termination signals. RPI is mainly for preventing
+* priority inversion during normal operations in secondary
+* mode, handling signals should not apply there, since this
+* would also boost low-priority cleanup work, which is
+* unwanted. The thread may get RPI-boosted again the next
+* time it resumes for suspension, linux-wise (if ever it
+* does).
+*/
+   if (xnthread_test_state(thread, XNRELAX)) {
+   xnlock_put_irqrestore(nklock, s);
+   rpi_pop(thread);
+   xnpod_schedule();
+   return;
+   }
+
/*
 * If we are kicking a shadow thread in primary mode, make
 * sure Linux won't schedule in its mate under our feet as a


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


[Xenomai-git] Philippe Gerum : nucleus: demote RPI boost upon linux-originated signal

2010-08-16 Thread GIT version control
Module: xenomai-rpm
Branch: for-upstream
Commit: ee4e5536029ba326e36cb8862cced20d8c3a4c63
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=ee4e5536029ba326e36cb8862cced20d8c3a4c63

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Aug 16 17:21:15 2010 +0200

nucleus: demote RPI boost upon linux-originated signal

This patch clears the RPI boost for any relaxed thread which is
getting a signal while running, so that it won't keep a boosted
priority to process asynchronous linux-originated events, such as
termination signals.

Rationale: RPI is mainly for preventing priority inversion during
normal operations in secondary mode, handling signals should not apply
there, since this would also boost low-priority cleanup work, which is
unwanted. The thread may get RPI-boosted again the next time it
resumes for suspension, linux-wise (if ever it does).

---

 ksrc/nucleus/shadow.c |   23 ---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 9c801aa..52ee381 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -2641,7 +2641,7 @@ static inline void do_sigwake_event(struct task_struct *p)
struct xnthread *thread = xnshadow_thread(p);
spl_t s;
 
-   if (!thread)
+   if (thread == NULL)
return;
 
xnlock_get_irqsave(nklock, s);
@@ -2660,8 +2660,25 @@ static inline void do_sigwake_event(struct task_struct 
*p)
}
}
 
-   if (xnthread_test_state(thread, XNRELAX))
-   goto unlock_and_exit;
+   /*
+* If a relaxed thread is getting a signal while running, we
+* force it out of RPI, so that it won't keep a boosted
+* priority to process asynchronous linux-originated events,
+* such as termination signals. RPI is mainly for preventing
+* priority inversion during normal operations in secondary
+* mode, handling signals should not apply there, since this
+* would also boost low-priority cleanup work, which is
+* unwanted. The thread may get RPI-boosted again the next
+* time it resumes for suspension, linux-wise (if ever it
+* does).
+*/
+   if (xnthread_test_state(thread, XNRELAX)) {
+   xnlock_put_irqrestore(nklock, s);
+   rpi_pop(thread);
+   xnpod_schedule();
+   return;
+   }
+
/*
 * If we are kicking a shadow thread in primary mode, make
 * sure Linux won't schedule in its mate under our feet as a


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