[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 8/8] lib/uksched: Minor refinements
Hi, >- Schedulers implementations should set scheduler reference on threads >- uk_sched_start is public >- initialize reentrant field on threads >- remove redundant config dependencies on ukschedcoop lib > >Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx> >--- > lib/uksched/include/uk/sched.h | 14 ++++++-------- > lib/uksched/thread.c | 4 +++- > lib/ukschedcoop/Config.uk | 2 -- > lib/ukschedcoop/schedcoop.c | 1 + > 4 files changed, 10 insertions(+), 11 deletions(-) > >diff --git a/lib/uksched/include/uk/sched.h >b/lib/uksched/include/uk/sched.h >index 5800c07..9e04bfa 100644 >--- a/lib/uksched/include/uk/sched.h >+++ b/lib/uksched/include/uk/sched.h >@@ -112,7 +112,6 @@ static inline int uk_sched_thread_add(struct uk_sched >*s, > { > UK_ASSERT(s); > UK_ASSERT(t); >- t->sched = s; > return s->thread_add(s, t, attr); > } > >@@ -122,7 +121,6 @@ static inline void uk_sched_thread_remove(struct >uk_sched *s, > UK_ASSERT(s); > UK_ASSERT(t); > s->thread_remove(s, t); >- t->sched = NULL; > } > > static inline int uk_sched_thread_set_prio(struct uk_sched *s, >@@ -184,12 +182,6 @@ static inline struct uk_thread >*uk_sched_get_idle(struct uk_sched *s) > return &s->idle; > } > >-/* >- * Public scheduler functions >- */ >- >-void uk_sched_start(struct uk_sched *sched) __noreturn; >- > #define uk_sched_init(s, yield_func, \ > thread_add_func, thread_remove_func, \ > thread_set_prio_func, thread_get_prio_func, \ >@@ -205,6 +197,12 @@ void uk_sched_start(struct uk_sched *sched) >__noreturn; > uk_sched_register((s)); \ > } while (0) > >+/* >+ * Public scheduler functions >+ */ >+ >+void uk_sched_start(struct uk_sched *sched) __noreturn; >+ > > /* > * Internal thread scheduling functions >diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c >index a06e338..fa7d3a1 100644 >--- a/lib/uksched/thread.c >+++ b/lib/uksched/thread.c >@@ -29,6 +29,7 @@ > * Thread definitions > * Ported from Mini-OS > */ >+#include <string.h> > #include <stdlib.h> > #include <errno.h> > #include <uk/plat/config.h> >@@ -89,10 +90,11 @@ int uk_thread_init(struct uk_thread *thread, > thread->flags = 0; > thread->wakeup_time = 0LL; > uk_waitq_init(&thread->waiting_threads); >+ thread->sched = NULL; > thread->sched_info = NULL; > > #ifdef CONFIG_HAVE_LIBC >- //TODO _REENT_INIT_PTR(&thread->reent); >+ _REENT_INIT_PTR(&thread->reent); As far as I can tell, struct _reent is newlib-specific. We should not tie Unikraft to a particular libc implementation… > #endif > > uk_printd(DLVL_INFO, "Thread \"%s\": pointer: %p, stack: %p\n", >diff --git a/lib/ukschedcoop/Config.uk b/lib/ukschedcoop/Config.uk >index b4277a1..8a50725 100644 >--- a/lib/ukschedcoop/Config.uk >+++ b/lib/ukschedcoop/Config.uk >@@ -1,6 +1,4 @@ > config LIBUKSCHEDCOOP > bool "ukschedcoop: Cooperative Round-Robin scheduler" > default n >- select LIBNOLIBC if !HAVE_LIBC >- select LIBUKDEBUG > select LIBUKSCHED >diff --git a/lib/ukschedcoop/schedcoop.c b/lib/ukschedcoop/schedcoop.c >index 3b3a554..ff0366a 100644 >--- a/lib/ukschedcoop/schedcoop.c >+++ b/lib/ukschedcoop/schedcoop.c >@@ -148,6 +148,7 @@ static int schedcoop_thread_add(struct uk_sched *s, >struct uk_thread *t, > } > > set_runnable(t); >+ t->sched = s; > > flags = ukplat_lcpu_save_irqf(); > UK_TAILQ_INSERT_TAIL(&prv->thread_list, t, thread_list); >-- >2.11.0 > _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |