[Xenomai-git] Gilles Chanteperdrix : sched: separate the scheduler status bits
Module: xenomai-head Branch: master Commit: 74d4cadd28981c2ac4c53529ec976872d8540108 URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=74d4cadd28981c2ac4c53529ec976872d8540108 Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org Date: Sat Nov 6 17:11:10 2010 +0100 sched: separate the scheduler status bits In 3 groups: - the scheduler status flags, which may be modified from a remote CPU, under nklock, stay in sched-status - the scheduler local flags, which are only changed from the local cpu, but may be modified without holding the nklock are in sched-lflags - the scheduler XNRPICK bit, which may be changed from a remote CPU, but easier to modify under sched-rpilock than nklock, is moved to sched-rpistatus. --- include/nucleus/pod.h |4 ++-- include/nucleus/sched.h | 29 ++--- ksrc/nucleus/intr.c | 22 +++--- ksrc/nucleus/pod.c | 14 +++--- ksrc/nucleus/sched.c|2 ++ ksrc/nucleus/shadow.c | 19 +-- ksrc/nucleus/timer.c| 10 +- 7 files changed, 58 insertions(+), 42 deletions(-) diff --git a/include/nucleus/pod.h b/include/nucleus/pod.h index bab9f07..8fc4019 100644 --- a/include/nucleus/pod.h +++ b/include/nucleus/pod.h @@ -277,10 +277,10 @@ static inline void xnpod_schedule(void) * unlocked context switch. */ #if XENO_DEBUG(NUCLEUS) - if (testbits(sched-status, XNKCOUT|XNINIRQ|XNSWLOCK)) + if (testbits(sched-status | sched-lflags, XNKCOUT|XNINIRQ|XNSWLOCK)) return; #else /* !XENO_DEBUG(NUCLEUS) */ - if (testbits(sched-status, + if (testbits(sched-status | sched-lflags, XNKCOUT|XNINIRQ|XNSWLOCK|XNRESCHED) != XNRESCHED) return; #endif /* !XENO_DEBUG(NUCLEUS) */ diff --git a/include/nucleus/sched.h b/include/nucleus/sched.h index 0e9c25e..49a69de 100644 --- a/include/nucleus/sched.h +++ b/include/nucleus/sched.h @@ -38,13 +38,17 @@ /* Sched status flags */ #define XNKCOUT0x8000 /* Sched callout context */ -#define XNHTICK0x4000 /* Host tick pending */ -#define XNRPICK0x2000 /* Check RPI state */ -#define XNINTCK0x1000 /* In master tick handler context */ -#define XNINIRQ0x0800 /* In IRQ handling context */ -#define XNSWLOCK 0x0400 /* In context switch */ -#define XNRESCHED 0x0200 /* Needs rescheduling */ -#define XNHDEFER 0x0100 /* Host tick deferred */ +#define XNINTCK0x4000 /* In master tick handler context */ +#define XNSWLOCK 0x2000 /* In context switch */ +#define XNRESCHED 0x1000 /* Needs rescheduling */ + +/* Sched local flags */ +#define XNHTICK0x8000 /* Host tick pending */ +#define XNINIRQ0x4000 /* In IRQ handling context */ +#define XNHDEFER 0x2000 /* Host tick deferred */ + +/* Sched RPI status flags */ +#define XNRPICK0x8000 /* Check RPI state */ struct xnsched_rt { xnsched_queue_t runnable; /*! Runnable thread queue. */ @@ -60,6 +64,7 @@ struct xnsched_rt { typedef struct xnsched { xnflags_t status; /*! Scheduler specific status bitmask. */ + xnflags_t lflags; /*! Scheduler specific local flags bitmask. */ int cpu; struct xnthread *curr; /*! Current thread. */ xnarch_cpumask_t resched; /*! Mask of CPUs needing rescheduling. */ @@ -98,6 +103,7 @@ typedef struct xnsched { #ifdef CONFIG_XENO_OPT_PRIOCPL DECLARE_XNLOCK(rpilock);/*! RPI lock */ + xnflags_t rpistatus; #endif #ifdef CONFIG_XENO_OPT_PERVASIVE @@ -176,16 +182,17 @@ static inline int xnsched_self_resched_p(struct xnsched *sched) /* Set self resched flag for the given scheduler. */ #define xnsched_set_self_resched(__sched__) do { \ - setbits((__sched__)-status, XNRESCHED); \ + __setbits((__sched__)-status, XNRESCHED); \ } while (0) /* Set specific resched flag into the local scheduler mask. */ #define xnsched_set_resched(__sched__) do {\ xnsched_t *current_sched = xnpod_current_sched();\ - setbits(current_sched-status, XNRESCHED); \ - if (current_sched != (__sched__)){ \ + __setbits(current_sched-status, XNRESCHED); \ + if (current_sched != (__sched__) \ + !testbits((__sched__)-status, XNRESCHED)) { \ xnarch_cpu_set(xnsched_cpu(__sched__), current_sched-resched); \ - setbits((__sched__)-status, XNRESCHED); \ + __setbits((__sched__)-status, XNRESCHED);
[Xenomai-git] Gilles Chanteperdrix : sched: separate the scheduler status bits
Module: xenomai-2.5 Branch: master Commit: 74d4cadd28981c2ac4c53529ec976872d8540108 URL: http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=74d4cadd28981c2ac4c53529ec976872d8540108 Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org Date: Sat Nov 6 17:11:10 2010 +0100 sched: separate the scheduler status bits In 3 groups: - the scheduler status flags, which may be modified from a remote CPU, under nklock, stay in sched-status - the scheduler local flags, which are only changed from the local cpu, but may be modified without holding the nklock are in sched-lflags - the scheduler XNRPICK bit, which may be changed from a remote CPU, but easier to modify under sched-rpilock than nklock, is moved to sched-rpistatus. --- include/nucleus/pod.h |4 ++-- include/nucleus/sched.h | 29 ++--- ksrc/nucleus/intr.c | 22 +++--- ksrc/nucleus/pod.c | 14 +++--- ksrc/nucleus/sched.c|2 ++ ksrc/nucleus/shadow.c | 19 +-- ksrc/nucleus/timer.c| 10 +- 7 files changed, 58 insertions(+), 42 deletions(-) diff --git a/include/nucleus/pod.h b/include/nucleus/pod.h index bab9f07..8fc4019 100644 --- a/include/nucleus/pod.h +++ b/include/nucleus/pod.h @@ -277,10 +277,10 @@ static inline void xnpod_schedule(void) * unlocked context switch. */ #if XENO_DEBUG(NUCLEUS) - if (testbits(sched-status, XNKCOUT|XNINIRQ|XNSWLOCK)) + if (testbits(sched-status | sched-lflags, XNKCOUT|XNINIRQ|XNSWLOCK)) return; #else /* !XENO_DEBUG(NUCLEUS) */ - if (testbits(sched-status, + if (testbits(sched-status | sched-lflags, XNKCOUT|XNINIRQ|XNSWLOCK|XNRESCHED) != XNRESCHED) return; #endif /* !XENO_DEBUG(NUCLEUS) */ diff --git a/include/nucleus/sched.h b/include/nucleus/sched.h index 0e9c25e..49a69de 100644 --- a/include/nucleus/sched.h +++ b/include/nucleus/sched.h @@ -38,13 +38,17 @@ /* Sched status flags */ #define XNKCOUT0x8000 /* Sched callout context */ -#define XNHTICK0x4000 /* Host tick pending */ -#define XNRPICK0x2000 /* Check RPI state */ -#define XNINTCK0x1000 /* In master tick handler context */ -#define XNINIRQ0x0800 /* In IRQ handling context */ -#define XNSWLOCK 0x0400 /* In context switch */ -#define XNRESCHED 0x0200 /* Needs rescheduling */ -#define XNHDEFER 0x0100 /* Host tick deferred */ +#define XNINTCK0x4000 /* In master tick handler context */ +#define XNSWLOCK 0x2000 /* In context switch */ +#define XNRESCHED 0x1000 /* Needs rescheduling */ + +/* Sched local flags */ +#define XNHTICK0x8000 /* Host tick pending */ +#define XNINIRQ0x4000 /* In IRQ handling context */ +#define XNHDEFER 0x2000 /* Host tick deferred */ + +/* Sched RPI status flags */ +#define XNRPICK0x8000 /* Check RPI state */ struct xnsched_rt { xnsched_queue_t runnable; /*! Runnable thread queue. */ @@ -60,6 +64,7 @@ struct xnsched_rt { typedef struct xnsched { xnflags_t status; /*! Scheduler specific status bitmask. */ + xnflags_t lflags; /*! Scheduler specific local flags bitmask. */ int cpu; struct xnthread *curr; /*! Current thread. */ xnarch_cpumask_t resched; /*! Mask of CPUs needing rescheduling. */ @@ -98,6 +103,7 @@ typedef struct xnsched { #ifdef CONFIG_XENO_OPT_PRIOCPL DECLARE_XNLOCK(rpilock);/*! RPI lock */ + xnflags_t rpistatus; #endif #ifdef CONFIG_XENO_OPT_PERVASIVE @@ -176,16 +182,17 @@ static inline int xnsched_self_resched_p(struct xnsched *sched) /* Set self resched flag for the given scheduler. */ #define xnsched_set_self_resched(__sched__) do { \ - setbits((__sched__)-status, XNRESCHED); \ + __setbits((__sched__)-status, XNRESCHED); \ } while (0) /* Set specific resched flag into the local scheduler mask. */ #define xnsched_set_resched(__sched__) do {\ xnsched_t *current_sched = xnpod_current_sched();\ - setbits(current_sched-status, XNRESCHED); \ - if (current_sched != (__sched__)){ \ + __setbits(current_sched-status, XNRESCHED); \ + if (current_sched != (__sched__) \ + !testbits((__sched__)-status, XNRESCHED)) { \ xnarch_cpu_set(xnsched_cpu(__sched__), current_sched-resched); \ - setbits((__sched__)-status, XNRESCHED); \ + __setbits((__sched__)-status, XNRESCHED);
[Xenomai-git] Gilles Chanteperdrix : sched: separate the scheduler status bits
Module: xenomai-head Branch: master Commit: 1e71e8300dfc64fef918033663567d6a65ad638c URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=1e71e8300dfc64fef918033663567d6a65ad638c Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org Date: Sat Nov 6 17:11:10 2010 +0100 sched: separate the scheduler status bits In 3 groups: - the scheduler status flags, which may be modified from a remote CPU, under nklock, stay in sched-status - the scheduler local flags, which are only changed from the local cpu, but may be modified without holding the nklock are in sched-lflags - the scheduler XNRPICK bit, which may be changed from a remote CPU, but easier to modify under sched-rpilock than nklock, is moved to sched-rpistatus. --- include/nucleus/pod.h |4 ++-- include/nucleus/sched.h | 29 ++--- ksrc/nucleus/intr.c | 22 +++--- ksrc/nucleus/pod.c | 14 +++--- ksrc/nucleus/sched.c|2 ++ ksrc/nucleus/shadow.c | 19 +-- ksrc/nucleus/timer.c| 10 +- 7 files changed, 58 insertions(+), 42 deletions(-) diff --git a/include/nucleus/pod.h b/include/nucleus/pod.h index 01ff0a7..d92884c 100644 --- a/include/nucleus/pod.h +++ b/include/nucleus/pod.h @@ -278,10 +278,10 @@ static inline void xnpod_schedule(void) * unlocked context switch. */ #if XENO_DEBUG(NUCLEUS) - if (testbits(sched-status, XNKCOUT|XNINIRQ|XNSWLOCK)) + if (testbits(sched-status | sched-lflags, XNKCOUT|XNINIRQ|XNSWLOCK)) return; #else /* !XENO_DEBUG(NUCLEUS) */ - if (testbits(sched-status, + if (testbits(sched-status | sched-lflags, XNKCOUT|XNINIRQ|XNSWLOCK|XNRESCHED) != XNRESCHED) return; #endif /* !XENO_DEBUG(NUCLEUS) */ diff --git a/include/nucleus/sched.h b/include/nucleus/sched.h index df56417..fb4606e 100644 --- a/include/nucleus/sched.h +++ b/include/nucleus/sched.h @@ -39,13 +39,17 @@ /* Sched status flags */ #define XNKCOUT0x8000 /* Sched callout context */ -#define XNHTICK0x4000 /* Host tick pending */ -#define XNRPICK0x2000 /* Check RPI state */ -#define XNINTCK0x1000 /* In master tick handler context */ -#define XNINIRQ0x0800 /* In IRQ handling context */ -#define XNSWLOCK 0x0400 /* In context switch */ -#define XNRESCHED 0x0200 /* Needs rescheduling */ -#define XNHDEFER 0x0100 /* Host tick deferred */ +#define XNINTCK0x4000 /* In master tick handler context */ +#define XNSWLOCK 0x2000 /* In context switch */ +#define XNRESCHED 0x1000 /* Needs rescheduling */ + +/* Sched local flags */ +#define XNHTICK0x8000 /* Host tick pending */ +#define XNINIRQ0x4000 /* In IRQ handling context */ +#define XNHDEFER 0x2000 /* Host tick deferred */ + +/* Sched RPI status flags */ +#define XNRPICK0x8000 /* Check RPI state */ struct xnsched_rt { xnsched_queue_t runnable; /*! Runnable thread queue. */ @@ -61,6 +65,7 @@ struct xnsched_rt { typedef struct xnsched { xnflags_t status; /*! Scheduler specific status bitmask. */ + xnflags_t lflags; /*! Scheduler specific local flags bitmask. */ int cpu; struct xnthread *curr; /*! Current thread. */ xnarch_cpumask_t resched; /*! Mask of CPUs needing rescheduling. */ @@ -99,6 +104,7 @@ typedef struct xnsched { #ifdef CONFIG_XENO_OPT_PRIOCPL DECLARE_XNLOCK(rpilock);/*! RPI lock */ + xnflags_t rpistatus; #endif #ifdef CONFIG_XENO_OPT_PERVASIVE @@ -177,16 +183,17 @@ static inline int xnsched_self_resched_p(struct xnsched *sched) /* Set self resched flag for the given scheduler. */ #define xnsched_set_self_resched(__sched__) do { \ - setbits((__sched__)-status, XNRESCHED); \ + __setbits((__sched__)-status, XNRESCHED); \ } while (0) /* Set specific resched flag into the local scheduler mask. */ #define xnsched_set_resched(__sched__) do {\ xnsched_t *current_sched = xnpod_current_sched();\ - setbits(current_sched-status, XNRESCHED); \ - if (current_sched != (__sched__)){ \ + __setbits(current_sched-status, XNRESCHED); \ + if (current_sched != (__sched__) \ + !testbits((__sched__)-status, XNRESCHED)) { \ xnarch_cpu_set(xnsched_cpu(__sched__), current_sched-resched); \ - setbits((__sched__)-status, XNRESCHED); \ + __setbits((__sched__)-status, XNRESCHED);