summaryrefslogtreecommitdiff
path: root/ddb
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2023-09-29 04:59:44 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-09-29 11:04:37 +0200
commitdc8b8ba82a33897cd5cf89a61f1b1599e9a30f8b (patch)
tree5559186a4db64c78ff00e4b8547fc34119f17ba9 /ddb
parentb78e0fc8201610a7a17a163701ac06422c0a74b0 (diff)
kdb: Add "show all runqs" debug command
Message-Id: <20230929045936.31535-1-damien@zamaudio.com>
Diffstat (limited to 'ddb')
-rw-r--r--ddb/db_command.c1
-rw-r--r--ddb/db_print.c27
-rw-r--r--ddb/db_print.h6
3 files changed, 34 insertions, 0 deletions
diff --git a/ddb/db_command.c b/ddb/db_command.c
index d21386e6..2fae61b0 100644
--- a/ddb/db_command.c
+++ b/ddb/db_command.c
@@ -309,6 +309,7 @@ struct db_command db_show_all_cmds[] = {
{ "tasks", db_show_all_tasks, 0, 0 },
{ "threads", db_show_all_threads, 0, 0 },
{ "slocks", (db_command_fun_t)db_show_all_slocks, 0, 0 },
+ { "runqs", (db_command_fun_t)db_show_all_runqs, 0, 0 },
{ (char *)0 }
};
diff --git a/ddb/db_print.c b/ddb/db_print.c
index 3fbafe74..89250f7b 100644
--- a/ddb/db_print.c
+++ b/ddb/db_print.c
@@ -39,6 +39,9 @@
#include <kern/task.h>
#include <kern/thread.h>
#include <kern/queue.h>
+#include <kern/sched.h>
+#include <kern/processor.h>
+#include <kern/smp.h>
#include <ipc/ipc_port.h>
#include <ipc/ipc_space.h>
@@ -329,6 +332,30 @@ db_show_all_tasks(db_expr_t addr,
}
}
+static void showrq(run_queue_t rq)
+{
+ db_printf("count(%d) low(%d)\n", rq->count, rq->low);
+}
+
+/*ARGSUSED*/
+void
+db_show_all_runqs(
+ db_expr_t addr,
+ boolean_t have_addr,
+ db_expr_t count,
+ const char * modif)
+{
+ int i;
+
+ db_printf("Processor set runq:\t");
+ showrq(&default_pset.runq);
+ for (i = 0; i < smp_get_numcpus(); i++) {
+ db_printf("Processor #%d runq:\t", i);
+ showrq(&cpu_to_processor(i)->runq);
+ }
+ db_printf("Stuck threads:\t%d", stuck_count);
+}
+
/*ARGSUSED*/
void
db_show_all_threads(
diff --git a/ddb/db_print.h b/ddb/db_print.h
index 87db97be..27b3990a 100644
--- a/ddb/db_print.h
+++ b/ddb/db_print.h
@@ -50,6 +50,12 @@ void db_show_all_threads(
db_expr_t count,
const char * modif);
+void db_show_all_runqs(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ const char * modif);
+
db_addr_t db_task_from_space(
ipc_space_t space,
int *task_id);