Skip to content

Commit bf7be03

Browse files
committed
[trace-guest] Update guest library trace levels and remove explicit parent
Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
1 parent e0d762d commit bf7be03

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

src/hyperlight_guest/src/exit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use tracing::instrument;
2222

2323
/// Halt the execution of the guest and returns control to the host.
2424
#[inline(never)]
25-
#[instrument(skip_all, level = "Trace")]
25+
#[instrument(skip_all, level = "Info")]
2626
pub fn halt() {
2727
#[cfg(feature = "trace_guest")]
2828
{
@@ -123,7 +123,7 @@ pub(crate) fn outb(port: u16, data: &[u8]) {
123123
}
124124

125125
/// OUT function for sending a 32-bit value to the host.
126-
#[instrument(skip_all, level = "Trace")]
126+
#[instrument(skip_all, level = "Info")]
127127
pub(crate) unsafe fn out32(port: u16, val: u32) {
128128
#[cfg(feature = "trace_guest")]
129129
{

src/hyperlight_guest/src/guest_handle/host_comm.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ impl GuestHandle {
6767
///
6868
/// When calling `call_host_function<T>`, this function is called
6969
/// internally to get the return value.
70+
#[instrument(skip_all, level = "Trace")]
7071
pub fn get_host_return_value<T: TryFrom<ReturnValue>>(&self) -> Result<T> {
7172
let inner = self
7273
.try_pop_shared_input_data_into::<FunctionCallResult>()
@@ -93,6 +94,7 @@ impl GuestHandle {
9394
///
9495
/// Note: The function return value must be obtained by calling
9596
/// `get_host_return_value`.
97+
#[instrument(skip_all, level = "Trace")]
9698
pub fn call_host_function_without_returning_result(
9799
&self,
98100
function_name: &str,
@@ -126,7 +128,7 @@ impl GuestHandle {
126128
/// sends it to the host, and then retrieves the return value.
127129
///
128130
/// The return value is deserialized into the specified type `T`.
129-
#[instrument(skip_all, level = "Trace")]
131+
#[instrument(skip_all, level = "Info")]
130132
pub fn call_host_function<T: TryFrom<ReturnValue>>(
131133
&self,
132134
function_name: &str,
@@ -154,6 +156,7 @@ impl GuestHandle {
154156
}
155157

156158
/// Log a message with the specified log level, source, caller, source file, and line number.
159+
#[instrument(skip_all, level = "Trace")]
157160
pub fn log_message(
158161
&self,
159162
log_level: LogLevel,

src/hyperlight_guest/src/guest_handle/io.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ use core::any::type_name;
2020
use core::slice::from_raw_parts_mut;
2121

2222
use hyperlight_common::flatbuffer_wrappers::guest_error::ErrorCode;
23-
use tracing::{Span, instrument};
23+
use tracing::instrument;
2424

2525
use super::handle::GuestHandle;
2626
use crate::error::{HyperlightGuestError, Result};
2727

2828
impl GuestHandle {
2929
/// Pops the top element from the shared input data buffer and returns it as a T
30-
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
30+
#[instrument(skip_all, level = "Trace")]
3131
pub fn try_pop_shared_input_data_into<T>(&self) -> Result<T>
3232
where
3333
T: for<'a> TryFrom<&'a [u8]>,
@@ -89,7 +89,7 @@ impl GuestHandle {
8989
}
9090

9191
/// Pushes the given data onto the shared output data buffer.
92-
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
92+
#[instrument(skip_all, level = "Trace")]
9393
pub fn push_shared_output_data(&self, data: &[u8]) -> Result<()> {
9494
let peb_ptr = self.peb().unwrap();
9595
let output_stack_size = unsafe { (*peb_ptr).output_stack.size as usize };

src/hyperlight_guest_bin/src/guest_function/call.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ use hyperlight_common::flatbuffer_wrappers::function_types::{FunctionCallResult,
2323
use hyperlight_common::flatbuffer_wrappers::guest_error::{ErrorCode, GuestError};
2424
use hyperlight_guest::error::{HyperlightGuestError, Result};
2525
use hyperlight_guest::exit::halt;
26-
use tracing::{Span, instrument};
26+
use tracing::instrument;
2727

2828
use crate::{GUEST_HANDLE, REGISTERED_GUEST_FUNCTIONS};
2929

3030
type GuestFunc = fn(&FunctionCall) -> Result<Vec<u8>>;
3131

32-
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
32+
#[instrument(skip_all, level = "Info")]
3333
pub(crate) fn call_guest_function(function_call: FunctionCall) -> Result<Vec<u8>> {
3434
// Validate this is a Guest Function Call
3535
if function_call.function_call_type() != FunctionCallType::Guest {
@@ -85,7 +85,7 @@ pub(crate) fn call_guest_function(function_call: FunctionCall) -> Result<Vec<u8>
8585
// This function may panic, as we have no other ways of dealing with errors at this level
8686
#[unsafe(no_mangle)]
8787
#[inline(never)]
88-
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
88+
#[instrument(skip_all, level = "Trace")]
8989
fn internal_dispatch_function() {
9090
let handle = unsafe { GUEST_HANDLE };
9191

@@ -119,7 +119,7 @@ fn internal_dispatch_function() {
119119
// This is implemented as a separate function to make sure that epilogue in the internal_dispatch_function is called before the halt()
120120
// which if it were included in the internal_dispatch_function cause the epilogue to not be called because the halt() would not return
121121
// when running in the hypervisor.
122-
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
122+
#[instrument(skip_all, level = "Info")]
123123
pub(crate) extern "C" fn dispatch_function() {
124124
// The hyperlight host likes to use one partition and reset it in
125125
// various ways; if that has happened, there might stale TLB

src/hyperlight_guest_bin/src/paging.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
use alloc::alloc::Layout;
1818
use core::arch::asm;
1919

20-
use tracing::{Span, instrument};
20+
use tracing::instrument;
2121

2222
use crate::OS_PAGE_SIZE;
2323

@@ -63,7 +63,7 @@ struct MapResponse {
6363
/// as such do not use concurrently with any other page table operations
6464
/// - TLB invalidation is not performed,
6565
/// if previously-unmapped ranges are not being mapped, TLB invalidation may need to be performed afterwards.
66-
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
66+
#[instrument(skip_all, level = "Trace")]
6767
pub unsafe fn map_region(phys_base: u64, virt_base: *mut u8, len: u64) {
6868
let mut pml4_base: u64;
6969
unsafe {

0 commit comments

Comments
 (0)