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

[Minios-devel] [UNIKRAFT PATCH v3 07/12] lib/uksched: Add function for killing threads


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Sun, 10 Mar 2019 22:10:00 +0200
  • Cc: Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
  • Delivery-date: Sun, 10 Mar 2019 20:10:24 +0000
  • Ironport-phdr: 9a23:wLSCNxBri9DGjknLRcJ+UyQJP3N1i/DPJgcQr6AfoPdwSP37p86wAkXT6L1XgUPTWs2DsrQY0rKQ6/mocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmSaxbaluIBmrsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KOT4n/m/KhMJ+j6VVrxCvpxFk34LYfJuYOOZkc6/BYd8XQ3dKUMZLVyxGB4Oxd5UCD+0aPeZEron9oUYFox2jBQm0GePk1zhFiWPx3a0hz+QhEAfG0BYkH9ITqHTUsc74O7sJUeyv1KnI0C7MY+lM2Tf68YXFdA0qr/KUXb9obMbcxlQjGxnGg1iQs4DpIS2Z2+YXv2WV9+ZsSO2ih3M9pwxyojWj3Nkgh4fHi44P11zJ+jt1zYAoLtOiUkF7e8SrEJ5IuiGfMIt5X90tTnlzuCY/1r0GoZm7fDUWyJg/xx7QdfiHc4+Q7xL9UeaeOzZ4hHZ/dL2jnBa+61CgyvDnWcWuylZKqTJJktjKtn8Tyxze8tWLR/Rg8ku72juC1xrf5v9aLU02j6bWJYYtwrsqmZoStUTDEDX2mELzjKKOakok/fOo6/jmYrXgvJOcM5J0ihnjMqk1hsO/Gv40MhATX2eA4+i8zrrj8VXjQLpWlv02jrXZsJfCKMQep665BQ5V0oE46xqmEjipzsoYkmcDLF9efBKHjpPpO03VIPziAvawnVKsnC1sx/DcMb3rGo/NIWTbkLf9YbZ97FZRxgo3zdBY/ZJUC6sOIPTpVkHsqNPYDho5Mw2pzOb7E9h90J0RVn6LAqCDK6zeq0GH5v83KemWeIAVoCr9K+Qi5/P2ln85mUUSfbOz0psRcny4Be5pI0OFYXrsmNgBF30Fvg8lQezsllKNTTpTaGypUK4m+D47FZqsDZ3fSYC1nLyBwCC7E4VNZmBHD1CMFnHoe5+HW/cRdi2SJM5gnSIeVbW6TY8uyw2htAvgxLV8NObb5DAYv4r51Ndp/+3TiQ0y9TtsAsWdzmGNVWB0knkWRz8x2KBwvUx9ylSE0ahmmPFYE8Jc6O9NUgggLpHQ1fJ1C82hEj7GK9KITlehWZCqDC88Svo1wsQSeABtFtPkiQrMjASwBLpAvLuQGJ0yuobBx2W5c8160GrH0u8lkkE7asBUc3W7jOhl8F6AVMbyj0yFmvPyJuwn1ynX+TLbwA==
  • Ironport-sdr: foBFrLjj9BC6OnyAqnX9D0TXC5T8mJ8RBw1XT4ul89HEXiQrcHwZEM6/39Et3mDat+0P3QRbm8 NoxU1ZNpDZgQ==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Thread kill function replaces the thread destroy function as the
public function for triggering thread deaths.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
Reviewed-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
 lib/uksched/exportsyms.uk       | 1 +
 lib/uksched/include/uk/sched.h  | 2 ++
 lib/uksched/include/uk/thread.h | 4 ++--
 lib/uksched/sched.c             | 5 +++++
 lib/ukschedcoop/schedcoop.c     | 2 +-
 plat/xen/xenbus/xs_comms.c      | 2 +-
 6 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/uksched/exportsyms.uk b/lib/uksched/exportsyms.uk
index 3118383d..c67892c4 100644
--- a/lib/uksched/exportsyms.uk
+++ b/lib/uksched/exportsyms.uk
@@ -7,6 +7,7 @@ uk_sched_start
 uk_sched_idle_init
 uk_sched_thread_create
 uk_sched_thread_destroy
+uk_sched_thread_kill
 uk_sched_thread_sleep
 uk_sched_thread_exit
 uk_thread_init
diff --git a/lib/uksched/include/uk/sched.h b/lib/uksched/include/uk/sched.h
index e5630ed6..9e218688 100644
--- a/lib/uksched/include/uk/sched.h
+++ b/lib/uksched/include/uk/sched.h
@@ -217,6 +217,8 @@ struct uk_thread *uk_sched_thread_create(struct uk_sched 
*sched,
                void (*function)(void *), void *arg);
 void uk_sched_thread_destroy(struct uk_sched *sched,
                struct uk_thread *thread);
+void uk_sched_thread_kill(struct uk_sched *sched,
+               struct uk_thread *thread);
 
 static inline
 void uk_sched_thread_switch(struct uk_sched *sched,
diff --git a/lib/uksched/include/uk/thread.h b/lib/uksched/include/uk/thread.h
index 131268b4..f3891c29 100644
--- a/lib/uksched/include/uk/thread.h
+++ b/lib/uksched/include/uk/thread.h
@@ -69,8 +69,8 @@ UK_TAILQ_HEAD(uk_thread_list, struct uk_thread);
                        name, attr, function, data)
 #define uk_thread_create(name, function, data) \
        uk_thread_create_attr(name, NULL, function, data)
-#define uk_thread_destroy(thread) \
-       uk_sched_thread_destroy(thread->sched, thread)
+#define uk_thread_kill(thread) \
+       uk_sched_thread_kill(thread->sched, thread)
 void uk_thread_exit(struct uk_thread *thread);
 
 int uk_thread_wait(struct uk_thread *thread);
diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c
index a0d706f5..5f6bc685 100644
--- a/lib/uksched/sched.c
+++ b/lib/uksched/sched.c
@@ -222,6 +222,11 @@ void uk_sched_thread_destroy(struct uk_sched *sched, 
struct uk_thread *thread)
        uk_free(sched->allocator, thread);
 }
 
+void uk_sched_thread_kill(struct uk_sched *sched, struct uk_thread *thread)
+{
+       uk_sched_thread_remove(sched, thread);
+}
+
 void uk_sched_thread_sleep(__nsec nsec)
 {
        struct uk_thread *thread;
diff --git a/lib/ukschedcoop/schedcoop.c b/lib/ukschedcoop/schedcoop.c
index 2a646760..a3f265c6 100644
--- a/lib/ukschedcoop/schedcoop.c
+++ b/lib/ukschedcoop/schedcoop.c
@@ -128,7 +128,7 @@ static void schedcoop_schedule(struct uk_sched *s)
                        continue;
 
                if (thread != prev)
-                       uk_thread_destroy(thread);
+                       uk_sched_thread_destroy(s, thread);
        }
 }
 
diff --git a/plat/xen/xenbus/xs_comms.c b/plat/xen/xenbus/xs_comms.c
index 0589d48b..5c393c1e 100644
--- a/plat/xen/xenbus/xs_comms.c
+++ b/plat/xen/xenbus/xs_comms.c
@@ -617,6 +617,6 @@ void xs_comms_fini(void)
        xsh.buf = NULL;
 
        /* TODO stop thread, instead of killing it */
-       uk_thread_destroy(xsh.thread);
+       uk_thread_kill(xsh.thread);
        xsh.thread = NULL;
 }
-- 
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®.