7 #include "jdb_module.h"
8 #include "static_init.h"
10 #include "mp_request.h"
13 class Jdb_mp_request_module : public Jdb_module
15 typedef Mp_request_queue::Fifo Fifo;
16 typedef Fifo::Item Item;
18 Jdb_mp_request_module() FIASCO_INIT;
23 Find_cpu(Item const *i) : r(i), cpu(~0U) {}
24 void operator()(unsigned _cpu) const
26 if (&Mp_request_queue::rq.cpu(_cpu) == r)
35 static Jdb_mp_request_module jdb_mp_request_module INIT_PRIORITY(JDB_MODULE_INIT_PRIO);
39 Jdb_mp_request_module::find_cpu(Item const *r)
44 Find_cpu _find_cpu(r);
45 Jdb::foreach_cpu(_find_cpu);
51 Jdb_mp_request_module::print_request(Item const *item)
53 printf(" Request item of cpu %u [%p]:\n"
54 " value = { func = %p, arg = %p, _lock=%lu }\n"
55 " next = %p (cpu %u)\n",
56 find_cpu(item), item, item->value.func, item->value.arg, item->value._lock,
57 item->next, find_cpu(item->next));
62 Jdb_mp_request_module::print_queue(unsigned cpu)
65 if (!Jdb::cpu_in_jdb(cpu))
67 bool online = Cpu::online(cpu);
70 printf("CPU %u is not online...\n", cpu);
73 printf("CPU %u has not entered JDB (try to display queue...\n", cpu);
76 Item const *item = &Mp_request_queue::rq.cpu(cpu);
77 Fifo const *fifo = &Mp_request_queue::fifo.cpu(cpu);
80 printf("CPU[%2u]: Mp request item @%p, Mp request FIFO @%p\n"
81 " Local queue Item:\n",
86 printf(" Request FIFO: head = %p(%u), tail = { %p(%u) }\n",
87 fifo->_head, find_cpu(fifo->_head),
88 fifo->_tail, find_cpu(fifo->_tail));
101 Jdb_module::Action_code
102 Jdb_mp_request_module::action (int cmd, void *&argbuf, char const *&fmt, int &next)
104 char const *c = (char const *)argbuf;
112 Jdb::foreach_cpu(&print_queue);
113 else if (*c >= '0' && *c <= '9')
115 next = *c; argbuf = &cpu; fmt = "%i";
116 return EXTRA_INPUT_WITH_NEXTCHAR;
127 Jdb_mp_request_module::num_cmds() const
133 Jdb_module::Cmd const *
134 Jdb_mp_request_module::cmds() const
138 { { 0, "", "mpqueue", "%C", "mpqueue all|<cpunum>\tdump X-CPU "
139 "request queues", &c } };
145 Jdb_mp_request_module::Jdb_mp_request_module()