Skip to content

Commit f3c3ce4

Browse files
authored
Merge pull request #24 from hyperlight-dev/fix/surrogate-default-binary
2 parents 8affbcc + 1a15b27 commit f3c3ce4

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

.github/workflows/test-examples.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ jobs:
112112
working-directory: examples/${{ matrix.example }}
113113
run: |
114114
kraft-hyperlight --no-prompt build --plat hyperlight --arch x86_64 || true
115-
# Fallback: kraft's source-resolution path is flaky (it sometimes
116-
# probes + finds the repo but skips the pull and leaves
117-
# .unikraft/unikraft empty — see memory/feedback_kraft_clean_rebuild).
118-
# Manually clone the components and rebuild with --no-fetch/--no-update.
119-
if [ ! -d ".unikraft/unikraft" ] || [ -z "$(ls -A .unikraft/unikraft 2>/dev/null)" ]; then
120-
echo "::warning::kraft didn't clone unikraft sources; cloning manually"
115+
# Fallback: kraft's source-resolution is flaky it can partially
116+
# clone (e.g. unikraft but not libelf) or leave dirs empty. Check
117+
# for the actual kernel output; if missing, nuke everything and
118+
# clone + build from scratch.
119+
if ! ls .unikraft/build/*_hyperlight-x86_64 >/dev/null 2>&1; then
120+
echo "::warning::kraft build produced no kernel; cloning manually and rebuilding"
121121
UK_SOURCE=$(awk '/^unikraft:/{f=1} f && /source:/{print $2; exit}' kraft.yaml)
122122
UK_BRANCH=$(awk '/^unikraft:/{f=1} f && /version:/{print $2; exit}' kraft.yaml)
123123
ELF_SOURCE=$(awk '/app-elfloader:/{f=1} f && /source:/{print $2; exit}' kraft.yaml)
@@ -300,8 +300,8 @@ jobs:
300300
run: |
301301
just rootfs
302302
kraft-hyperlight --no-prompt build --plat hyperlight --arch x86_64 || true
303-
if [ ! -d ".unikraft/unikraft" ] || [ -z "$(ls -A .unikraft/unikraft 2>/dev/null)" ]; then
304-
echo "::warning::kraft didn't clone unikraft sources; cloning manually"
303+
if ! ls .unikraft/build/*_hyperlight-x86_64 >/dev/null 2>&1; then
304+
echo "::warning::kraft build produced no kernel; cloning manually and rebuilding"
305305
UK_SOURCE=$(awk '/^unikraft:/{f=1} f && /source:/{print $2; exit}' kraft.yaml)
306306
UK_BRANCH=$(awk '/^unikraft:/{f=1} f && /version:/{print $2; exit}' kraft.yaml)
307307
ELF_SOURCE=$(awk '/app-elfloader:/{f=1} f && /source:/{print $2; exit}' kraft.yaml)
@@ -445,7 +445,8 @@ jobs:
445445
run: |
446446
just rootfs
447447
kraft-hyperlight --no-prompt build --plat hyperlight --arch x86_64 || true
448-
if [ ! -d ".unikraft/unikraft" ] || [ -z "$(ls -A .unikraft/unikraft 2>/dev/null)" ]; then
448+
if ! ls .unikraft/build/*_hyperlight-x86_64 >/dev/null 2>&1; then
449+
echo "::warning::kraft build produced no kernel; cloning manually and rebuilding"
449450
UK_SOURCE=$(awk '/^unikraft:/{f=1} f && /source:/{print $2; exit}' kraft.yaml)
450451
UK_BRANCH=$(awk '/^unikraft:/{f=1} f && /version:/{print $2; exit}' kraft.yaml)
451452
ELF_SOURCE=$(awk '/app-elfloader:/{f=1} f && /source:/{print $2; exit}' kraft.yaml)

host/src/bin/pyhl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ fn fresh_seed() -> u128 {
581581
// -- main ---------------------------------------------------------------------
582582

583583
fn main() -> Result<()> {
584+
hyperlight_unikraft::pyhl::default_surrogate_count();
584585
let cli = Cli::parse();
585586
match cli.cmd {
586587
Command::Setup(args) => cmd_setup(args),

host/src/pyhl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use crate::{Preopen, Sandbox};
5454
/// callers would pay on the very first sandbox. Pinning the default to 1
5555
/// drops that to ~7 ms. Callers (or the embedding binary) can still
5656
/// override by setting the env var before calling into `pyhl`.
57-
fn default_surrogate_count() {
57+
pub fn default_surrogate_count() {
5858
if std::env::var_os("HYPERLIGHT_INITIAL_SURROGATES").is_none() {
5959
// Safety: must be called before any sandbox is created and
6060
// before additional threads are spawned.

0 commit comments

Comments
 (0)