Do not acquire channel name on the core1

Signed-off-by: Egor Savkin <es@m-labs.hk>
1697-rtiomap
Egor Savkin 2022-12-20 17:47:02 +08:00
parent 3238ad2ef0
commit 439653b02a
3 changed files with 19 additions and 11 deletions

View File

@ -1,4 +1,4 @@
use core::fmt;
use core::{fmt, slice, str};
use core::cell::RefCell;
use alloc::{vec, vec::Vec, string::String, collections::BTreeMap, rc::Rc};
use log::{info, warn, error};
@ -31,7 +31,7 @@ use crate::rpc;
use crate::moninj;
use crate::mgmt;
use crate::analyzer;
use crate::rtio_mgt;
use crate::rtio_mgt::{self, resolve_channel_name};
#[cfg(has_drtio)]
use crate::pl;
@ -246,7 +246,16 @@ async fn handle_run_kernel(stream: Option<&TcpStream>, control: &Rc<RefCell<kern
for exception in exceptions.iter() {
let exception = exception.as_ref().unwrap();
write_i32(stream, exception.id as i32).await?;
write_exception_string(stream, exception.message).await?;
if exception.message.len() == usize::MAX { // exception with host string
write_exception_string(stream, exception.message).await?;
} else {
let msg = str::from_utf8(unsafe { slice::from_raw_parts(exception.message.as_ptr(), exception.message.len()) })
.unwrap()
.replace("{rtio_channel_info:0}", &format!("{}:{}", exception.param[0], resolve_channel_name(exception.param[0] as u32)));
write_exception_string(stream, unsafe { CSlice::new(msg.as_ptr(), msg.len()) }).await?;
}
write_i64(stream, exception.param[0] as i64).await?;
write_i64(stream, exception.param[1] as i64).await?;
write_i64(stream, exception.param[2] as i64).await?;

View File

@ -2,7 +2,6 @@ use crate::{
pl::csr,
artiq_raise,
rtio,
rtio_mgt::resolve_channel_name,
};
use alloc::{vec::Vec, string::String, boxed::Box};
use cslice::CSlice;
@ -199,13 +198,13 @@ pub extern fn dma_playback(timestamp: i64, ptr: i32) {
csr::rtio_dma::error_write(1);
if error & 1 != 0 {
artiq_raise!("RTIOUnderflow",
format!("RTIO underflow at {{0}} mu, channel {}:{}", channel, resolve_channel_name(channel as u32)),
timestamp as i64, channel as i64, 0);
"RTIO underflow at {1} mu, channel {rtio_channel_info:0}",
channel as i64, timestamp as i64, 0);
}
if error & 2 != 0 {
artiq_raise!("RTIODestinationUnreachable",
format!("RTIO destination unreachable, output, at {{0}} mu, channel {}:{}", channel, resolve_channel_name(channel as u32)),
timestamp as i64, channel as i64, 0);
"RTIO destination unreachable, output, at {1} mu, channel {rtio_channel_info:0}",
channel as i64, timestamp as i64, 0);
}
}
}

View File

@ -226,15 +226,15 @@ pub mod drtio {
destination_set_up(routing_table, up_destinations, destination, false).await,
Ok(Packet::DestinationOkReply) => (),
Ok(Packet::DestinationSequenceErrorReply { channel }) =>{
error!("[DEST#{}] RTIO sequence error involving channel 0x{:04x}", destination, channel);
error!("[DEST#{}] RTIO sequence error involving channel {} 0x{:04x}", destination, resolve_channel_name(channel), channel);
unsafe { SEEN_ASYNC_ERRORS |= ASYNC_ERROR_SEQUENCE_ERROR };
}
Ok(Packet::DestinationCollisionReply { channel }) =>{
error!("[DEST#{}] RTIO collision involving channel 0x{:04x}", destination, channel);
error!("[DEST#{}] RTIO collision involving channel {} 0x{:04x}", destination, resolve_channel_name(channel), channel);
unsafe { SEEN_ASYNC_ERRORS |= ASYNC_ERROR_COLLISION };
}
Ok(Packet::DestinationBusyReply { channel }) =>{
error!("[DEST#{}] RTIO busy error involving channel 0x{:04x}", destination, channel);
error!("[DEST#{}] RTIO busy error involving channel {} 0x{:04x}", destination, resolve_channel_name(channel), channel);
unsafe { SEEN_ASYNC_ERRORS |= ASYNC_ERROR_BUSY };
}
Ok(packet) => error!("[DEST#{}] received unexpected aux packet: {:?}", destination, packet),