Skip to content

Commit afeebcd

Browse files
committed
fix(virtq): add instrumentation to virtq host calls
Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
1 parent 980527e commit afeebcd

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

fuzz/fuzz_targets/host_call.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ fuzz_target!(
6161
HyperlightError::GuestError(ErrorCode::HostFunctionError, msg) if msg.contains("The number of arguments to the function is wrong") => {}
6262
HyperlightError::ParameterValueConversionFailure(_, _) => {},
6363
HyperlightError::GuestError(ErrorCode::HostFunctionError, msg) if msg.contains("Failed To Convert Parameter Value") => {}
64+
HyperlightError::GuestError(ErrorCode::HostFunctionError, msg) if msg.contains("The parameter value type is unexpected") => {}
65+
HyperlightError::GuestError(ErrorCode::HostFunctionError, msg) if msg.contains("The return value type is unexpected") => {}
6466

6567
// any other error should be reported
6668
_ => panic!("Guest Aborted with Unexpected Error: {:?}", e),

src/hyperlight_guest/src/virtq/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use hyperlight_common::virtq::msg::{MsgKind, VirtqMsgHeader};
3333
use hyperlight_common::virtq::{
3434
self, BufferPool, Layout, Notifier, QueueStats, RecyclePool, Token, VirtqProducer,
3535
};
36+
use tracing::instrument;
3637

3738
use super::GuestMemOps;
3839
use crate::bail;
@@ -120,6 +121,7 @@ impl GuestContext {
120121
///
121122
/// The reply guard is checked before submitting the readwrite chain
122123
/// to ensure G2H capacity is reserved for pending responses.
124+
#[instrument(skip_all, level = "Info")]
123125
pub fn call_host_function<T: TryFrom<ReturnValue>>(
124126
&mut self,
125127
function_name: &str,

src/hyperlight_host/tests/integration_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,10 +716,10 @@ fn log_message() {
716716
// follows:
717717
// - logs from trace level tracing spans created as logs because of the tracing `log` feature
718718
// - 4 from evolve call (generic_init + hyperlight_main)
719-
// - 8 from guest call
719+
// - 4 from guest call (call_host_function + read_n_bytes_from_user_memory)
720720
// and are multiplied because we make 6 calls to `log_test_messages`
721721
// NOTE: These numbers need to be updated if log messages or spans are added/removed
722-
let num_fixed_trace_log = 12 * 6;
722+
let num_fixed_trace_log = 8 * 6;
723723

724724
// Calculate fixed info logs
725725
// - 4 logs per iteration from infrastructure at Info level (internal_dispatch_function)

0 commit comments

Comments
 (0)