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

[Minios-devel] [UNIKRAFT PATCH v3 08/12] lib/uksched: Set scheduler reference in scheduler implementation


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Sun, 10 Mar 2019 22:10:01 +0200
  • Cc: Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
  • Delivery-date: Sun, 10 Mar 2019 20:10:18 +0000
  • Ironport-phdr: 9a23:AjokcBE5AJomTYvHoByGLJ1GYnF86YWxBRYc798ds5kLTJ76p8y4bnLW6fgltlLVR4KTs6sC17OO9fi5EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCehbb9oMBm6sBjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjmk8qxlSgLniD0fOjA57m/Zl8J+gqFcrh2jqRxy2JLYbJ2POfZiZK7RYc8WSGxcVchRTSxBBYa8YpMRAuoGJuZYs4j9p10TphW4GAmsHP7vwSJPi3Dq2q06yPghEQDA3AA6G9IOrWzUrMjuOagOSuC51rHIzSjYYP9Mwzf975HFfxY8qv+PRbJ9adfdxEYyGw/fjVidqZbpMy2L2ukPqWSW4fJsWf+ghmI6sQ18oTiiyt0yhoTHiI8Z0E3I+CpnzIszONa2UlR0YcS+H5tVryyaMox2Td48TGxwoyY6z6EGuYa8fCgX1JQr3x7fZOKDc4iP+h/jSuORLi15hHJhYr6wmw2y/VK4yu3hTca4ykxKri1dntnNsHACyQDT59CaRvZy40utwzWC2gDJ5u1aP0w5l7DXJpA5zr41jJUTsEDDHiHsmEXxia+bblkr+u+z6+T7Y7XmoIWQN4tpigHmL6QjgdCwAf8iPggWQmiU4v6w1Kfk/UHhWrVFkuU2krXFsJDdPckbo6+5AwlU0oYk8BazFiqp38oGnXYZKFJIYxaHj4nyO1HSO/D0F/i+jEqqkDtxwPDGJLLhCI3XLnffiLfhYap960lExQQzydBf4IhUCrAbL/L1QEP/qcDXDh88Mwy13unnFM5w1oUAVm2TBq+WKrjdvUWW6eIyO+OMfpMauC7hK/g54P7jlWQ5mV8Hcqmzx5QXbmq0Hu98LEWffXrsgs0OEWEQsQo7V+HqjkONXiJXZ3moRK0w/C80CJ++B4fZWo+tmKCB3Du8HpBOfWBGC1WMEXDud4meWPcMdTydIslgkzMaT7isUIkh2g+yuw/+0bVoNfDY9TMFtZj7zth6+/XTlQ0u9TxzF8mc03yNT3t1nm8SWT8226R/rlB9yleA1qh4nedVFdpN6PxVVgc1L4XTw/ZkBNDvCUr9eYKMSVCnRc7jDTwvQ9YZx94Vf107C9ikyBfZ0HmEGbgQwpeMH4A19Or4wmDsb5J2zG3a1a9ni0Q+X+NELiu+m6Q57Q+FVN2BqFmQi6v/LfdU5yXK7mrWlWc=
  • Ironport-sdr: 5ml/wZlTvr/chOzIzv6IycnqeavhCCvjplQWo+YqYYghfuQiMQgPGpH+epJyzfW9HK3cjEN+F0 50RRD1bo0kYQ==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Scheduler reference should be set in scheduler 'methods' because this is
done after validations specific to scheduler implementation are made.
Thus, an error might prevent threads of being added/removed from
schedulers internal collections.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/uksched/include/uk/sched.h | 2 --
 lib/uksched/thread.c           | 1 +
 lib/ukschedcoop/schedcoop.c    | 1 +
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/uksched/include/uk/sched.h b/lib/uksched/include/uk/sched.h
index 9e218688..0e8f1e26 100644
--- a/lib/uksched/include/uk/sched.h
+++ b/lib/uksched/include/uk/sched.h
@@ -114,7 +114,6 @@ static inline void uk_sched_thread_add(struct uk_sched *s,
        UK_ASSERT(t);
        if (attr)
                t->detached = attr->detached;
-       t->sched = s;
        s->thread_add(s, t, attr);
 }
 
@@ -124,7 +123,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,
diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c
index 8602402a..e52bb30f 100644
--- a/lib/uksched/thread.c
+++ b/lib/uksched/thread.c
@@ -89,6 +89,7 @@ int uk_thread_init(struct uk_thread *thread,
        thread->wakeup_time = 0LL;
        thread->detached = false;
        uk_waitq_init(&thread->waiting_threads);
+       thread->sched = NULL;
 
 #ifdef CONFIG_HAVE_LIBC
        //TODO _REENT_INIT_PTR(&thread->reent);
diff --git a/lib/ukschedcoop/schedcoop.c b/lib/ukschedcoop/schedcoop.c
index a3f265c6..c19a276a 100644
--- a/lib/ukschedcoop/schedcoop.c
+++ b/lib/ukschedcoop/schedcoop.c
@@ -139,6 +139,7 @@ static void schedcoop_thread_add(struct uk_sched *s, struct 
uk_thread *t,
        struct schedcoop_private *prv = s->prv;
 
        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®.