Skip to content

Commit 54b3f4f

Browse files
committed
Remove Hypervisor-Handler thread, and timeout-based config
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent c454b0b commit 54b3f4f

20 files changed

+473
-2038
lines changed

.github/copilot-instructions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ Make sure that you keep commits small and focused. Each commit should represent
6363
Make sure that you arrange your commits in a logical order. You can use `git rebase -i` to do this.
6464
If you update your PR branch with new commits, make sure to rebase your branch on top of the main branch. This will help keep the commit history clean and make it easier to review your changes.
6565
Make sure that you do not have any merge commits in your PR.
66-
If when running tests you receive an Error like this "Error("No Hypervisor was found for Sandbox, Hypervisor Handler Message Receive Timedout")" then the real error is the string inside the brackets before the comma, so in this example
67-
the error is "No Hypervisor was found for Sandbox".
6866
If you see the error "No Hypervisor was found for Sandbox" then you if you are running on Linux you should check to see if there is a device called "kvm" or "mshv" in `/dev` and if it is present you should also check to see if you have rw access to it. You should ensure that you output the results of these checks for diagnostic purposes.
6967
This repository requires commits to be signed you should ensure that any commits that you create are done with `commit.gpgsign=true`. Also commits should also be signed with the `--signoff` option to comply with the DCO requirement.
7068

Justfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,12 @@ test-unit target=default-target features="":
8383
test-isolated target=default-target features="":
8484
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --lib -- sandbox::uninitialized::tests::test_trace_trace --exact --ignored
8585
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --lib -- sandbox::uninitialized::tests::test_log_trace --exact --ignored
86-
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --lib -- hypervisor::hypervisor_handler::tests::create_1000_sandboxes --exact --ignored
86+
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --lib -- sandbox::initialized_multi_use::tests::create_1000_sandboxes --exact --ignored
8787
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --lib -- sandbox::outb::tests::test_log_outb_log --exact --ignored
8888
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --lib -- mem::shared_mem::tests::test_drop --exact --ignored
8989
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --test integration_test -- log_message --exact --ignored
9090
@# metrics tests
91-
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --lib -- metrics::tests::test_metrics_are_emitted --exact --ignored
92-
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F function_call_metrics," + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --lib -- metrics::tests::test_metrics_are_emitted --exact --ignored
93-
91+
cargo test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F function_call_metrics," + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} -p hyperlight-host --lib -- metrics::tests::test_metrics_are_emitted --exact
9492
# runs integration tests. Guest can either be "rust" or "c"
9593
test-integration guest target=default-target features="":
9694
@# run execute_on_heap test with feature "executable_heap" on and off

docs/how-to-debug-a-hyperlight-guest.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,14 @@ To replicate the above behavior using VSCode follow the below steps:
142142
## How it works
143143

144144
The gdb feature is designed to work like a Request - Response protocol between
145-
a thread that accepts commands from a gdb client and the hypervisor handler over
146-
a communication channel.
145+
a thread that accepts commands from a gdb client and main thread of the sandbox.
147146

148147
All the functionality is implemented on the hypervisor side so it has access to
149148
the shared memory and the vCPU.
150149

151150
The gdb thread uses the `gdbstub` crate to handle the communication with the gdb client.
152151
When the gdb client requests one of the supported features mentioned above, a request
153-
is sent over the communication channel to the hypervisor handler for the sandbox
152+
is sent over the communication channel to the main thread for the sandbox
154153
to resolve.
155154

156155
Below is a sequence diagram that shows the interaction between the entities
@@ -161,7 +160,7 @@ involved in the gdb debugging of a Hyperlight guest running inside a **KVM** or
161160
│ Hyperlight Sandbox │
162161
USER │ │
163162
┌────────────┐ │ ┌──────────────┐ ┌───────────────────────────┐ ┌────────┐ │
164-
│ gdb client │ │ │ gdb thread │ │ hypervisor handler thread │ │ vCPU │ │
163+
│ gdb client │ │ │ gdb thread │ │ main sandbox thread │ │ vCPU │ │
165164
└────────────┘ │ └──────────────┘ └───────────────────────────┘ └────────┘ │
166165
| │ | create_gdb_thread | | │
167166
| │ |◄─────────────────────────────────────────┌─┐ vcpu stopped ┌─┐ │

src/hyperlight_host/benches/benchmarks.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
use std::time::Duration;
18-
1917
use criterion::{criterion_group, criterion_main, Criterion};
2018
use hyperlight_host::sandbox::{MultiUseSandbox, SandboxConfiguration, UninitializedSandbox};
2119
use hyperlight_host::sandbox_state::sandbox::EvolvableSandbox;
@@ -68,7 +66,6 @@ fn guest_call_benchmark(c: &mut Criterion) {
6866
let mut config = SandboxConfiguration::default();
6967
config.set_input_data_size(2 * SIZE + (1024 * 1024)); // 2 * SIZE + 1 MB, to allow 1MB for the rest of the serialized function call
7068
config.set_heap_size(SIZE as u64 * 15);
71-
config.set_max_execution_time(Duration::from_secs(10));
7269

7370
let sandbox = UninitializedSandbox::new(
7471
GuestBinary::FilePath(simple_guest_as_string().unwrap()),

src/hyperlight_host/src/error.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,6 @@ pub enum HyperlightError {
122122
#[error("HostFunction {0} was not found")]
123123
HostFunctionNotFound(String),
124124

125-
/// An attempt to communicate with or from the Hypervisor Handler thread failed
126-
/// (i.e., usually a failure call to `.send()` or `.recv()` on a message passing
127-
/// channel)
128-
#[error("Communication failure with the Hypervisor Handler thread")]
129-
HypervisorHandlerCommunicationFailure(),
130-
131-
/// An attempt to cancel a Hypervisor Handler execution failed.
132-
/// See `terminate_hypervisor_handler_execution_and_reinitialise`
133-
/// for more details.
134-
#[error("Hypervisor Handler execution cancel attempt on a finished execution")]
135-
HypervisorHandlerExecutionCancelAttemptOnFinishedExecution(),
136-
137-
/// A Receive for a Hypervisor Handler Message Timedout
138-
#[error("Hypervisor Handler Message Receive Timedout")]
139-
HypervisorHandlerMessageReceiveTimedout(),
140-
141125
/// Reading Writing or Seeking data failed.
142126
#[error("Reading Writing or Seeking data failed {0:?}")]
143127
IOError(#[from] std::io::Error),

src/hyperlight_host/src/func/call_ctx.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

1717
use tracing::{instrument, Span};
1818

19-
use super::guest_dispatch::call_function_on_guest;
2019
use super::{ParameterTuple, SupportedReturnType};
2120
use crate::{MultiUseSandbox, Result};
2221
/// A context for calling guest functions.
@@ -69,8 +68,11 @@ impl MultiUseGuestCallContext {
6968
// !Send (and !Sync), we also don't need to worry about
7069
// synchronization
7170

72-
let ret =
73-
call_function_on_guest(&mut self.sbox, func_name, Output::TYPE, args.into_value());
71+
let ret = self.sbox.call_guest_function_by_name_no_reset(
72+
func_name,
73+
Output::TYPE,
74+
args.into_value(),
75+
);
7476
Output::from_value(ret?)
7577
}
7678

0 commit comments

Comments
 (0)