[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 8/8] lib/uksched: Minor refinements


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Tue, 18 Sep 2018 18:27:29 +0300
  • Cc: felipe.huici@xxxxxxxxx, florian.schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx
  • Delivery-date: Tue, 18 Sep 2018 15:27:42 +0000
  • Ironport-phdr: 9a23:j12dFB1qWhMMkCjGsmDT+DRfVm0co7zxezQtwd8ZseMfLvad9pjvdHbS+e9qxAeQG9mDtLQc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q99pHPYQhEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7S60/Vza/4KdxUBLmiDkJOSM3/m/UjcJ/jqxbrQm9qxBj2YPYfJuYOOZicq7bYNgURXBBXsFUVyFZHI68aJAPD/YAPeZesoLzoUYOrQOjBQKxA+7g1jhIhmTq3a071eQtCwXG3BE4H9ITq3nbsM71OL0KUeCo16bE1y/Db/RP1Dr79YPGcQghrOmRUb9/bMbd00oiGgPfglmOt4DoPSmZ2+oVv2SG4OdsSPijhm0npg1rvDSiyMkhhpPUio8a1FzJ8zhyzpwvKt2iUkF7ZMapEJ5Xty6HKYR7WtgiQ2R0uCYizb0GpIK7cDAKyJs5wx7fbOSKc5aN4h35VeaRJS10i25+eL6lnxay7FOvxvfmVsmzyFpKryxFncfQtn0VyhDe5dWLRuF+80qhwzqDyR7f5+NeLU06jabbLoQuwr80lpodq0TDGSr2lV3qg6+RbUUk5umo6+L9brXiu5+cL5J0hxriPaQ1gMC/Gfk4PRMUU2iB/uSwzKfj8lHhQLVWkv02lbHUsJXbJcQdp665BBRV3p8+5BmhETepztAYkGIDLFJEYxKHk5PpN0vBIf/mC/ezmVOskC1kx/reJL3uHo3NLmTfkLfmZbt95VBTyA4yzdBH+Z1YELEBIO/yWkDttdzVFRk5PBKozObjEtpyzZkSVnySAqWBKqPdrUeI5v4zI+mLfIIVtjL9K/8/5/7vl3A5n0URfbK10psXbXC4H+lpI1mCbHrqnNgODWMKsRAlQ+DwllKCTCZZZ2yuUKIk+jE7FIWmAJ/YRoCshbyB2yG7EodVZmBbFF+MF3bpeJueW/oXbiKdPNNukjgeWre6UYMuywyuvhfgy7V7NurU5jEYtZX72dl1+u3TjxAy+SZqD8Sa12GCU2F0nmAPRz8ox61/p1JyxUuH0adimPNUD8Jc5+4aGjs9YJvdye19EJX+VxzMev+NSU26WZO2DDd3Scg+kPEUZEMoMNK5khHFlw63G6Jdw7eMH4A19OTYwmDsD81mjW7b3u87iA91EYN0KWS6i/snpEDoDInTnhDBmg==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

- 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);
 #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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.