oxidecomputer/humility

`humility diagnose` doesn't work with newer kernels

hawkw opened this issue · 0 comments

On a build of the Gimletlet app from oxidecomputer/hubris@acd41c7, the humility diagnose command doesn't work, because it can't find the TASK_TABLE_BASE symbol:

$ humility -t gimletlet diagnose
humility: attached to 0483:3754:000B00154D46501520383832 via ST-Link V3

--- Initial Inspection ---

Taking initial snapshot of task status...
humility diagnose failed: expected symbol TASK_TABLE_BASE not found

However, the humility tasks command does work, suggesting that my Hubris image is fine:

$ humility -t gimletlet tasks
:; humility -t gimletlet tasks
humility: attached to 0483:3754:000B00154D46501520383832 via ST-Link V3
system time = 45397
ID TASK                       GEN PRI STATE
 0 jefe                         0   0 recv, notif: fault timer(T+3)
 1 sys                          0   1 recv, notif: exti-wildcard-irq(irq6/irq7/irq8/irq9/irq10/irq23/irq40)
 2 i2c_driver                   0   2 recv
 3 user_leds                    0   5 recv, notif: timer
 4 pong                         0   8 recv, notif: timer(T+103)
 5 uartecho                     0   3 notif: usart-irq(irq38)
 6 hiffy                        0   7 notif: bit31(T+39)
 7 validate                     0   3 recv
 8 idle                         0   9 RUNNING
 9 rng_driver                   0   6 recv
10 update_server                0   3 recv
11 caboose_reader               0   2 recv
12 packrat                      0   3 recv
13 control_plane_agent          0   7 recv, notif: usart-irq(irq37) socket timer
14 sensor                       0   5 recv
15 dump_agent                   0   6 recv, notif: socket
16 gimlet_seq                   0   2 recv
17 host_sp_comms                0   8 wait: send to hf/gen0
18 hf                           0   6 notif: bit31(T+667)
19 hash_driver                  0   2 recv
20 net                          0   3 recv, notif: eth-irq(irq61) wake-timer(T+4638)
21 udprpc                       0   6 notif: socket
22 udpecho                      0   4 notif: socket
23 udpbroadcast                 0   6 notif: bit31(T+229)
24 sprot                        0   5 recv

I believe this is because TASK_TABLE_BASE only exists on older kernels, per this comment:

//
// On older kernels, we expect to find the task table through an
// indirect pointer (TASK_TABLE_BASE); on newer kernels, it's entirely
// statically allocated (HUBRIS_TASK_TABLE_SPACE).
//
if let Ok(base) = self.lookup_symword("TASK_TABLE_BASE") {
let size = core
.read_word_32(self.lookup_symword("TASK_TABLE_SIZE")?)
.context("failed to read TASK_TABLE_SIZE")?;
let base = core
.read_word_32(base)
.context("failed to read TASK_TABLE_BASE")?;
Ok((base, size))
} else if let Ok(t) = self.lookup_variable("HUBRIS_TASK_TABLE_SPACE") {
let task = self.lookup_struct_byname("Task")?;
Ok((t.addr, (t.size / task.size) as u32))
} else {
bail!(
"could not find task table as \
TASK_TABLE_BASE or HUBRIS_TASK_TABLE_SPACE"
)
}

But, humility diagnose doesn't use that code; it only looks for the older task table symbols:

// Mise en place:
let base = core.read_word_32(hubris.lookup_symword("TASK_TABLE_BASE")?)?;
let task_count =
core.read_word_32(hubris.lookup_symword("TASK_TABLE_SIZE")?)? as usize;
let task_t = hubris.lookup_struct_byname("Task")?.clone();