summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kern/task.c11
-rw-r--r--kern/thread.c3
2 files changed, 11 insertions, 3 deletions
diff --git a/kern/task.c b/kern/task.c
index d7d91c17..c7caeb48 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -143,15 +143,22 @@ task_info(struct task *task)
printk("task: name: %s, threads:\n", task->name);
+ /*
+ * Don't grab any lock when accessing threads, so that the function
+ * can be used to debug in the middle of most critical sections.
+ * Threads are only destroyed after being removed from their task
+ * so holding the task lock is enough to guarantee existence.
+ */
list_for_each_entry(&task->threads, thread, task_node) {
- printk("task: " TASK_INFO_ADDR_FMT " %c %8s:" TASK_INFO_ADDR_FMT
- " %.2s:%02hu %s\n",
+ printk(TASK_INFO_ADDR_FMT " %c %8s:" TASK_INFO_ADDR_FMT
+ " %.2s:%02hu %02u %s\n",
(unsigned long)thread,
thread_state_to_chr(thread),
thread_wchan_desc(thread),
(unsigned long)thread_wchan_addr(thread),
thread_sched_class_to_str(thread_user_sched_class(thread)),
thread_user_priority(thread),
+ thread_real_global_priority(thread),
thread->name);
}
diff --git a/kern/thread.c b/kern/thread.c
index 436df07a..41d996b4 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1884,9 +1884,10 @@ thread_destroy(struct thread *thread)
thread_unlock_runq(runq, flags);
} while (state != THREAD_DEAD);
- thread_destroy_tsd(thread);
+ /* See task_info() */
task_remove_thread(thread->task, thread);
+ thread_destroy_tsd(thread);
turnstile_destroy(thread->priv_turnstile);
sleepq_destroy(thread->priv_sleepq);
kmem_cache_free(&thread_stack_cache, thread->stack);