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

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


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Thu, 10 Jan 2019 17:22:12 +0200
  • Cc: felipe.huici@xxxxxxxxx, Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx
  • Delivery-date: Thu, 10 Jan 2019 15:22:26 +0000
  • Ironport-phdr: 9a23:OgtsaxI6wpi2TRYTTdmcpTZWNBhigK39O0sv0rFitYgfI/jxwZ3uMQTl6Ol3ixeRBMOHs6IC07KempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffwZFiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLdQgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgflhicZOTAk/m/Zict+g6BVoB+6uxBz35TZbJ2POfZiYq/Qe84RS2pbXsZWUixMGp2xb4wUD+odPOZYqZT2qV0TrRumGAmnGeTixSNPhn/twa060uIhHRvC3Aw9B9IOrW/Zo8nuNKsISeC10bLHwS/Zb/NRwDrw7pXDfBM5ofyUQL59ftfdxVMsGg7FlFmct5LpMjGP2ukDq2SX8uVtWf+1h2Mkqwx9uCajy8kih4XTm44YxU7I+CNky4gvP9K4UlR0Ydu8HZtVsCGVKpV5T9s5Q2FtpCY60roGuYOnfCQSyJQo2Rrfa/uffoiW5xLsTueRITNiiH15Y7KznQ6y8VW7xeHmTMm0105GritDktbSqnAAzwHf58eaRvdn/Uqs2SyD2x7N5uxGO0w5m7LXK5s7zb4xkpoTv17DHijzmEjukKCWcV4k+vSp6+TheLnmooKcN5dpigzlLqsugdazAfwlMgcVRWSb4+O82KX5/ULlWLVKkuE2kq7BvZDfJMQboK+5AwhO0oo69hmwESmm38ocnXQcKFJFeQmHj5TyO13UL/H3E/G/j06rkDdxyPDMJqfhDYnVLnjfjLfheq5w5U5YyAo019Bf5ohbCrcbLPzuRkDxtNnYDh4kPAyo2OvnDsty2Z8aWW2VGaCVKr3dsUKQ7OI1P+aMfJMVuCr6K/U96f7hk3s5mV4Ffaa3x5cXaG24HvV6LEWYenfshMkOHnsOvgUkV+PmkkONUSNLbXaoQ608/i07CJ6hDYrbXYCtgbmB3CC9HpFMZWBGF06DEXHpdoqaQfcBcySSLdF9nTwAT7euUJUt2g+ztAXi0bpoMvLU+jEEtZLkzNV05/DTlQsz9TBuEcSd1GWNQH10nmMLQD82wrtyoUpjxVif1ah3medXGcZN6PNUAU8GMsvZzup7DMu3Vg/fc9OhTFe9Xs7gETw3CNUrzIwgeUF4Tv6llQzC2WKOHqcI3+iAA4co86Sa22XpOu520DDeyaNnlV5wEZgHDnGvmqMqr1ubPIXOiUjMz6s=
  • 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 if newlib enabled
- remove redundant config dependencies on ukschedcoop lib

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/uksched/include/uk/sched.h  | 14 ++++++--------
 lib/uksched/include/uk/thread.h |  4 ++--
 lib/uksched/thread.c            |  6 ++++--
 lib/ukschedcoop/Config.uk       |  2 --
 lib/ukschedcoop/schedcoop.c     |  1 +
 5 files changed, 13 insertions(+), 14 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/include/uk/thread.h b/lib/uksched/include/uk/thread.h
index 4c4e037..7f3c2fd 100644
--- a/lib/uksched/include/uk/thread.h
+++ b/lib/uksched/include/uk/thread.h
@@ -29,7 +29,7 @@
 #define __UK_THREAD_H__
 
 #include <stdint.h>
-#ifdef CONFIG_HAVE_LIBC
+#ifdef CONFIG_LIBNEWLIBC
 #include <sys/reent.h>
 #endif
 #include <uk/arch/lcpu.h>
@@ -56,7 +56,7 @@ struct uk_thread {
        struct uk_waitq waiting_threads;
        struct uk_sched *sched;
        void *sched_info;
-#ifdef CONFIG_HAVE_LIBC
+#ifdef CONFIG_LIBNEWLIBC
        struct _reent reent;
 #endif
 };
diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c
index bf1e0d3..d9d340c 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);
+#ifdef CONFIG_LIBNEWLIBC
+       _REENT_INIT_PTR(&thread->reent);
 #endif
 
        uk_pr_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 3536ea6..3d42626 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®.